Massive renaming update in nms. If you bypassed Bukkit, you will likely break.
Also minimized all the nms diffs and generic cleanups all around.
Dieser Commit ist enthalten in:
Ursprung
9e5dba8306
Commit
a98c7ba2c7
2
pom.xml
2
pom.xml
@ -39,7 +39,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>minecraft-server</artifactId>
|
<artifactId>minecraft-server</artifactId>
|
||||||
<version>1.6.6</version>
|
<version>1.6.6_01</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockBloodStone extends Block {
|
public class BlockBloodStone extends Block {
|
||||||
|
|
||||||
@ -15,13 +11,11 @@ public class BlockBloodStone extends Block {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
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()) {
|
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
|
||||||
int power = block.getBlockPower();
|
int power = block.getBlockPower();
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
BlockRedstoneEvent event = new BlockRedstoneEvent(block, power, power);
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -2,12 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockButton extends Block {
|
public class BlockButton extends Block {
|
||||||
|
|
||||||
@ -139,14 +134,13 @@ public class BlockButton extends Block {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
|
||||||
|
|
||||||
int old = (j1 != 8) ? 1 : 0;
|
int old = (j1 != 8) ? 1 : 0;
|
||||||
int current = (j1 == 8) ? 1 : 0;
|
int current = (j1 == 8) ? 1 : 0;
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||||
|
|
||||||
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -222,12 +216,10 @@ public class BlockButton extends Block {
|
|||||||
|
|
||||||
if ((l & 8) != 0) {
|
if ((l & 8) != 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
|
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||||
|
|
||||||
if (eventRedstone.getNewCurrent() > 0) return;
|
if (eventRedstone.getNewCurrent() > 0) return;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
import java.util.Random;
|
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) {
|
public void a(World world, int i, int j, int k, Entity entity) {
|
||||||
// CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event
|
// CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event
|
||||||
if (entity instanceof EntityLiving) {
|
if (entity instanceof EntityLiving) {
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
org.bukkit.block.Block damager = world.getWorld().getBlockAt(i, j, k);
|
||||||
org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
|
||||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
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);
|
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.CONTACT, 1);
|
||||||
server.getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
entity.damageEntity((Entity) null, event.getDamage());
|
entity.damageEntity((Entity) null, event.getDamage());
|
||||||
@ -100,6 +95,7 @@ public class BlockCactus extends Block {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
entity.damageEntity((Entity) null, 1);
|
entity.damageEntity((Entity) null, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,7 @@ package net.minecraft.server;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
|
||||||
import org.bukkit.event.block.BlockDispenseEvent;
|
import org.bukkit.event.block.BlockDispenseEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -123,19 +117,18 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
motY += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||||
motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
motZ += random.nextGaussian() * 0.007499999832361937D * 6.0D;
|
||||||
|
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
org.bukkit.inventory.ItemStack bukkitItem = new CraftItemStack(itemstack).clone();
|
||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
|
||||||
org.bukkit.inventory.ItemStack bukkitItem = (new CraftItemStack(itemstack)).clone();
|
|
||||||
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new Vector(motX, motY, motZ));
|
BlockDispenseEvent event = new BlockDispenseEvent(block, bukkitItem, new Vector(motX, motY, motZ));
|
||||||
server.getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actually remove the item
|
// Actually remove the item
|
||||||
tileentitydispenser.a(dispenseSlot, 1);
|
tileentitydispenser.splitStack(dispenseSlot, 1);
|
||||||
|
|
||||||
motX = event.getVelocity().getX();
|
motX = event.getVelocity().getX();
|
||||||
motY = event.getVelocity().getY();
|
motY = event.getVelocity().getY();
|
||||||
@ -148,7 +141,7 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
|
EntityArrow entityarrow = new EntityArrow(world, d0, d1, d2);
|
||||||
|
|
||||||
entityarrow.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
|
entityarrow.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
|
||||||
entityarrow.a = true;
|
entityarrow.fromPlayer = true;
|
||||||
world.addEntity(entityarrow);
|
world.addEntity(entityarrow);
|
||||||
world.e(1002, i, j, k, 0);
|
world.e(1002, i, j, k, 0);
|
||||||
} else if (itemstack.id == Item.EGG.id) {
|
} 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);
|
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
|
// double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
|
||||||
|
|
||||||
entityitem.motX = motX;
|
entityitem.motX = motX;
|
||||||
entityitem.motY = motY;
|
entityitem.motY = motY;
|
||||||
entityitem.motZ = motZ;
|
entityitem.motZ = motZ;
|
||||||
|
@ -2,11 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockDoor extends Block {
|
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);
|
boolean flag1 = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.World bworld = world.getWorld();
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
|
||||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
org.bukkit.block.Block blockTop = bworld.getBlockAt(i, j + 1, k);
|
||||||
org.bukkit.block.Block blockTop = craftWorld.getBlockAt(i, j + 1, k);
|
|
||||||
int power = block.getBlockPower();
|
int power = block.getBlockPower();
|
||||||
int powerTop = blockTop.getBlockPower();
|
int powerTop = blockTop.getBlockPower();
|
||||||
if (powerTop > power) power = powerTop;
|
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;
|
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -3,11 +3,8 @@ package net.minecraft.server;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.event.block.BlockBurnEvent;
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -90,11 +87,10 @@ public class BlockFire extends Block {
|
|||||||
this.a(world, i, j, k + 1, 300, random, l);
|
this.a(world, i, j, k + 1, 300, random, l);
|
||||||
|
|
||||||
// CraftBukkit start - Call to stop spread of fire.
|
// CraftBukkit start - Call to stop spread of fire.
|
||||||
Server server = ((WorldServer) world).getServer();
|
org.bukkit.Server server = world.getServer();
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
org.bukkit.World bworld = world.getWorld();
|
||||||
|
|
||||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
||||||
Player thePlayer = null;
|
|
||||||
// CraftBukkit
|
// CraftBukkit
|
||||||
|
|
||||||
for (int i1 = i - 1; i1 <= i + 1; ++i1) {
|
for (int i1 = i - 1; i1 <= i + 1; ++i1) {
|
||||||
@ -119,11 +115,12 @@ public class BlockFire extends Block {
|
|||||||
k2 = 15;
|
k2 = 15;
|
||||||
}
|
}
|
||||||
// CraftBukkit start - Call to stop spread of fire.
|
// CraftBukkit start - Call to stop spread of fire.
|
||||||
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) {
|
if (block.getTypeId() != Block.FIRE.id) {
|
||||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
BlockIgniteEvent event = new BlockIgniteEvent(block, igniteCause, null);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -147,11 +144,11 @@ public class BlockFire extends Block {
|
|||||||
if (random.nextInt(l) < j1) {
|
if (random.nextInt(l) < j1) {
|
||||||
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
|
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Server server = ((WorldServer) world).getServer();
|
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
|
||||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
|
||||||
BlockBurnEvent event = new BlockBurnEvent(theBlock);
|
BlockBurnEvent event = new BlockBurnEvent(theBlock);
|
||||||
server.getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,6 @@ import java.util.Random;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockFace;
|
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;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -30,9 +27,9 @@ public class BlockFlowing extends BlockFluids {
|
|||||||
|
|
||||||
public void a(World world, int i, int j, int k, Random random) {
|
public void a(World world, int i, int j, int k, Random random) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
org.bukkit.World bworld = world.getWorld();
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
org.bukkit.Server server = world.getServer();
|
||||||
CraftBlock source = cworld == null ? null : (CraftBlock) cworld.getBlockAt(i, j, k);
|
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
int l = this.g(world, i, j, k);
|
int l = this.g(world, i, j, k);
|
||||||
|
@ -2,12 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockFadeEvent; // CraftBukkit
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockIce extends BlockBreakable {
|
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) {
|
public void a(World world, int i, int j, int k, Random random) {
|
||||||
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.q[this.id]) {
|
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.q[this.id]) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = world.getServer();
|
org.bukkit.block.BlockState blockState = world.getWorld().getBlockAt(i, j, k).getState();
|
||||||
CraftWorld cworld = world.getWorld();
|
|
||||||
BlockState blockState = cworld.getBlockAt(i, j, k).getState();
|
|
||||||
blockState.setTypeId(this.id);
|
blockState.setTypeId(this.id);
|
||||||
|
|
||||||
BlockFadeEvent event = new BlockFadeEvent(cworld.getBlockAt(i, j, k), blockState);
|
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
|
||||||
server.getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.event.block.LeavesDecayEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockLeaves extends BlockLeavesBase {
|
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) {
|
private void g(World world, int i, int j, int k) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
LeavesDecayEvent event = new LeavesDecayEvent(cworld.getBlockAt(i, j, k));
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) return;
|
if (event.isCancelled()) return;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockLever extends Block {
|
public class BlockLever extends Block {
|
||||||
|
|
||||||
@ -144,14 +139,12 @@ public class BlockLever extends Block {
|
|||||||
int j1 = 8 - (l & 8);
|
int j1 = 8 - (l & 8);
|
||||||
|
|
||||||
// CraftBukkit start - Interact Lever
|
// CraftBukkit start - Interact Lever
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
|
||||||
|
|
||||||
int old = (j1 != 8) ? 1 : 0;
|
int old = (j1 != 8) ? 1 : 0;
|
||||||
int current = (j1 == 8) ? 1 : 0;
|
int current = (j1 == 8) ? 1 : 0;
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||||
|
|
||||||
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -3,16 +3,7 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
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
|
|
||||||
|
|
||||||
public class BlockMinecartDetector extends BlockMinecartTrack {
|
public class BlockMinecartDetector extends BlockMinecartTrack {
|
||||||
|
|
||||||
@ -69,12 +60,10 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (flag != flag1) {
|
if (flag != flag1) {
|
||||||
CraftServer server = world.getServer();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftWorld craftWorld = world.getWorld();
|
|
||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
|
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||||
|
|
||||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockSpreadEvent; // CraftBukkit
|
||||||
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
|
|
||||||
|
|
||||||
public class BlockMushroom extends BlockFlower {
|
public class BlockMushroom extends BlockFlower {
|
||||||
|
|
||||||
@ -32,14 +26,12 @@ public class BlockMushroom extends BlockFlower {
|
|||||||
k1 = k + (random.nextInt(3) - 1);
|
k1 = k + (random.nextInt(3) - 1);
|
||||||
if (world.isEmpty(l, i1, j1) && this.f(world, l, i1, j1)) {
|
if (world.isEmpty(l, i1, j1) && this.f(world, l, i1, j1)) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Server server = world.getServer();
|
org.bukkit.World bworld = world.getWorld();
|
||||||
CraftWorld craftworld = world.getWorld();
|
org.bukkit.block.BlockState blockState = bworld.getBlockAt(l, i1, j1).getState();
|
||||||
BlockState blockState = craftworld.getBlockAt(l, i1, j1).getState();
|
|
||||||
blockState.setTypeId(this.id);
|
blockState.setTypeId(this.id);
|
||||||
|
|
||||||
BlockSpreadEvent event = new BlockSpreadEvent(craftworld.getBlockAt(l, i1, j1), craftworld.getBlockAt(i, j, k), blockState);
|
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(i, j, k), blockState);
|
||||||
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
|
@ -3,10 +3,6 @@ package net.minecraft.server;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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.entity.EntityPortalEnterEvent;
|
||||||
import org.bukkit.event.world.PortalCreateEvent;
|
import org.bukkit.event.world.PortalCreateEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -60,8 +56,8 @@ public class BlockPortal extends BlockBreakable {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
java.util.ArrayList<org.bukkit.block.Block> blocks = new ArrayList<org.bukkit.block.Block>();
|
java.util.Collection<org.bukkit.block.Block> blocks = new java.util.HashSet<org.bukkit.block.Block>();
|
||||||
CraftWorld craftWorld = world.getWorld();
|
org.bukkit.World bworld = world.getWorld();
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (world.getTypeId(i - b0, j, k - b1) == 0) {
|
if (world.getTypeId(i - b0, j, k - b1) == 0) {
|
||||||
@ -83,12 +79,7 @@ public class BlockPortal extends BlockBreakable {
|
|||||||
if (j1 != Block.OBSIDIAN.id) {
|
if (j1 != Block.OBSIDIAN.id) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start
|
blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l)); // CraftBukkit
|
||||||
org.bukkit.block.Block b = craftWorld.getBlockAt(i + b0 * l, j + i1, k + b1 * l);
|
|
||||||
if (!blocks.contains(b)) {
|
|
||||||
blocks.add(b);
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
} else if (j1 != 0 && j1 != Block.FIRE.id) {
|
} else if (j1 != 0 && j1 != Block.FIRE.id) {
|
||||||
return false;
|
return false;
|
||||||
@ -100,21 +91,19 @@ public class BlockPortal extends BlockBreakable {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
for (l = 0; l < 2; ++l) {
|
for (l = 0; l < 2; ++l) {
|
||||||
for (i1 = 0; i1 < 3; ++i1) {
|
for (i1 = 0; i1 < 3; ++i1) {
|
||||||
org.bukkit.block.Block b = craftWorld.getBlockAt(i + b0 * l, j + i1, k + b1 * l);
|
blocks.add(bworld.getBlockAt(i + b0 * l, j + i1, k + b1 * l));
|
||||||
if (!blocks.contains(b)) {
|
|
||||||
blocks.add(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PortalCreateEvent event = new PortalCreateEvent(blocks, (org.bukkit.World) craftWorld);
|
PortalCreateEvent event = new PortalCreateEvent(blocks, bworld);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
world.o = true;
|
world.suppressPhysics = true;
|
||||||
|
|
||||||
for (l = 0; l < 2; ++l) {
|
for (l = 0; l < 2; ++l) {
|
||||||
for (i1 = 0; i1 < 3; ++i1) {
|
for (i1 = 0; i1 < 3; ++i1) {
|
||||||
@ -122,7 +111,7 @@ public class BlockPortal extends BlockBreakable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
world.o = false;
|
world.suppressPhysics = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,9 +162,8 @@ public class BlockPortal extends BlockBreakable {
|
|||||||
public void a(World world, int i, int j, int k, Entity entity) {
|
public void a(World world, int i, int j, int k, Entity entity) {
|
||||||
if (entity.vehicle == null && entity.passenger == null) {
|
if (entity.vehicle == null && entity.passenger == null) {
|
||||||
// CraftBukkit start - Entity in portal
|
// CraftBukkit start - Entity in portal
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), i, j, k));
|
||||||
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(craftWorld, i, j, k));
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
entity.O();
|
entity.O();
|
||||||
|
@ -4,16 +4,9 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
import org.bukkit.event.entity.EntityInteractEvent;
|
import org.bukkit.event.entity.EntityInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class BlockPressurePlate extends Block {
|
public class BlockPressurePlate extends Block {
|
||||||
@ -103,17 +96,20 @@ public class BlockPressurePlate extends Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start - Interact Pressure Plate
|
// CraftBukkit start - Interact Pressure Plate
|
||||||
|
org.bukkit.World bworld = world.getWorld();
|
||||||
|
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||||
|
|
||||||
if (flag != flag1) {
|
if (flag != flag1) {
|
||||||
if (flag1) {
|
if (flag1) {
|
||||||
for (Object object: list) {
|
for (Object object: list) {
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
Cancellable cancellable;
|
org.bukkit.event.Cancellable cancellable;
|
||||||
|
|
||||||
if (object instanceof EntityHuman) {
|
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) {
|
} else if (object instanceof Entity) {
|
||||||
cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), ((WorldServer) world).getWorld().getBlockAt(i, j, k));
|
cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), bworld.getBlockAt(i, j, k));
|
||||||
((CraftServer) Bukkit.getServer()).getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
manager.callEvent((EntityInteractEvent) cancellable);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -124,12 +120,8 @@ public class BlockPressurePlate extends Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), flag ? 1 : 0, flag1 ? 1 : 0);
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
manager.callEvent(eventRedstone);
|
||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
|
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
|
||||||
|
|
||||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockPumpkin extends Block {
|
public class BlockPumpkin extends Block {
|
||||||
|
|
||||||
@ -56,13 +52,11 @@ public class BlockPumpkin extends Block {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
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()) {
|
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
org.bukkit.block.Block block = craftWorld.getBlockAt(i, j, k);
|
|
||||||
int power = block.getBlockPower();
|
int power = block.getBlockPower();
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -4,11 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockRedstoneTorch extends BlockTorch {
|
public class BlockRedstoneTorch extends BlockTorch {
|
||||||
|
|
||||||
@ -100,9 +96,10 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||||
PluginManager man = ((WorldServer) world).getServer().getPluginManager();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
int oldCurrent = this.isOn ? 15 : 0;
|
int oldCurrent = this.isOn ? 15 : 0;
|
||||||
|
|
||||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -111,7 +108,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (oldCurrent != 0) {
|
if (oldCurrent != 0) {
|
||||||
event.setNewCurrent(0);
|
event.setNewCurrent(0);
|
||||||
man.callEvent(event);
|
manager.callEvent(event);
|
||||||
if (event.getNewCurrent() != 0) {
|
if (event.getNewCurrent() != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -135,7 +132,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (oldCurrent != 15) {
|
if (oldCurrent != 15) {
|
||||||
event.setNewCurrent(15);
|
event.setNewCurrent(15);
|
||||||
man.callEvent(event);
|
manager.callEvent(event);
|
||||||
if (event.getNewCurrent() != 15) {
|
if (event.getNewCurrent() != 15) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockRedstoneWire extends Block {
|
public class BlockRedstoneWire extends Block {
|
||||||
|
|
||||||
@ -109,18 +106,18 @@ public class BlockRedstoneWire extends Block {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (k1 != l1) {
|
if (k1 != l1) {
|
||||||
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(i, j, k), k1, l1);
|
||||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, k1, l1);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
|
||||||
l1 = event.getNewCurrent();
|
l1 = event.getNewCurrent();
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (k1 != l1) {
|
if (k1 != l1) {
|
||||||
world.o = true;
|
world.suppressPhysics = true;
|
||||||
world.setData(i, j, k, l1);
|
world.setData(i, j, k, l1);
|
||||||
world.b(i, j, k, i, j, k);
|
world.b(i, j, k, i, j, k);
|
||||||
world.o = false;
|
world.suppressPhysics = false;
|
||||||
|
|
||||||
for (i2 = 0; i2 < 4; ++i2) {
|
for (i2 = 0; i2 < 4; ++i2) {
|
||||||
j2 = i;
|
j2 = i;
|
||||||
|
@ -71,15 +71,15 @@ public class BlockSapling extends BlockFlower {
|
|||||||
BlockChangeWithNotify(World world) { this.world = world; }
|
BlockChangeWithNotify(World world) { this.world = world; }
|
||||||
|
|
||||||
public boolean setRawTypeId(int x, int y, int z, int type) {
|
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) {
|
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) {
|
public int getTypeId(int x, int y, int z) {
|
||||||
return world.getTypeId(x, y, z);
|
return this.world.getTypeId(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -2,12 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockSign extends BlockContainer {
|
public class BlockSign extends BlockContainer {
|
||||||
|
|
||||||
@ -114,13 +109,11 @@ public class BlockSign extends BlockContainer {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].isPowerSource()) {
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
Block block = craftWorld.getBlockAt(i, j, k);
|
|
||||||
int power = block.getBlockPower();
|
int power = block.getBlockPower();
|
||||||
|
|
||||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power);
|
||||||
server.getPluginManager().callEvent(eventRedstone);
|
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockFadeEvent; // CraftBukkit
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class BlockSnow extends Block {
|
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) {
|
public void a(World world, int i, int j, int k, Random random) {
|
||||||
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11) {
|
if (world.a(EnumSkyBlock.BLOCK, i, j, k) > 11) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = world.getServer();
|
org.bukkit.block.BlockState blockState = world.getWorld().getBlockAt(i, j, k).getState();
|
||||||
CraftWorld cworld = world.getWorld();
|
|
||||||
BlockState blockState = cworld.getBlockAt(i, j, k).getState();
|
|
||||||
blockState.setTypeId(this.id);
|
blockState.setTypeId(this.id);
|
||||||
|
|
||||||
BlockFadeEvent event = new BlockFadeEvent(cworld.getBlockAt(i, j, k), blockState);
|
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
|
||||||
server.getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,7 @@ package net.minecraft.server;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.entity.EntityInteractEvent;
|
import org.bukkit.event.entity.EntityInteractEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -56,12 +52,12 @@ public class BlockSoil extends Block {
|
|||||||
public void b(World world, int i, int j, int k, Entity entity) {
|
public void b(World world, int i, int j, int k, Entity entity) {
|
||||||
if (world.random.nextInt(4) == 0) {
|
if (world.random.nextInt(4) == 0) {
|
||||||
// CraftBukkit start - Interact Soil
|
// CraftBukkit start - Interact Soil
|
||||||
Cancellable cancellable;
|
org.bukkit.event.Cancellable cancellable;
|
||||||
if (entity instanceof EntityHuman) {
|
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 {
|
} else {
|
||||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), ((WorldServer) world).getWorld().getBlockAt(i, j, k));
|
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
|
||||||
((CraftServer) Bukkit.getServer()).getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cancellable.isCancelled()) {
|
if (cancellable.isCancelled()) {
|
||||||
|
@ -2,13 +2,7 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.block.BlockIgniteEvent; // CraftBukkit
|
||||||
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
|
|
||||||
|
|
||||||
public class BlockStationary extends BlockFluids {
|
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) {
|
private void i(World world, int i, int j, int k) {
|
||||||
int l = world.getData(i, j, k);
|
int l = world.getData(i, j, k);
|
||||||
|
|
||||||
world.o = true;
|
world.suppressPhysics = true;
|
||||||
world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
|
world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
|
||||||
world.b(i, j, k, i, j, k);
|
world.b(i, j, k, i, j, k);
|
||||||
world.c(i, j, k, this.id - 1, this.c());
|
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) {
|
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);
|
int l = random.nextInt(3);
|
||||||
|
|
||||||
// CraftBukkit start - prevent lava putting something on fire.
|
// CraftBukkit start - prevent lava putting something on fire.
|
||||||
Server server = ((WorldServer) world).getServer();
|
org.bukkit.World bworld = world.getWorld();
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
BlockIgniteEvent.IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
||||||
|
|
||||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
|
||||||
Player thePlayer = null;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
for (int i1 = 0; i1 < l; ++i1) {
|
for (int i1 = 0; i1 < l; ++i1) {
|
||||||
@ -58,11 +49,12 @@ public class BlockStationary extends BlockFluids {
|
|||||||
if (j1 == 0) {
|
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)) {
|
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.
|
// 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()) {
|
if (event.isCancelled()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
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 class Chunk {
|
||||||
|
|
||||||
public static boolean a;
|
public static boolean a;
|
||||||
@ -21,7 +15,7 @@ public class Chunk {
|
|||||||
public NibbleArray e;
|
public NibbleArray e;
|
||||||
public NibbleArray f;
|
public NibbleArray f;
|
||||||
public NibbleArray g;
|
public NibbleArray g;
|
||||||
public byte[] h;
|
public byte[] heightMap;
|
||||||
public int i;
|
public int i;
|
||||||
public final int x;
|
public final int x;
|
||||||
public final int z;
|
public final int z;
|
||||||
@ -43,17 +37,17 @@ public class Chunk {
|
|||||||
this.world = world;
|
this.world = world;
|
||||||
this.x = i;
|
this.x = i;
|
||||||
this.z = j;
|
this.z = j;
|
||||||
this.h = new byte[256];
|
this.heightMap = new byte[256];
|
||||||
|
|
||||||
for (int k = 0; k < this.entitySlices.length; ++k) {
|
for (int k = 0; k < this.entitySlices.length; ++k) {
|
||||||
this.entitySlices[k] = new ArrayList();
|
this.entitySlices[k] = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftWorld cw = ((WorldServer) world).getWorld();
|
org.bukkit.craftbukkit.CraftWorld cworld = this.world.getWorld();
|
||||||
bukkitChunk = (cw == null) ? null : cw.popPreservedChunk(i, j);
|
this.bukkitChunk = (cworld == null) ? null : cworld.popPreservedChunk(i, j);
|
||||||
if (bukkitChunk == null) {
|
if (this.bukkitChunk == null) {
|
||||||
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,12 +67,12 @@ public class Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int b(int i, int j) {
|
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 a() {}
|
||||||
|
|
||||||
public void b() {
|
public void initLighting() {
|
||||||
int i = 127;
|
int i = 127;
|
||||||
|
|
||||||
int j;
|
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) {
|
if (l < i) {
|
||||||
i = l;
|
i = l;
|
||||||
}
|
}
|
||||||
@ -152,7 +146,7 @@ public class Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void g(int i, int j, int k) {
|
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;
|
int i1 = l;
|
||||||
|
|
||||||
if (j > l) {
|
if (j > l) {
|
||||||
@ -165,7 +159,7 @@ public class Chunk {
|
|||||||
|
|
||||||
if (i1 != l) {
|
if (i1 != l) {
|
||||||
this.world.g(i, k, 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 k1;
|
||||||
int l1;
|
int l1;
|
||||||
int i2;
|
int i2;
|
||||||
@ -177,8 +171,8 @@ public class Chunk {
|
|||||||
|
|
||||||
for (l1 = 0; l1 < 16; ++l1) {
|
for (l1 = 0; l1 < 16; ++l1) {
|
||||||
for (i2 = 0; i2 < 16; ++i2) {
|
for (i2 = 0; i2 < 16; ++i2) {
|
||||||
if ((this.h[i2 << 4 | l1] & 255) < k1) {
|
if ((this.heightMap[i2 << 4 | l1] & 255) < k1) {
|
||||||
k1 = this.h[i2 << 4 | l1] & 255;
|
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) {
|
public boolean a(int i, int j, int k, int l, int i1) {
|
||||||
byte b0 = (byte) l;
|
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;
|
int k1 = this.b[i << 11 | k << 7 | j] & 255;
|
||||||
|
|
||||||
if (k1 == l && this.e.a(i, j, k) == i1) {
|
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) {
|
public boolean a(int i, int j, int k, int l) {
|
||||||
byte b0 = (byte) 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;
|
int j1 = this.b[i << 11 | k << 7 | j] & 255;
|
||||||
|
|
||||||
if (j1 == l) {
|
if (j1 == l) {
|
||||||
@ -401,7 +395,7 @@ public class Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean c(int i, int j, int k) {
|
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) {
|
public TileEntity d(int i, int j, int k) {
|
||||||
@ -425,9 +419,9 @@ public class Chunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(TileEntity tileentity) {
|
public void a(TileEntity tileentity) {
|
||||||
int i = tileentity.e - this.x * 16;
|
int i = tileentity.x - this.x * 16;
|
||||||
int j = tileentity.f;
|
int j = tileentity.y;
|
||||||
int k = tileentity.g - this.z * 16;
|
int k = tileentity.z - this.z * 16;
|
||||||
|
|
||||||
this.a(i, j, k, tileentity);
|
this.a(i, j, k, tileentity);
|
||||||
}
|
}
|
||||||
@ -436,9 +430,9 @@ public class Chunk {
|
|||||||
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
|
||||||
|
|
||||||
tileentity.world = this.world;
|
tileentity.world = this.world;
|
||||||
tileentity.e = this.x * 16 + i;
|
tileentity.x = this.x * 16 + i;
|
||||||
tileentity.f = j;
|
tileentity.y = j;
|
||||||
tileentity.g = this.z * 16 + k;
|
tileentity.z = this.z * 16 + k;
|
||||||
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
|
if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
|
||||||
if (this.c) {
|
if (this.c) {
|
||||||
if (this.tileEntities.get(chunkposition) != null) {
|
if (this.tileEntities.get(chunkposition) != null) {
|
||||||
@ -477,11 +471,11 @@ public class Chunk {
|
|||||||
|
|
||||||
for (int i = 0; i < this.entitySlices.length; ++i) {
|
for (int i = 0; i < this.entitySlices.length; ++i) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Iterator<Object> iter = this.entitySlices[i].iterator();
|
java.util.Iterator<Object> iter = this.entitySlices[i].iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Entity entity = (Entity) iter.next();
|
Entity entity = (Entity) iter.next();
|
||||||
int cx = Location.locToBlock(entity.locX) >> 4;
|
int cx = org.bukkit.Location.locToBlock(entity.locX) >> 4;
|
||||||
int cz = Location.locToBlock(entity.locZ) >> 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.
|
// 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)
|
// (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 l1 = l - i;
|
||||||
int i2 = i1 - j;
|
int i2 = i1 - j;
|
||||||
int j2 = j1 - k;
|
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);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +10,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.craftbukkit.CraftChunk;
|
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.LongHashset;
|
||||||
import org.bukkit.craftbukkit.util.LongHashtable;
|
import org.bukkit.craftbukkit.util.LongHashtable;
|
||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
@ -30,7 +26,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
public Chunk emptyChunk;
|
public Chunk emptyChunk;
|
||||||
public IChunkProvider chunkProvider; // CraftBukkit
|
public IChunkProvider chunkProvider; // CraftBukkit
|
||||||
private IChunkLoader e;
|
private IChunkLoader e;
|
||||||
public boolean a = false;
|
public boolean forceChunkLoad = false;
|
||||||
public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>();
|
public LongHashtable<Chunk> chunks = new LongHashtable<Chunk>();
|
||||||
public List chunkList = new ArrayList();
|
public List chunkList = new ArrayList();
|
||||||
public WorldServer world;
|
public WorldServer world;
|
||||||
@ -73,7 +69,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
} else {
|
} else {
|
||||||
chunk = this.chunkProvider.getOrCreateChunk(i, j);
|
chunk = this.chunkProvider.getOrCreateChunk(i, j);
|
||||||
}
|
}
|
||||||
newChunk = true; // Craftbukkit
|
newChunk = true; // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
this.chunks.put(i, j, chunk); // CraftBukkit
|
this.chunks.put(i, j, chunk); // CraftBukkit
|
||||||
@ -84,7 +80,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = this.world.getServer();
|
org.bukkit.Server server = this.world.getServer();
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
/*
|
/*
|
||||||
* If it's a new world, the first few chunks are generated inside
|
* If it's a new world, the first few chunks are generated inside
|
||||||
@ -119,7 +115,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Chunk chunk = (Chunk) this.chunks.get(i, j);
|
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 (chunk == this.emptyChunk) return chunk;
|
||||||
if (i != chunk.x || j != chunk.z) {
|
if (i != chunk.x || j != chunk.z) {
|
||||||
MinecraftServer.log.info("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ")");
|
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);
|
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
BlockSand.a = true;
|
BlockSand.instaFall = true;
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
random.setSeed(world.getSeed());
|
random.setSeed(world.getSeed());
|
||||||
long xRand = random.nextLong() / 2L * 2L + 1L;
|
long xRand = random.nextLong() / 2L * 2L + 1L;
|
||||||
long zRand = random.nextLong() / 2L * 2L + 1L;
|
long zRand = random.nextLong() / 2L * 2L + 1L;
|
||||||
random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed());
|
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) {
|
if (world != null) {
|
||||||
for (BlockPopulator populator : world.getPopulators()) {
|
for (BlockPopulator populator : world.getPopulators()) {
|
||||||
populator.populate(world, random, chunk.bukkitChunk);
|
populator.populate(world, random, chunk.bukkitChunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlockSand.a = false;
|
BlockSand.instaFall = false;
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new ChunkPopulateEvent(chunk.bukkitChunk));
|
this.world.getServer().getPluginManager().callEvent(new ChunkPopulateEvent(chunk.bukkitChunk));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
chunk.f();
|
chunk.f();
|
||||||
@ -234,9 +231,9 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean unloadChunks() {
|
public boolean unloadChunks() {
|
||||||
if (!this.world.E) {
|
if (!this.world.canSave) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Server server = this.world.getServer();
|
org.bukkit.Server server = this.world.getServer();
|
||||||
for (int i = 0; i < 50 && !this.unloadQueue.isEmpty(); i++) {
|
for (int i = 0; i < 50 && !this.unloadQueue.isEmpty(); i++) {
|
||||||
long chunkcoordinates = this.unloadQueue.popFirst();
|
long chunkcoordinates = this.unloadQueue.popFirst();
|
||||||
Chunk chunk = this.chunks.get(chunkcoordinates);
|
Chunk chunk = this.chunks.get(chunkcoordinates);
|
||||||
@ -265,7 +262,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
return this.chunkProvider.unloadChunks();
|
return this.chunkProvider.unloadChunks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean b() {
|
public boolean canSave() {
|
||||||
return !this.world.E;
|
return !this.world.canSave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,8 @@ import java.util.Set;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.util.List;
|
|
||||||
import org.bukkit.craftbukkit.command.ServerCommandListener;
|
import org.bukkit.craftbukkit.command.ServerCommandListener;
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class ConsoleCommandHandler {
|
public class ConsoleCommandHandler {
|
||||||
@ -25,7 +23,7 @@ public class ConsoleCommandHandler {
|
|||||||
String s = servercommand.command;
|
String s = servercommand.command;
|
||||||
ICommandListener icommandlistener = servercommand.b;
|
ICommandListener icommandlistener = servercommand.b;
|
||||||
String s1 = icommandlistener.getName();
|
String s1 = icommandlistener.getName();
|
||||||
listener = icommandlistener; // CraftBukkit
|
this.listener = icommandlistener; // CraftBukkit
|
||||||
ServerConfigurationManager serverconfigurationmanager = this.server.serverConfigurationManager;
|
ServerConfigurationManager serverconfigurationmanager = this.server.serverConfigurationManager;
|
||||||
|
|
||||||
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
|
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
|
||||||
@ -47,10 +45,10 @@ public class ConsoleCommandHandler {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
for (i = 0; i < this.server.worlds.size(); ++i) {
|
for (i = 0; i < this.server.worlds.size(); ++i) {
|
||||||
worldserver = this.server.worlds.get(i);
|
worldserver = this.server.worlds.get(i);
|
||||||
boolean save = worldserver.E;
|
boolean save = worldserver.canSave;
|
||||||
worldserver.E = false;
|
worldserver.canSave = false;
|
||||||
worldserver.save(true, (IProgressUpdate) null);
|
worldserver.save(true, (IProgressUpdate) null);
|
||||||
worldserver.E = save;
|
worldserver.canSave = save;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -60,14 +58,14 @@ public class ConsoleCommandHandler {
|
|||||||
|
|
||||||
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
|
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
|
||||||
worldserver = this.server.worlds.get(i); // CraftBukkit
|
worldserver = this.server.worlds.get(i); // CraftBukkit
|
||||||
worldserver.E = true;
|
worldserver.canSave = true;
|
||||||
}
|
}
|
||||||
} else if (s.toLowerCase().startsWith("save-on")) {
|
} else if (s.toLowerCase().startsWith("save-on")) {
|
||||||
this.print(s1, "Enabling level saving..");
|
this.print(s1, "Enabling level saving..");
|
||||||
|
|
||||||
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
|
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
|
||||||
worldserver = this.server.worlds.get(i); // CraftBukkit
|
worldserver = this.server.worlds.get(i); // CraftBukkit
|
||||||
worldserver.E = false;
|
worldserver.canSave = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String s2;
|
String s2;
|
||||||
@ -261,7 +259,7 @@ public class ConsoleCommandHandler {
|
|||||||
|
|
||||||
private void a(String s, String s1, ICommandListener icommandlistener) {
|
private void a(String s, String s1, ICommandListener icommandlistener) {
|
||||||
String[] astring = s1.split(" ");
|
String[] astring = s1.split(" ");
|
||||||
listener = icommandlistener; // CraftBukkit
|
this.listener = icommandlistener; // CraftBukkit
|
||||||
|
|
||||||
if (astring.length >= 2) {
|
if (astring.length >= 2) {
|
||||||
String s2 = astring[1].toLowerCase();
|
String s2 = astring[1].toLowerCase();
|
||||||
@ -330,9 +328,9 @@ public class ConsoleCommandHandler {
|
|||||||
String s2 = s + ": " + s1;
|
String s2 = s + ": " + s1;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
listener.sendMessage(s1);
|
this.listener.sendMessage(s1);
|
||||||
informOps("\u00A77(" + s2 + ")");
|
this.informOps("\u00A77(" + s2 + ")");
|
||||||
if (listener instanceof MinecraftServer) {
|
if (this.listener instanceof MinecraftServer) {
|
||||||
return; // Already logged so don't call a.info()
|
return; // Already logged so don't call a.info()
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -343,16 +341,16 @@ public class ConsoleCommandHandler {
|
|||||||
private void informOps(String msg) {
|
private void informOps(String msg) {
|
||||||
Packet3Chat packet3chat = new Packet3Chat(msg);
|
Packet3Chat packet3chat = new Packet3Chat(msg);
|
||||||
EntityPlayer sender = null;
|
EntityPlayer sender = null;
|
||||||
if (listener instanceof ServerCommandListener) {
|
if (this.listener instanceof ServerCommandListener) {
|
||||||
CommandSender commandSender = ((ServerCommandListener) listener).getSender();
|
org.bukkit.command.CommandSender commandSender = ((ServerCommandListener) this.listener).getSender();
|
||||||
if (commandSender instanceof CraftPlayer) {
|
if (commandSender instanceof CraftPlayer) {
|
||||||
sender = ((CraftPlayer) commandSender).getHandle();
|
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) {
|
for (int i = 0; i < players.size(); ++i) {
|
||||||
EntityPlayer entityPlayer = (EntityPlayer) players.get(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);
|
entityPlayer.netServerHandler.sendPacket(packet3chat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.logging.Handler;
|
import java.util.logging.Handler;
|
||||||
import org.bukkit.craftbukkit.util.ShortConsoleLogFormatter;
|
import org.bukkit.craftbukkit.util.ShortConsoleLogFormatter;
|
||||||
import org.bukkit.craftbukkit.util.TerminalConsoleHandler;
|
import org.bukkit.craftbukkit.util.TerminalConsoleHandler;
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ContainerPlayer extends Container {
|
public class ContainerPlayer extends Container {
|
||||||
|
|
||||||
public InventoryCrafting a;
|
public InventoryCrafting craftInventory;
|
||||||
public IInventory b;
|
public IInventory resultInventory;
|
||||||
public boolean c;
|
public boolean c;
|
||||||
|
|
||||||
public ContainerPlayer(InventoryPlayer inventoryplayer) {
|
public ContainerPlayer(InventoryPlayer inventoryplayer) {
|
||||||
@ -14,18 +11,18 @@ public class ContainerPlayer extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ContainerPlayer(InventoryPlayer inventoryplayer, boolean flag) {
|
public ContainerPlayer(InventoryPlayer inventoryplayer, boolean flag) {
|
||||||
this.a = new InventoryCrafting(this, 2, 2);
|
this.craftInventory = new InventoryCrafting(this, 2, 2);
|
||||||
this.b = new InventoryCraftResult();
|
this.resultInventory = new InventoryCraftResult();
|
||||||
this.c = false;
|
this.c = false;
|
||||||
this.c = flag;
|
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 i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (i = 0; i < 2; ++i) {
|
for (i = 0; i < 2; ++i) {
|
||||||
for (j = 0; j < 2; ++j) {
|
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(new Slot(inventoryplayer, i, 8 + i * 18, 142));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.a((IInventory) this.a);
|
this.a((IInventory) this.craftInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(IInventory iinventory) {
|
public void a(IInventory iinventory) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
ItemStack craftResult = CraftingManager.a().a(this.a);
|
ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory);
|
||||||
this.b.setItem(0, craftResult);
|
this.resultInventory.setItem(0, craftResult);
|
||||||
if (super.g.size() < 1) {
|
if (super.listeners.size() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPlayer player = (EntityPlayer) super.g.get(0); // TODO: Is this _always_ correct? Seems like it.
|
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
|
||||||
player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(player.activeContainer.f, 0, craftResult)));
|
player.netServerHandler.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,11 +60,11 @@ public class ContainerPlayer extends Container {
|
|||||||
super.a(entityhuman);
|
super.a(entityhuman);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
ItemStack itemstack = this.a.getItem(i);
|
ItemStack itemstack = this.craftInventory.getItem(i);
|
||||||
|
|
||||||
if (itemstack != null) {
|
if (itemstack != null) {
|
||||||
entityhuman.b(itemstack);
|
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()) {
|
if (slot != null && slot.b()) {
|
||||||
ItemStack itemstack1 = slot.getItem();
|
ItemStack itemstack1 = slot.getItem();
|
||||||
|
|
||||||
itemstack = itemstack1.j();
|
itemstack = itemstack1.cloneItemStack();
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
this.a(itemstack1, 9, 45, true);
|
this.a(itemstack1, 9, 45, true);
|
||||||
} else if (i >= 9 && i < 36) {
|
} else if (i >= 9 && i < 36) {
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class ContainerWorkbench extends Container {
|
public class ContainerWorkbench extends Container {
|
||||||
|
|
||||||
public InventoryCrafting a = new InventoryCrafting(this, 3, 3);
|
public InventoryCrafting craftInventory = new InventoryCrafting(this, 3, 3);
|
||||||
public IInventory b = new InventoryCraftResult();
|
public IInventory resultInventory = new InventoryCraftResult();
|
||||||
private World c;
|
private World c;
|
||||||
private int h;
|
private int h;
|
||||||
private int i;
|
private int i;
|
||||||
@ -17,14 +14,14 @@ public class ContainerWorkbench extends Container {
|
|||||||
this.h = i;
|
this.h = i;
|
||||||
this.i = j;
|
this.i = j;
|
||||||
this.j = k;
|
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 l;
|
||||||
int i1;
|
int i1;
|
||||||
|
|
||||||
for (l = 0; l < 3; ++l) {
|
for (l = 0; l < 3; ++l) {
|
||||||
for (i1 = 0; i1 < 3; ++i1) {
|
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(new Slot(inventoryplayer, l, 8 + l * 18, 142));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.a((IInventory) this.a);
|
this.a((IInventory) this.craftInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(IInventory iinventory) {
|
public void a(IInventory iinventory) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
ItemStack craftResult = CraftingManager.a().a(this.a);
|
ItemStack craftResult = CraftingManager.getInstance().craft(this.craftInventory);
|
||||||
this.b.setItem(0, craftResult);
|
this.resultInventory.setItem(0, craftResult);
|
||||||
if (super.g.size() < 1) {
|
if (super.listeners.size() < 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityPlayer player = (EntityPlayer) super.g.get(0); // TODO: Is this _always_ correct? Seems like it.
|
EntityPlayer player = (EntityPlayer) super.listeners.get(0); // TODO: Is this _always_ correct? Seems like it.
|
||||||
player.netServerHandler.sendPacket((Packet) (new Packet103SetSlot(player.activeContainer.f, 0, craftResult)));
|
player.netServerHandler.sendPacket(new Packet103SetSlot(player.activeContainer.windowId, 0, craftResult));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +55,7 @@ public class ContainerWorkbench extends Container {
|
|||||||
super.a(entityhuman);
|
super.a(entityhuman);
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
ItemStack itemstack = this.a.getItem(i);
|
ItemStack itemstack = this.craftInventory.getItem(i);
|
||||||
|
|
||||||
if (itemstack != null) {
|
if (itemstack != null) {
|
||||||
entityhuman.b(itemstack);
|
entityhuman.b(itemstack);
|
||||||
@ -77,7 +74,7 @@ public class ContainerWorkbench extends Container {
|
|||||||
if (slot != null && slot.b()) {
|
if (slot != null && slot.b()) {
|
||||||
ItemStack itemstack1 = slot.getItem();
|
ItemStack itemstack1 = slot.getItem();
|
||||||
|
|
||||||
itemstack = itemstack1.j();
|
itemstack = itemstack1.cloneItemStack();
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
this.a(itemstack1, 10, 46, true);
|
this.a(itemstack1, 10, 46, true);
|
||||||
} else if (i >= 10 && i < 37) {
|
} else if (i >= 10 && i < 37) {
|
||||||
|
@ -10,7 +10,7 @@ public class CraftingManager {
|
|||||||
private static final CraftingManager a = new CraftingManager();
|
private static final CraftingManager a = new CraftingManager();
|
||||||
private List b = new ArrayList();
|
private List b = new ArrayList();
|
||||||
|
|
||||||
public static final CraftingManager a() {
|
public static final CraftingManager getInstance() {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,66 +22,66 @@ public class CraftingManager {
|
|||||||
(new RecipesCrafting()).a(this);
|
(new RecipesCrafting()).a(this);
|
||||||
(new RecipesArmor()).a(this);
|
(new RecipesArmor()).a(this);
|
||||||
(new RecipesDyes()).a(this);
|
(new RecipesDyes()).a(this);
|
||||||
this.a(new ItemStack(Item.PAPER, 3), new Object[] { "###", Character.valueOf('#'), Item.SUGAR_CANE});
|
this.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.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.a(new ItemStack(Item.SUGAR, 1), new Object[] { "#", Character.valueOf('#'), Item.SUGAR_CANE});
|
this.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.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.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.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.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.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.a(new ItemStack(Item.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
|
this.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.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.a(new ItemStack(Item.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.REDSTONE});
|
this.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.registerShapedRecipe(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.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.a(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
|
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));
|
Collections.sort(this.b, new RecipeSorter(this));
|
||||||
System.out.println(this.b.size() + " recipes");
|
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 = "";
|
String s = "";
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
@ -130,7 +130,7 @@ public class CraftingManager {
|
|||||||
char c0 = s.charAt(i1);
|
char c0 = s.charAt(i1);
|
||||||
|
|
||||||
if (hashmap.containsKey(Character.valueOf(c0))) {
|
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 {
|
} else {
|
||||||
aitemstack[i1] = null;
|
aitemstack[i1] = null;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ public class CraftingManager {
|
|||||||
this.b.add(new ShapedRecipes(j, k, aitemstack, itemstack));
|
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();
|
ArrayList arraylist = new ArrayList();
|
||||||
Object[] aobject1 = aobject;
|
Object[] aobject1 = aobject;
|
||||||
int i = aobject.length;
|
int i = aobject.length;
|
||||||
@ -148,7 +148,7 @@ public class CraftingManager {
|
|||||||
Object object = aobject1[j];
|
Object object = aobject1[j];
|
||||||
|
|
||||||
if (object instanceof ItemStack) {
|
if (object instanceof ItemStack) {
|
||||||
arraylist.add(((ItemStack) object).j());
|
arraylist.add(((ItemStack) object).cloneItemStack());
|
||||||
} else if (object instanceof Item) {
|
} else if (object instanceof Item) {
|
||||||
arraylist.add(new ItemStack((Item) object));
|
arraylist.add(new ItemStack((Item) object));
|
||||||
} else {
|
} else {
|
||||||
@ -163,7 +163,7 @@ public class CraftingManager {
|
|||||||
this.b.add(new ShapelessRecipes(itemstack, arraylist));
|
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) {
|
for (int i = 0; i < this.b.size(); ++i) {
|
||||||
CraftingRecipe craftingrecipe = (CraftingRecipe) this.b.get(i);
|
CraftingRecipe craftingrecipe = (CraftingRecipe) this.b.get(i);
|
||||||
|
|
||||||
|
@ -5,23 +5,18 @@ import java.util.Random;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.entity.CraftVehicle;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.entity.Vehicle;
|
import org.bukkit.entity.Vehicle;
|
||||||
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
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.craftbukkit.entity.CraftPlayer;
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -79,7 +74,7 @@ public abstract class Entity {
|
|||||||
public int noDamageTicks;
|
public int noDamageTicks;
|
||||||
public int airTicks;
|
public int airTicks;
|
||||||
private boolean justCreated;
|
private boolean justCreated;
|
||||||
protected boolean bD;
|
protected boolean fireProof;
|
||||||
protected DataWatcher datawatcher;
|
protected DataWatcher datawatcher;
|
||||||
private double d;
|
private double d;
|
||||||
private double e;
|
private double e;
|
||||||
@ -120,7 +115,7 @@ public abstract class Entity {
|
|||||||
this.noDamageTicks = 0;
|
this.noDamageTicks = 0;
|
||||||
this.airTicks = 300;
|
this.airTicks = 300;
|
||||||
this.justCreated = true;
|
this.justCreated = true;
|
||||||
this.bD = false;
|
this.fireProof = false;
|
||||||
this.datawatcher = new DataWatcher();
|
this.datawatcher = new DataWatcher();
|
||||||
this.bF = false;
|
this.bF = false;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@ -147,8 +142,7 @@ public abstract class Entity {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.getBukkitEntity() instanceof Projectile && !(this instanceof EntityFish)) {
|
if (this.getBukkitEntity() instanceof Projectile && !(this instanceof EntityFish)) {
|
||||||
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
|
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) this.getBukkitEntity());
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.dead = true;
|
this.dead = true;
|
||||||
@ -255,23 +249,17 @@ public abstract class Entity {
|
|||||||
if (this.world.isStatic) {
|
if (this.world.isStatic) {
|
||||||
this.fireTicks = 0;
|
this.fireTicks = 0;
|
||||||
} else if (this.fireTicks > 0) {
|
} else if (this.fireTicks > 0) {
|
||||||
if (this.bD) {
|
if (this.fireProof) {
|
||||||
this.fireTicks -= 4;
|
this.fireTicks -= 4;
|
||||||
if (this.fireTicks < 0) {
|
if (this.fireTicks < 0) {
|
||||||
this.fireTicks = 0;
|
this.fireTicks = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.fireTicks % 20 == 0) {
|
if (this.fireTicks % 20 == 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start - TODO: this event spams!
|
||||||
// TODO: this event spams!
|
|
||||||
if (this instanceof EntityLiving) {
|
if (this instanceof EntityLiving) {
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE_TICK, 1);
|
||||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE_TICK;
|
|
||||||
int damageDone = 1;
|
|
||||||
|
|
||||||
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.damageEntity((Entity) null, event.getDamage());
|
this.damageEntity((Entity) null, event.getDamage());
|
||||||
@ -303,17 +291,16 @@ public abstract class Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void aa() {
|
protected void aa() {
|
||||||
if (!this.bD) {
|
if (!this.fireProof) {
|
||||||
// CraftBukkit start - TODO: this event spams!
|
// CraftBukkit start - TODO: this event spams!
|
||||||
if (this instanceof EntityLiving) {
|
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.
|
// 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.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
|
||||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
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);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
@ -324,6 +311,7 @@ public abstract class Entity {
|
|||||||
// not on fire yet
|
// not on fire yet
|
||||||
EntityCombustEvent combustEvent = new EntityCombustEvent(damagee);
|
EntityCombustEvent combustEvent = new EntityCombustEvent(damagee);
|
||||||
server.getPluginManager().callEvent(combustEvent);
|
server.getPluginManager().callEvent(combustEvent);
|
||||||
|
|
||||||
if (!combustEvent.isCancelled()) {
|
if (!combustEvent.isCancelled()) {
|
||||||
this.fireTicks = 600;
|
this.fireTicks = 600;
|
||||||
}
|
}
|
||||||
@ -546,10 +534,9 @@ public abstract class Entity {
|
|||||||
int j1;
|
int j1;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if ((this.positionChanged) && (getBukkitEntity() instanceof Vehicle)) {
|
if ((this.positionChanged) && (this.getBukkitEntity() instanceof Vehicle)) {
|
||||||
Vehicle vehicle = (Vehicle) getBukkitEntity();
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
org.bukkit.World wrld = ((WorldServer) world).getWorld();
|
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));
|
||||||
org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.floor(locX), MathHelper.floor(locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(locZ));
|
|
||||||
|
|
||||||
if (d5 > d0) {
|
if (d5 > d0) {
|
||||||
block = block.getFace(BlockFace.SOUTH);
|
block = block.getFace(BlockFace.SOUTH);
|
||||||
@ -562,7 +549,7 @@ public abstract class Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
|
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -615,17 +602,13 @@ public abstract class Entity {
|
|||||||
boolean flag2 = this.ab();
|
boolean flag2 = this.ab();
|
||||||
|
|
||||||
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
|
if (this.world.d(this.boundingBox.shrink(0.0010D, 0.0010D, 0.0010D))) {
|
||||||
this.a(1);
|
this.burn(1);
|
||||||
if (!flag2) {
|
if (!flag2) {
|
||||||
++this.fireTicks;
|
++this.fireTicks;
|
||||||
// CraftBukkit start
|
// CraftBukkit start - not on fire yet
|
||||||
if (this.fireTicks <= 0) {
|
if (this.fireTicks <= 0) {
|
||||||
// not on fire yet
|
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
|
||||||
|
|
||||||
EntityCombustEvent event = new EntityCombustEvent(damagee);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.fireTicks = 300;
|
this.fireTicks = 300;
|
||||||
@ -665,17 +648,12 @@ public abstract class Entity {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void a(int i) {
|
protected void burn(int i) {
|
||||||
if (!this.bD) {
|
if (!this.fireProof) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this instanceof EntityLiving) {
|
if (this instanceof EntityLiving) {
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE, i);
|
||||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE;
|
|
||||||
int damageDone = i;
|
|
||||||
|
|
||||||
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
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;
|
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
|
// CraftBukkit start
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
this.die();
|
this.die();
|
||||||
this.world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
|
this.world = ((org.bukkit.craftbukkit.CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
|
||||||
} else {
|
return;
|
||||||
this.world = world;
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocation(double d0, double d1, double d2, float f, float f1) {
|
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("Air", (short) this.airTicks);
|
||||||
nbttagcompound.a("OnGround", this.onGround);
|
nbttagcompound.a("OnGround", this.onGround);
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
nbttagcompound.setString("World", world.worldData.name);
|
nbttagcompound.setString("World", this.world.worldData.name);
|
||||||
nbttagcompound.a("UUIDLeast", this.uniqueId.getLeastSignificantBits());
|
nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
|
||||||
nbttagcompound.a("UUIDMost", this.uniqueId.getMostSignificantBits());
|
nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.b(nbttagcompound);
|
this.b(nbttagcompound);
|
||||||
}
|
}
|
||||||
@ -961,8 +939,8 @@ public abstract class Entity {
|
|||||||
this.setPosition(this.locX, this.locY, this.locZ);
|
this.setPosition(this.locX, this.locY, this.locZ);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
long least = nbttagcompound.f("UUIDLeast");
|
long least = nbttagcompound.getLong("UUIDLeast");
|
||||||
long most = nbttagcompound.f("UUIDMost");
|
long most = nbttagcompound.getLong("UUIDMost");
|
||||||
|
|
||||||
if (least != 0L && most != 0L) {
|
if (least != 0L && most != 0L) {
|
||||||
this.uniqueId = new UUID(most, least);
|
this.uniqueId = new UUID(most, least);
|
||||||
@ -973,7 +951,7 @@ public abstract class Entity {
|
|||||||
this.a(nbttagcompound);
|
this.a(nbttagcompound);
|
||||||
|
|
||||||
// CraftBukkit start - Exempt Vehicles from notch's sanity check
|
// 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) {
|
if (Math.abs(this.motX) > 10.0D) {
|
||||||
this.motX = 0.0D;
|
this.motX = 0.0D;
|
||||||
}
|
}
|
||||||
@ -988,22 +966,25 @@ public abstract class Entity {
|
|||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
// CraftBukkit Start - reset world
|
// CraftBukkit start - reset world
|
||||||
CraftWorld world = null;
|
org.bukkit.Server server = Bukkit.getServer();
|
||||||
|
org.bukkit.World bworld = null;
|
||||||
|
|
||||||
if (this instanceof EntityPlayer) {
|
if (this instanceof EntityPlayer) {
|
||||||
EntityPlayer entityPlayer = (EntityPlayer) this;
|
EntityPlayer entityPlayer = (EntityPlayer) this;
|
||||||
String worldName = nbttagcompound.getString("World");
|
String worldName = nbttagcompound.getString("World");
|
||||||
|
|
||||||
if (worldName == "") {
|
if (worldName == "") {
|
||||||
world = ((CraftServer) Bukkit.getServer()).getServer().a(entityPlayer.dimension).getWorld();
|
bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
|
||||||
} else {
|
} else {
|
||||||
world = (CraftWorld) Bukkit.getServer().getWorld(worldName);
|
bworld = server.getWorld(worldName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
world = (CraftWorld) Bukkit.getServer().getWorld(nbttagcompound.getString("World"));
|
bworld = server.getWorld(nbttagcompound.getString("World"));
|
||||||
}
|
}
|
||||||
|
|
||||||
a(world == null ? null : world.getHandle());
|
this.spawnIn(bworld == null ? null : ((org.bukkit.craftbukkit.CraftWorld) bworld).getHandle());
|
||||||
// CraftBukkit End
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final String af() {
|
protected final String af() {
|
||||||
@ -1157,16 +1138,16 @@ public abstract class Entity {
|
|||||||
|
|
||||||
public void mount(Entity entity) {
|
public void mount(Entity entity) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
setPassengerOf(entity);
|
this.setPassengerOf(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected org.bukkit.entity.Entity bukkitEntity;
|
protected org.bukkit.entity.Entity bukkitEntity;
|
||||||
|
|
||||||
public org.bukkit.entity.Entity getBukkitEntity() {
|
public org.bukkit.entity.Entity getBukkitEntity() {
|
||||||
if (bukkitEntity == null) {
|
if (this.bukkitEntity == null) {
|
||||||
bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(((WorldServer) this.world).getServer(), this);
|
this.bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this);
|
||||||
}
|
}
|
||||||
return bukkitEntity;
|
return this.bukkitEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassengerOf(Entity entity) {
|
public void setPassengerOf(Entity entity) {
|
||||||
@ -1179,12 +1160,9 @@ public abstract class Entity {
|
|||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
if (this.vehicle != null) {
|
if (this.vehicle != null) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
|
if ((this.getBukkitEntity() instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
||||||
CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
|
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
||||||
LivingEntity living = (LivingEntity) getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
VehicleExitEvent event = new VehicleExitEvent(cvehicle, living);
|
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -1195,12 +1173,9 @@ public abstract class Entity {
|
|||||||
this.vehicle = null;
|
this.vehicle = null;
|
||||||
} else if (this.vehicle == entity) {
|
} else if (this.vehicle == entity) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
|
if ((this.getBukkitEntity() instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
||||||
CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
|
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
||||||
LivingEntity living = (LivingEntity) getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
VehicleExitEvent event = new VehicleExitEvent(cvehicle, living);
|
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -1247,24 +1222,22 @@ public abstract class Entity {
|
|||||||
byte b0 = this.datawatcher.a(0);
|
byte b0 = this.datawatcher.a(0);
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this.datawatcher.b(0, Byte.valueOf((byte) (b0 | 1 << i)));
|
this.datawatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << i)));
|
||||||
} else {
|
} 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) {
|
public void a(EntityWeatherStorm entityweatherstorm) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
int damage = 5;
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), this.getBukkitEntity(), EntityDamageEvent.DamageCause.LIGHTNING, 5);
|
||||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(entityweatherstorm.getBukkitEntity(), getBukkitEntity(), DamageCause.LIGHTNING, damage);
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
damage = event.getDamage();
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.a(damage);
|
this.burn(event.getDamage());
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
++this.fireTicks;
|
++this.fireTicks;
|
||||||
|
@ -3,12 +3,10 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -19,9 +17,9 @@ public class EntityArrow extends Entity {
|
|||||||
private int f = -1;
|
private int f = -1;
|
||||||
private int g = 0;
|
private int g = 0;
|
||||||
private int h = 0;
|
private int h = 0;
|
||||||
private boolean i = false;
|
private boolean inGround = false;
|
||||||
public boolean a = false;
|
public boolean fromPlayer = false;
|
||||||
public int b = 0;
|
public int shake = 0;
|
||||||
public EntityLiving shooter;
|
public EntityLiving shooter;
|
||||||
private int j;
|
private int j;
|
||||||
private int k = 0;
|
private int k = 0;
|
||||||
@ -41,7 +39,7 @@ public class EntityArrow extends Entity {
|
|||||||
public EntityArrow(World world, EntityLiving entityliving) {
|
public EntityArrow(World world, EntityLiving entityliving) {
|
||||||
super(world);
|
super(world);
|
||||||
this.shooter = entityliving;
|
this.shooter = entityliving;
|
||||||
this.a = entityliving instanceof EntityHuman;
|
this.fromPlayer = entityliving instanceof EntityHuman;
|
||||||
this.b(0.5F, 0.5F);
|
this.b(0.5F, 0.5F);
|
||||||
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.s(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
|
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);
|
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);
|
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))) {
|
if (axisalignedbb != null && axisalignedbb.a(Vec3D.create(this.locX, this.locY, this.locZ))) {
|
||||||
this.i = true;
|
this.inGround = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.b > 0) {
|
if (this.shake > 0) {
|
||||||
--this.b;
|
--this.shake;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.i) {
|
if (this.inGround) {
|
||||||
i = this.world.getTypeId(this.d, this.e, this.f);
|
i = this.world.getTypeId(this.d, this.e, this.f);
|
||||||
int j = this.world.getData(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();
|
this.die();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.i = false;
|
this.inGround = false;
|
||||||
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
this.motX *= (double) (this.random.nextFloat() * 0.2F);
|
||||||
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
this.motY *= (double) (this.random.nextFloat() * 0.2F);
|
||||||
this.motZ *= (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
|
// CraftBukkit start
|
||||||
boolean stick;
|
boolean stick;
|
||||||
if (entity instanceof EntityLiving) {
|
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
|
// TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
|
||||||
// or leave as DamageCause.ENTITY_ATTACK
|
// or leave as DamageCause.ENTITY_ATTACK
|
||||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||||
// TODO deal with arrows being fired from a non-entity
|
// 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);
|
server.getPluginManager().callEvent(event);
|
||||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
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.locY -= this.motY / (double) f2 * 0.05000000074505806D;
|
||||||
this.locZ -= this.motZ / (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.world.makeSound(this, "random.drr", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||||
this.i = true;
|
this.inGround = true;
|
||||||
this.b = 7;
|
this.shake = 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,9 +269,9 @@ public class EntityArrow extends Entity {
|
|||||||
nbttagcompound.a("zTile", (short) this.f);
|
nbttagcompound.a("zTile", (short) this.f);
|
||||||
nbttagcompound.a("inTile", (byte) this.g);
|
nbttagcompound.a("inTile", (byte) this.g);
|
||||||
nbttagcompound.a("inData", (byte) this.h);
|
nbttagcompound.a("inData", (byte) this.h);
|
||||||
nbttagcompound.a("shake", (byte) this.b);
|
nbttagcompound.a("shake", (byte) this.shake);
|
||||||
nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0));
|
nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0));
|
||||||
nbttagcompound.a("player", this.a);
|
nbttagcompound.a("player", this.fromPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(NBTTagCompound nbttagcompound) {
|
public void a(NBTTagCompound nbttagcompound) {
|
||||||
@ -284,16 +280,16 @@ public class EntityArrow extends Entity {
|
|||||||
this.f = nbttagcompound.d("zTile");
|
this.f = nbttagcompound.d("zTile");
|
||||||
this.g = nbttagcompound.c("inTile") & 255;
|
this.g = nbttagcompound.c("inTile") & 255;
|
||||||
this.h = nbttagcompound.c("inData") & 255;
|
this.h = nbttagcompound.c("inData") & 255;
|
||||||
this.b = nbttagcompound.c("shake") & 255;
|
this.shake = nbttagcompound.c("shake") & 255;
|
||||||
this.i = nbttagcompound.c("inGround") == 1;
|
this.inGround = nbttagcompound.c("inGround") == 1;
|
||||||
this.a = nbttagcompound.m("player");
|
this.fromPlayer = nbttagcompound.m("player");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void b(EntityHuman entityhuman) {
|
public void b(EntityHuman entityhuman) {
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
ItemStack itemstack = new ItemStack(Item.ARROW, 1);
|
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);
|
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));
|
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;
|
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);
|
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||||
entityhuman.receive(this, 1);
|
entityhuman.receive(this, 1);
|
||||||
this.die();
|
this.die();
|
||||||
|
@ -4,8 +4,6 @@ import java.util.List;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.entity.Vehicle;
|
import org.bukkit.entity.Vehicle;
|
||||||
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||||
@ -33,12 +31,10 @@ public class EntityBoat extends Entity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collide(Entity entity) {
|
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();
|
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
|
||||||
|
|
||||||
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent(vehicle, hitEntity);
|
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), hitEntity);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -86,12 +82,7 @@ public class EntityBoat extends Entity {
|
|||||||
this.lastY = d1;
|
this.lastY = d1;
|
||||||
this.lastZ = d2;
|
this.lastZ = d2;
|
||||||
|
|
||||||
// CraftBukkit start
|
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
|
||||||
VehicleCreateEvent event = new VehicleCreateEvent(vehicle);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double m() {
|
public double m() {
|
||||||
@ -103,14 +94,14 @@ public class EntityBoat extends Entity {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity attacker = (entity == null) ? null : entity.getBukkitEntity();
|
org.bukkit.entity.Entity attacker = (entity == null) ? null : entity.getBukkitEntity();
|
||||||
int damage = i;
|
|
||||||
|
|
||||||
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, damage);
|
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, i);
|
||||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// i = event.getDamage(); // TODO Why don't we do this?
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.c = -this.c;
|
this.c = -this.c;
|
||||||
@ -121,7 +112,7 @@ public class EntityBoat extends Entity {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
|
||||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(destroyEvent);
|
this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||||
|
|
||||||
if (destroyEvent.isCancelled()) {
|
if (destroyEvent.isCancelled()) {
|
||||||
this.damage = 40; // Maximize damage so this doesn't get triggered again right away
|
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);
|
this.c(this.yaw, this.pitch);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
org.bukkit.Server server = this.world.getServer();
|
||||||
CraftWorld world = ((WorldServer) this.world).getWorld();
|
org.bukkit.World bworld = 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);
|
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();
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
|
|
||||||
server.getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
|
server.getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
|
||||||
@ -408,12 +400,8 @@ public class EntityBoat extends Entity {
|
|||||||
} else {
|
} else {
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) this.getBukkitEntity(), entityhuman.getBukkitEntity());
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
org.bukkit.entity.Entity player = entityhuman.getBukkitEntity();
|
|
||||||
|
|
||||||
VehicleEnterEvent event = new VehicleEnterEvent(vehicle, player);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.TrigMath;
|
import org.bukkit.craftbukkit.TrigMath;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityCreature extends EntityLiving {
|
public class EntityCreature extends EntityLiving {
|
||||||
@ -30,9 +28,8 @@ public class EntityCreature extends EntityLiving {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Entity target = this.findTarget();
|
Entity target = this.findTarget();
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER);
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (event.getTarget() == null) {
|
if (event.getTarget() == null) {
|
||||||
@ -49,9 +46,8 @@ public class EntityCreature extends EntityLiving {
|
|||||||
}
|
}
|
||||||
} else if (!this.target.S()) {
|
} else if (!this.target.S()) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (event.getTarget() == null) {
|
if (event.getTarget() == null) {
|
||||||
@ -202,7 +198,7 @@ public class EntityCreature extends EntityLiving {
|
|||||||
return this.pathEntity != null;
|
return this.pathEntity != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(PathEntity pathentity) {
|
public void setPathEntity(PathEntity pathentity) {
|
||||||
this.pathEntity = pathentity;
|
this.pathEntity = pathentity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +206,7 @@ public class EntityCreature extends EntityLiving {
|
|||||||
return this.target;
|
return this.target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void c(Entity entity) {
|
public void setTarget(Entity entity) {
|
||||||
this.target = entity;
|
this.target = entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
import org.bukkit.event.entity.CreeperPowerEvent;
|
import org.bukkit.event.entity.CreeperPowerEvent;
|
||||||
@ -32,7 +31,7 @@ public class EntityCreeper extends EntityMonster {
|
|||||||
|
|
||||||
public void a(NBTTagCompound nbttagcompound) {
|
public void a(NBTTagCompound nbttagcompound) {
|
||||||
super.a(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) {
|
protected void b(Entity entity, float f) {
|
||||||
@ -84,8 +83,8 @@ public class EntityCreeper extends EntityMonster {
|
|||||||
return "mob.creeperdeath";
|
return "mob.creeperdeath";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Entity entity) {
|
public void die(Entity entity) {
|
||||||
super.a(entity);
|
super.die(entity);
|
||||||
if (entity instanceof EntitySkeleton) {
|
if (entity instanceof EntitySkeleton) {
|
||||||
this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
|
this.b(Item.GOLD_RECORD.id + this.random.nextInt(2), 1);
|
||||||
}
|
}
|
||||||
@ -110,11 +109,10 @@ public class EntityCreeper extends EntityMonster {
|
|||||||
++this.fuseTicks;
|
++this.fuseTicks;
|
||||||
if (this.fuseTicks >= 30) {
|
if (this.fuseTicks >= 30) {
|
||||||
// CraftBukkit start
|
// 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(this.world.getServer(), this), radius, false);
|
||||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(server, this), radius, false);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
|
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;
|
return this.datawatcher.a(17) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,24 +141,28 @@ public class EntityCreeper extends EntityMonster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void e(int i) {
|
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) {
|
public void a(EntityWeatherStorm entityweatherstorm) {
|
||||||
super.a(entityweatherstorm);
|
super.a(entityweatherstorm);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
CreeperPowerEvent event = new CreeperPowerEvent(this.getBukkitEntity(), entityweatherstorm.getBukkitEntity(), CreeperPowerEvent.PowerCause.LIGHTNING);
|
||||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
CreeperPowerEvent event = new CreeperPowerEvent(entity, entityweatherstorm.getBukkitEntity(), CreeperPowerEvent.PowerCause.LIGHTNING);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
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
|
// CraftBukkit start
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.entity.CreatureType;
|
||||||
import org.bukkit.entity.Egg;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Projectile;
|
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.EntityDamageByProjectileEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
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;
|
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -23,7 +19,7 @@ public class EntityEgg extends Entity {
|
|||||||
private int e = 0;
|
private int e = 0;
|
||||||
private boolean f = false;
|
private boolean f = false;
|
||||||
public int a = 0;
|
public int a = 0;
|
||||||
public EntityLiving thrower; // CraftBukkit private -> public
|
public EntityLiving thrower; // CraftBukkit - private -> public
|
||||||
private int h;
|
private int h;
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
|
|
||||||
@ -157,15 +153,12 @@ public class EntityEgg extends Entity {
|
|||||||
if (movingobjectposition.entity != null) {
|
if (movingobjectposition.entity != null) {
|
||||||
boolean stick;
|
boolean stick;
|
||||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||||
CraftServer server = this.world.getServer();
|
|
||||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
|
||||||
int damage = 0;
|
|
||||||
|
|
||||||
// TODO @see EntityArrow#162
|
// TODO @see EntityArrow#162
|
||||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
stick = !event.getBounce();
|
stick = !event.getBounce();
|
||||||
@ -191,11 +184,10 @@ public class EntityEgg extends Entity {
|
|||||||
CreatureType hatchingType = CreatureType.CHICKEN;
|
CreatureType hatchingType = CreatureType.CHICKEN;
|
||||||
|
|
||||||
if (this.thrower instanceof EntityPlayer) {
|
if (this.thrower instanceof EntityPlayer) {
|
||||||
CraftServer server = this.world.getServer();
|
org.bukkit.entity.Player player = (this.thrower == null) ? null : (org.bukkit.entity.Player) this.thrower.getBukkitEntity();
|
||||||
Player player = (this.thrower == null) ? null : (Player) this.thrower.getBukkitEntity();
|
|
||||||
|
|
||||||
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
|
PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
hatching = event.isHatching();
|
hatching = event.isHatching();
|
||||||
numHatching = event.getNumHatches();
|
numHatching = event.getNumHatches();
|
||||||
@ -337,7 +329,7 @@ public class EntityEgg extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void b(EntityHuman entityhuman) {
|
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);
|
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||||
entityhuman.receive(this, 1);
|
entityhuman.receive(this, 1);
|
||||||
this.die();
|
this.die();
|
||||||
|
@ -3,14 +3,12 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Explosive;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||||
|
import org.bukkit.entity.Explosive;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -48,7 +46,7 @@ public class EntityFireball extends Entity {
|
|||||||
this.height = 0.0F;
|
this.height = 0.0F;
|
||||||
this.motX = this.motY = this.motZ = 0.0D;
|
this.motX = this.motY = this.motZ = 0.0D;
|
||||||
// CraftBukkit start (added setDirection method)
|
// CraftBukkit start (added setDirection method)
|
||||||
setDirection(d0, d1, d2);
|
this.setDirection(d0, d1, d2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDirection(double d0, double d1, double d2) {
|
public void setDirection(double d0, double d1, double d2) {
|
||||||
@ -134,15 +132,12 @@ public class EntityFireball extends Entity {
|
|||||||
if (movingobjectposition.entity != null) {
|
if (movingobjectposition.entity != null) {
|
||||||
boolean stick;
|
boolean stick;
|
||||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||||
CraftServer server = this.world.getServer();
|
|
||||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
|
||||||
int damage = 0;
|
|
||||||
|
|
||||||
// TODO @see EntityArrow#162
|
// TODO @see EntityArrow#162
|
||||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
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()) {
|
if (!event.isCancelled()) {
|
||||||
// give 'this' instead of (Entity) null so we know what causes the damage
|
// 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());
|
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;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityFish extends Entity {
|
public class EntityFish extends Entity {
|
||||||
@ -194,15 +192,12 @@ public class EntityFish extends Entity {
|
|||||||
// TODO add EntityDamagedByProjectileEvent : fishing hook?
|
// TODO add EntityDamagedByProjectileEvent : fishing hook?
|
||||||
boolean stick;
|
boolean stick;
|
||||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||||
CraftServer server = this.world.getServer();
|
|
||||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
|
||||||
int damage = 0;
|
|
||||||
|
|
||||||
// TODO @see EntityArrow#162
|
// TODO @see EntityArrow#162
|
||||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
stick = !event.getBounce();
|
stick = !event.getBounce();
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
//CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityGhast extends EntityFlying implements IMonster {
|
public class EntityGhast extends EntityFlying implements IMonster {
|
||||||
@ -13,7 +11,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
|||||||
public double b;
|
public double b;
|
||||||
public double c;
|
public double c;
|
||||||
public double d;
|
public double d;
|
||||||
private Entity g = null;
|
private Entity target = null;
|
||||||
private int h = 0;
|
private int h = 0;
|
||||||
public int e = 0;
|
public int e = 0;
|
||||||
public int f = 0;
|
public int f = 0;
|
||||||
@ -22,7 +20,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
|||||||
super(world);
|
super(world);
|
||||||
this.texture = "/mob/ghast.png";
|
this.texture = "/mob/ghast.png";
|
||||||
this.b(4.0F, 4.0F);
|
this.b(4.0F, 4.0F);
|
||||||
this.bD = true;
|
this.fireProof = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void b() {
|
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
|
// CraftBukkit start
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
|
||||||
CraftServer server = this.world.getServer();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (event.getTarget() == null) {
|
if (event.getTarget() == null) {
|
||||||
this.g = null;
|
this.target = null;
|
||||||
} else {
|
} else {
|
||||||
this.g = ((CraftEntity) event.getTarget()).getHandle();
|
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.g == null || this.h-- <= 0) {
|
if (this.target == null || this.h-- <= 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Entity target = this.world.a(this, 100.0D);
|
Entity target = this.world.findNearbyPlayer(this, 100.0D);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER);
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
|
||||||
CraftServer server = this.world.getServer();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (event.getTarget() == null) {
|
if (event.getTarget() == null) {
|
||||||
this.g = null;
|
this.target = null;
|
||||||
} else {
|
} else {
|
||||||
this.g = ((CraftEntity) event.getTarget()).getHandle();
|
this.target = ((CraftEntity) event.getTarget()).getHandle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
if (this.g != null) {
|
if (this.target != null) {
|
||||||
this.h = 20;
|
this.h = 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double d4 = 64.0D;
|
double d4 = 64.0D;
|
||||||
|
|
||||||
if (this.g != null && this.g.g(this) < d4 * d4) {
|
if (this.target != null && this.target.g(this) < d4 * d4) {
|
||||||
double d5 = this.g.locX - this.locX;
|
double d5 = this.target.locX - this.locX;
|
||||||
double d6 = this.g.boundingBox.b + (double) (this.g.width / 2.0F) - (this.locY + (double) (this.width / 2.0F));
|
double d6 = this.target.boundingBox.b + (double) (this.target.width / 2.0F) - (this.locY + (double) (this.width / 2.0F));
|
||||||
double d7 = this.g.locZ - this.locZ;
|
double d7 = this.target.locZ - this.locZ;
|
||||||
|
|
||||||
this.K = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
|
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) {
|
if (this.f == 10) {
|
||||||
this.world.makeSound(this, "mob.ghast.charge", this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
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);
|
byte b1 = (byte) (this.f > 10 ? 1 : 0);
|
||||||
|
|
||||||
if (b0 != b1) {
|
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;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftItem;
|
import org.bukkit.craftbukkit.entity.CraftItem;
|
||||||
import org.bukkit.craftbukkit.TrigMath;
|
import org.bukkit.craftbukkit.TrigMath;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
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.PlayerBedEnterEvent;
|
||||||
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
@ -221,8 +218,8 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
entity.b(this);
|
entity.b(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Entity entity) {
|
public void die(Entity entity) {
|
||||||
super.a(entity);
|
super.die(entity);
|
||||||
this.b(0.2F, 0.2F);
|
this.b(0.2F, 0.2F);
|
||||||
this.setPosition(this.locX, this.locY, this.locZ);
|
this.setPosition(this.locX, this.locY, this.locZ);
|
||||||
this.motY = 0.10000000149011612D;
|
this.motY = 0.10000000149011612D;
|
||||||
@ -252,7 +249,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void E() {
|
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) {
|
public void b(ItemStack itemstack) {
|
||||||
@ -289,11 +286,10 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Player player = (Player) this.getBukkitEntity();
|
Player player = (Player) this.getBukkitEntity();
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
CraftItem drop = new CraftItem(this.world.getServer(), entityitem);
|
||||||
CraftItem drop = new CraftItem(server, entityitem);
|
|
||||||
|
|
||||||
PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop);
|
PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
org.bukkit.inventory.ItemStack stack = drop.getItemStack();
|
org.bukkit.inventory.ItemStack stack = drop.getItemStack();
|
||||||
@ -344,13 +340,12 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
this.a(true, true, false);
|
this.a(true, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - Start
|
// CraftBukkit start
|
||||||
this.spawnWorld = nbttagcompound.getString("SpawnWorld");
|
this.spawnWorld = nbttagcompound.getString("SpawnWorld");
|
||||||
if (this.spawnWorld == "") {
|
if (this.spawnWorld == "") {
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
this.spawnWorld = this.world.getServer().getWorlds().get(0).getName();
|
||||||
this.spawnWorld = server.getWorlds().get(0).getName();
|
|
||||||
}
|
}
|
||||||
// CraftBukkit - End
|
// CraftBukkit end
|
||||||
|
|
||||||
if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) {
|
if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) {
|
||||||
this.b = new ChunkCoordinates(nbttagcompound.e("SpawnX"), nbttagcompound.e("SpawnY"), nbttagcompound.e("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) {
|
if (object instanceof EntityLiving) {
|
||||||
// CraftBukkit start - this is here instead of EntityMonster because EntityLiving(s) that aren't monsters
|
// 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.
|
// 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 damager = ((Entity) object).getBukkitEntity();
|
||||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||||
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
|
||||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, i);
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, i);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled() || event.getDamage() == 0) {
|
if (event.isCancelled() || event.getDamage() == 0) {
|
||||||
return false;
|
return false;
|
||||||
@ -452,7 +446,7 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
if (entityliving instanceof EntityWolf) {
|
if (entityliving instanceof EntityWolf) {
|
||||||
EntityWolf entitywolf = (EntityWolf) entityliving;
|
EntityWolf entitywolf = (EntityWolf) entityliving;
|
||||||
|
|
||||||
if (entitywolf.A() && this.name.equals(entitywolf.x())) {
|
if (entitywolf.isTamed() && this.name.equals(entitywolf.getOwnerName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -465,26 +459,25 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
Entity entity = (Entity) iterator.next();
|
Entity entity = (Entity) iterator.next();
|
||||||
EntityWolf entitywolf1 = (EntityWolf) entity;
|
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
|
// CraftBukkit start
|
||||||
CraftServer server = this.world.getServer();
|
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entityliving.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity bukkitTarget = null;
|
|
||||||
if (entity != null) {
|
|
||||||
bukkitTarget = entityliving.getBukkitEntity();
|
|
||||||
}
|
|
||||||
EntityTargetEvent event;
|
EntityTargetEvent event;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
event = new EntityTargetEvent(entitywolf1.getBukkitEntity(), bukkitTarget, TargetReason.OWNER_ATTACKED_TARGET);
|
event = new EntityTargetEvent(entitywolf1.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET);
|
||||||
} else {
|
} 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()) {
|
if (event.isCancelled()) {
|
||||||
entitywolf1.setSitting(false);
|
continue;
|
||||||
entitywolf1.c(entityliving);
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// 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
|
// 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)) {
|
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman)) {
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
|
||||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.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);
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, i);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled() || event.getDamage() == 0) {
|
if (event.isCancelled() || event.getDamage() == 0) {
|
||||||
return;
|
return;
|
||||||
@ -628,11 +619,10 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.getBukkitEntity() instanceof Player) {
|
if (this.getBukkitEntity() instanceof Player) {
|
||||||
Player player = (Player) this.getBukkitEntity();
|
Player player = (Player) this.getBukkitEntity();
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
org.bukkit.block.Block bed = this.world.getWorld().getBlockAt(i, j, k);
|
||||||
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
|
||||||
|
|
||||||
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
|
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return EnumBedError.OTHER_PROBLEM;
|
return EnumBedError.OTHER_PROBLEM;
|
||||||
@ -727,17 +717,16 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.getBukkitEntity() instanceof Player) {
|
if (this.getBukkitEntity() instanceof Player) {
|
||||||
Player player = (Player) this.getBukkitEntity();
|
Player player = (Player) this.getBukkitEntity();
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
|
|
||||||
org.bukkit.block.Block bed;
|
org.bukkit.block.Block bed;
|
||||||
if (chunkcoordinates != null) {
|
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 {
|
} else {
|
||||||
bed = ((WorldServer) world).getWorld().getBlockAt(player.getLocation());
|
bed = this.world.getWorld().getBlockAt(player.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed);
|
PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -782,14 +771,14 @@ public abstract class EntityHuman extends EntityLiving {
|
|||||||
|
|
||||||
public void a(String s) {}
|
public void a(String s) {}
|
||||||
|
|
||||||
public ChunkCoordinates M() {
|
public ChunkCoordinates getBed() {
|
||||||
return this.b;
|
return this.b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(ChunkCoordinates chunkcoordinates) {
|
public void a(ChunkCoordinates chunkcoordinates) {
|
||||||
if (chunkcoordinates != null) {
|
if (chunkcoordinates != null) {
|
||||||
this.b = new ChunkCoordinates(chunkcoordinates);
|
this.b = new ChunkCoordinates(chunkcoordinates);
|
||||||
this.spawnWorld = world.worldData.name; // CraftBukkit
|
this.spawnWorld = this.world.worldData.name; // CraftBukkit
|
||||||
} else {
|
} else {
|
||||||
this.b = null;
|
this.b = null;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class EntityItem extends Entity {
|
public class EntityItem extends Entity {
|
||||||
|
|
||||||
@ -94,7 +91,7 @@ public class EntityItem extends Entity {
|
|||||||
return this.world.a(this.boundingBox, Material.WATER, this);
|
return this.world.a(this.boundingBox, Material.WATER, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void a(int i) {
|
protected void burn(int i) {
|
||||||
this.damageEntity((Entity) null, i);
|
this.damageEntity((Entity) null, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +124,7 @@ public class EntityItem extends Entity {
|
|||||||
int i = this.itemStack.count;
|
int i = this.itemStack.count;
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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());
|
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity());
|
||||||
this.world.getServer().getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
@ -140,7 +137,7 @@ public class EntityItem extends Entity {
|
|||||||
}
|
}
|
||||||
// CraftBukkit end
|
// 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) {
|
if (this.itemStack.id == Block.LOG.id) {
|
||||||
entityhuman.a((Statistic) AchievementList.g);
|
entityhuman.a((Statistic) AchievementList.g);
|
||||||
}
|
}
|
||||||
|
@ -3,15 +3,10 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.TrigMath;
|
import org.bukkit.craftbukkit.TrigMath;
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -122,13 +117,8 @@ public abstract class EntityLiving extends Entity {
|
|||||||
|
|
||||||
if (this.S() && this.J()) {
|
if (this.S() && this.J()) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.SUFFOCATION, 1);
|
||||||
org.bukkit.entity.Entity victim = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
DamageCause damageType = EntityDamageEvent.DamageCause.SUFFOCATION;
|
|
||||||
int damage = 1;
|
|
||||||
|
|
||||||
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, damage);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.damageEntity((Entity) null, event.getDamage());
|
this.damageEntity((Entity) null, event.getDamage());
|
||||||
@ -136,7 +126,7 @@ public abstract class EntityLiving extends Entity {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.bD || this.world.isStatic) {
|
if (this.fireProof || this.world.isStatic) {
|
||||||
this.fireTicks = 0;
|
this.fireTicks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,15 +146,10 @@ public abstract class EntityLiving extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.DROWNING, 2);
|
||||||
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
DamageCause damageType = EntityDamageEvent.DamageCause.DROWNING;
|
|
||||||
int damageDone = 2;
|
|
||||||
|
|
||||||
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
|
if (!event.isCancelled() && event.getDamage() != 0) {
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
|
||||||
this.damageEntity((Entity) null, event.getDamage());
|
this.damageEntity((Entity) null, event.getDamage());
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -331,10 +316,8 @@ public abstract class EntityLiving extends Entity {
|
|||||||
public void b(int i) {
|
public void b(int i) {
|
||||||
// CraftBukkit start - Added event
|
// CraftBukkit start - Added event
|
||||||
if (this.health > 0) {
|
if (this.health > 0) {
|
||||||
CraftServer server = this.world.getServer();
|
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), i);
|
||||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
EntityRegainHealthEvent event = new EntityRegainHealthEvent(entity, i);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.health += event.getAmount();
|
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.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) {
|
} else if (flag) {
|
||||||
this.world.makeSound(this, this.h(), this.k(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
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) {
|
if (this.W >= 0 && entity != null) {
|
||||||
entity.c(this, this.W);
|
entity.c(this, this.W);
|
||||||
}
|
}
|
||||||
@ -466,21 +449,20 @@ public abstract class EntityLiving extends Entity {
|
|||||||
int i = this.j();
|
int i = this.j();
|
||||||
|
|
||||||
// CraftBukkit start - whole method
|
// CraftBukkit start - whole method
|
||||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||||
int count = random.nextInt(3);
|
int count = this.random.nextInt(3);
|
||||||
|
|
||||||
if ((i > 0) && (count > 0)) {
|
if ((i > 0) && (count > 0)) {
|
||||||
loot.add(new org.bukkit.inventory.ItemStack(i, count));
|
loot.add(new org.bukkit.inventory.ItemStack(i, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftEntity entity = (CraftEntity) getBukkitEntity();
|
CraftEntity entity = (CraftEntity) this.getBukkitEntity();
|
||||||
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
org.bukkit.World bworld = this.world.getWorld();
|
||||||
Server server = ((WorldServer) world).getServer();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
||||||
cworld.dropItemNaturally(entity.getLocation(), stack);
|
bworld.dropItemNaturally(entity.getLocation(), stack);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
@ -495,12 +477,8 @@ public abstract class EntityLiving extends Entity {
|
|||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FALL, i);
|
||||||
org.bukkit.entity.Entity victim = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
DamageCause damageType = EntityDamageEvent.DamageCause.FALL;
|
|
||||||
|
|
||||||
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, i);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled() && event.getDamage() != 0) {
|
if (!event.isCancelled() && event.getDamage() != 0) {
|
||||||
this.damageEntity((Entity) null, event.getDamage());
|
this.damageEntity((Entity) null, event.getDamage());
|
||||||
@ -745,7 +723,7 @@ public abstract class EntityLiving extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void T() {
|
protected void T() {
|
||||||
EntityHuman entityhuman = this.world.a(this, -1.0D);
|
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
||||||
|
|
||||||
if (this.l_() && entityhuman != null) {
|
if (this.l_() && entityhuman != null) {
|
||||||
double d0 = entityhuman.locX - this.locX;
|
double d0 = entityhuman.locX - this.locX;
|
||||||
@ -769,7 +747,7 @@ public abstract class EntityLiving extends Entity {
|
|||||||
|
|
||||||
protected void c_() {
|
protected void c_() {
|
||||||
++this.ay;
|
++this.ay;
|
||||||
EntityHuman entityhuman = this.world.a(this, -1.0D);
|
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
||||||
|
|
||||||
this.T();
|
this.T();
|
||||||
this.az = 0.0F;
|
this.az = 0.0F;
|
||||||
@ -777,7 +755,7 @@ public abstract class EntityLiving extends Entity {
|
|||||||
float f = 8.0F;
|
float f = 8.0F;
|
||||||
|
|
||||||
if (this.random.nextFloat() < 0.02F) {
|
if (this.random.nextFloat() < 0.02F) {
|
||||||
entityhuman = this.world.a(this, (double) f);
|
entityhuman = this.world.findNearbyPlayer(this, (double) f);
|
||||||
if (entityhuman != null) {
|
if (entityhuman != null) {
|
||||||
this.b = entityhuman;
|
this.b = entityhuman;
|
||||||
this.aF = 10 + this.random.nextInt(20);
|
this.aF = 10 + this.random.nextInt(20);
|
||||||
@ -871,20 +849,14 @@ public abstract class EntityLiving extends Entity {
|
|||||||
|
|
||||||
protected void X() {
|
protected void X() {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.VOID, 4);
|
||||||
DamageCause damageType = EntityDamageEvent.DamageCause.VOID;
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
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);
|
|
||||||
|
|
||||||
if (event.isCancelled() || event.getDamage() == 0) {
|
if (event.isCancelled() || event.getDamage() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
damageDone = event.getDamage();
|
this.damageEntity((Entity) null, event.getDamage());
|
||||||
this.damageEntity((Entity) null, damageDone);
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,14 @@ import java.util.List;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.entity.Vehicle;
|
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
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityMinecart extends Entity implements IInventory {
|
public class EntityMinecart extends Entity implements IInventory {
|
||||||
@ -85,13 +89,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
this.lastZ = d2;
|
this.lastZ = d2;
|
||||||
this.type = i;
|
this.type = i;
|
||||||
|
|
||||||
// CraftBukkit start
|
this.world.getServer().getPluginManager().callEvent(new VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
|
||||||
|
|
||||||
VehicleCreateEvent event = new VehicleCreateEvent(vehicle);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double m() {
|
public double m() {
|
||||||
@ -103,10 +101,9 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity passenger = (entity == null) ? null : entity.getBukkitEntity();
|
org.bukkit.entity.Entity passenger = (entity == null) ? null : entity.getBukkitEntity();
|
||||||
int damage = i;
|
|
||||||
|
|
||||||
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, damage);
|
VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
|
||||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
@ -126,7 +123,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
|
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
|
||||||
((WorldServer) this.world).getServer().getPluginManager().callEvent(destroyEvent);
|
this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||||
|
|
||||||
if (destroyEvent.isCancelled()) {
|
if (destroyEvent.isCancelled()) {
|
||||||
this.damage = 40; // Maximize damage so this doesn't get triggered again right away
|
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
|
// CraftBukkit
|
||||||
if (this.passenger != null || !slowWhenEmpty) {
|
if (this.passenger != null || !this.slowWhenEmpty) {
|
||||||
this.motX *= 0.996999979019165D;
|
this.motX *= 0.996999979019165D;
|
||||||
this.motY *= 0.0D;
|
this.motY *= 0.0D;
|
||||||
this.motZ *= 0.996999979019165D;
|
this.motZ *= 0.996999979019165D;
|
||||||
@ -520,9 +517,9 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
this.move(this.motX, this.motY, this.motZ);
|
this.move(this.motX, this.motY, this.motZ);
|
||||||
if (!this.onGround) {
|
if (!this.onGround) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
this.motX *= flyingX;
|
this.motX *= this.flyingX;
|
||||||
this.motY *= flyingY;
|
this.motY *= this.flyingY;
|
||||||
this.motZ *= flyingZ;
|
this.motZ *= this.flyingZ;
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,17 +553,15 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
this.c(this.yaw, this.pitch);
|
this.c(this.yaw, this.pitch);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
org.bukkit.World bworld = this.world.getWorld();
|
||||||
CraftWorld world = ((WorldServer) this.world).getWorld();
|
Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||||
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
|
Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||||
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
|
|
||||||
server.getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
|
this.world.getServer().getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));
|
||||||
|
|
||||||
if (!from.equals(to)) {
|
if (!from.equals(to)) {
|
||||||
VehicleMoveEvent event = new VehicleMoveEvent(vehicle, from, to);
|
this.world.getServer().getPluginManager().callEvent(new VehicleMoveEvent(vehicle, from, to));
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -713,12 +708,11 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
if (entity != this.passenger) {
|
if (entity != this.passenger) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) world).getServer();
|
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
|
org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
|
||||||
|
|
||||||
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, hitEntity);
|
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, hitEntity);
|
||||||
server.getPluginManager().callEvent(collisionEvent);
|
this.world.getServer().getPluginManager().callEvent(collisionEvent);
|
||||||
|
|
||||||
if (collisionEvent.isCancelled()) {
|
if (collisionEvent.isCancelled()) {
|
||||||
return;
|
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 (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()) {
|
if (!collisionEvent.isPickupCancelled()) {
|
||||||
|
|
||||||
VehicleEnterEvent enterEvent = new VehicleEnterEvent(vehicle, hitEntity);
|
VehicleEnterEvent enterEvent = new VehicleEnterEvent(vehicle, hitEntity);
|
||||||
server.getPluginManager().callEvent(enterEvent);
|
this.world.getServer().getPluginManager().callEvent(enterEvent);
|
||||||
|
|
||||||
if (!enterEvent.isCancelled()) {
|
if (!enterEvent.isCancelled()) {
|
||||||
entity.mount(this);
|
entity.mount(this);
|
||||||
@ -812,7 +805,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
return this.items[i];
|
return this.items[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i, int j) {
|
public ItemStack splitStack(int i, int j) {
|
||||||
if (this.items[i] != null) {
|
if (this.items[i] != null) {
|
||||||
ItemStack itemstack;
|
ItemStack itemstack;
|
||||||
|
|
||||||
@ -858,12 +851,10 @@ public class EntityMinecart extends Entity implements IInventory {
|
|||||||
|
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
|
||||||
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
|
||||||
org.bukkit.entity.Entity player = (entityhuman == null) ? null : entityhuman.getBukkitEntity();
|
org.bukkit.entity.Entity player = (entityhuman == null) ? null : entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
VehicleEnterEvent event = new VehicleEnterEvent(vehicle, player);
|
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) this.getBukkitEntity(), player);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
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;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityMonster extends EntityCreature implements IMonster {
|
public class EntityMonster extends EntityCreature implements IMonster {
|
||||||
@ -38,7 +34,7 @@ public class EntityMonster extends EntityCreature implements IMonster {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Entity findTarget() {
|
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;
|
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 (this.passenger != entity && this.vehicle != entity) {
|
||||||
if (entity != this) {
|
if (entity != this) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity bukkitTarget = null;
|
|
||||||
if (entity != null) {
|
|
||||||
bukkitTarget = entity.getBukkitEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (event.getTarget() == null) {
|
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.
|
// 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.
|
// This does not fire events for slime attacks, av they're not lastDamage EntityMonster.
|
||||||
if (entity instanceof EntityLiving && !(entity instanceof EntityHuman)) {
|
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();
|
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);
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, this.damage);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
entity.damageEntity(this, event.getDamage());
|
entity.damageEntity(this, event.getDamage());
|
||||||
|
@ -4,10 +4,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
||||||
import org.bukkit.event.painting.PaintingBreakByWorldEvent;
|
import org.bukkit.event.painting.PaintingBreakByWorldEvent;
|
||||||
import org.bukkit.entity.Painting;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityPainting extends Entity {
|
public class EntityPainting extends Entity {
|
||||||
@ -124,9 +122,8 @@ public class EntityPainting extends Entity {
|
|||||||
this.f = 0;
|
this.f = 0;
|
||||||
if (!this.h()) {
|
if (!this.h()) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Painting painting = (Painting) getBukkitEntity();
|
PaintingBreakByWorldEvent event = new PaintingBreakByWorldEvent((org.bukkit.entity.Painting) this.getBukkitEntity());
|
||||||
PaintingBreakByWorldEvent event = new PaintingBreakByWorldEvent(painting);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -204,9 +201,8 @@ public class EntityPainting extends Entity {
|
|||||||
public boolean damageEntity(Entity entity, int i) {
|
public boolean damageEntity(Entity entity, int i) {
|
||||||
if (!this.dead && !this.world.isStatic) {
|
if (!this.dead && !this.world.isStatic) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Painting painting = (Painting) getBukkitEntity();
|
PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent((org.bukkit.entity.Painting) this.getBukkitEntity(), entity == null ? null : entity.getBukkitEntity());
|
||||||
PaintingBreakByEntityEvent event = new PaintingBreakByEntityEvent(painting, entity == null ? null : entity.getBukkitEntity());
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.event.entity.PigZapEvent;
|
import org.bukkit.event.entity.PigZapEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -20,12 +19,12 @@ public class EntityPig extends EntityAnimal {
|
|||||||
|
|
||||||
public void b(NBTTagCompound nbttagcompound) {
|
public void b(NBTTagCompound nbttagcompound) {
|
||||||
super.b(nbttagcompound);
|
super.b(nbttagcompound);
|
||||||
nbttagcompound.a("Saddle", this.x());
|
nbttagcompound.a("Saddle", this.hasSaddle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(NBTTagCompound nbttagcompound) {
|
public void a(NBTTagCompound nbttagcompound) {
|
||||||
super.a(nbttagcompound);
|
super.a(nbttagcompound);
|
||||||
this.a(nbttagcompound.m("Saddle"));
|
this.setSaddle(nbttagcompound.m("Saddle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String g() {
|
protected String g() {
|
||||||
@ -41,7 +40,7 @@ public class EntityPig extends EntityAnimal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(EntityHuman entityhuman) {
|
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);
|
entityhuman.mount(this);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -53,15 +52,15 @@ public class EntityPig extends EntityAnimal {
|
|||||||
return this.fireTicks > 0 ? Item.GRILLED_PORK.id : Item.PORK.id;
|
return this.fireTicks > 0 ? Item.GRILLED_PORK.id : Item.PORK.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean x() {
|
public boolean hasSaddle() {
|
||||||
return (this.datawatcher.a(16) & 1) != 0;
|
return (this.datawatcher.a(16) & 1) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(boolean flag) {
|
public void setSaddle(boolean flag) {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this.datawatcher.b(16, Byte.valueOf((byte) 1));
|
this.datawatcher.watch(16, Byte.valueOf((byte) 1));
|
||||||
} else {
|
} 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);
|
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
PigZapEvent event = new PigZapEvent(this.getBukkitEntity(), entityweatherstorm.getBukkitEntity(), entitypigzombie.getBukkitEntity());
|
||||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
PigZapEvent event = new PigZapEvent(entity, entityweatherstorm.getBukkitEntity(), entitypigzombie.getBukkitEntity());
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -3,10 +3,8 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityPigZombie extends EntityZombie {
|
public class EntityPigZombie extends EntityZombie {
|
||||||
@ -20,7 +18,7 @@ public class EntityPigZombie extends EntityZombie {
|
|||||||
this.texture = "/mob/pigzombie.png";
|
this.texture = "/mob/pigzombie.png";
|
||||||
this.aE = 0.5F;
|
this.aE = 0.5F;
|
||||||
this.damage = 5;
|
this.damage = 5;
|
||||||
this.bD = true;
|
this.fireProof = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void o_() {
|
public void o_() {
|
||||||
@ -76,14 +74,10 @@ public class EntityPigZombie extends EntityZombie {
|
|||||||
|
|
||||||
private void d(Entity entity) {
|
private void d(Entity entity) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity bukkitTarget = null;
|
|
||||||
if (entity != null) {
|
|
||||||
bukkitTarget = entity.getBukkitEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET);
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.PIG_ZOMBIE_TARGET);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
@ -6,13 +6,8 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.util.ArrayList;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -24,8 +19,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
public ItemInWorldManager itemInWorldManager;
|
public ItemInWorldManager itemInWorldManager;
|
||||||
public double d;
|
public double d;
|
||||||
public double e;
|
public double e;
|
||||||
public List f = new LinkedList();
|
public List chunkCoordIntPairQueue = new LinkedList();
|
||||||
public Set g = new HashSet();
|
public Set playerChunkCoordIntPairs = new HashSet();
|
||||||
private int bK = -99999999;
|
private int bK = -99999999;
|
||||||
private int bL = 60;
|
private int bL = 60;
|
||||||
private ItemStack[] bM = new ItemStack[] { null, null, null, null, null};
|
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 String displayName;
|
||||||
public Location compassTarget;
|
public org.bukkit.Location compassTarget;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public void a(World world) {
|
public void spawnIn(World world) {
|
||||||
super.a(world);
|
super.spawnIn(world);
|
||||||
// CraftBukkit - world fallback code, either respawn location or global spawn
|
// CraftBukkit - world fallback code, either respawn location or global spawn
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
dead = false;
|
this.dead = false;
|
||||||
ChunkCoordinates position = null;
|
ChunkCoordinates position = null;
|
||||||
if (spawnWorld != null && !spawnWorld.equals("")) {
|
if (this.spawnWorld != null && !this.spawnWorld.equals("")) {
|
||||||
CraftWorld cw = (CraftWorld) Bukkit.getServer().getWorld(spawnWorld);
|
CraftWorld cworld = (CraftWorld) Bukkit.getServer().getWorld(this.spawnWorld);
|
||||||
if (cw != null && M() != null) {
|
if (cworld != null && this.getBed() != null) {
|
||||||
world = cw.getHandle();
|
world = cworld.getHandle();
|
||||||
position = EntityHuman.getBed(cw.getHandle(), M());
|
position = EntityHuman.getBed(cworld.getHandle(), this.getBed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (world == null || position == null) {
|
if (world == null || position == null) {
|
||||||
@ -79,7 +74,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
position = world.getSpawn();
|
position = world.getSpawn();
|
||||||
}
|
}
|
||||||
this.world = world;
|
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;
|
this.dimension = ((WorldServer) this.world).dimension;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -112,7 +107,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
ItemStack itemstack = this.b_(i);
|
ItemStack itemstack = this.b_(i);
|
||||||
|
|
||||||
if (itemstack != this.bM[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;
|
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];
|
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Entity entity) {
|
public void die(Entity entity) {
|
||||||
// CraftBukkit start
|
// 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) {
|
for (int i = 0; i < this.inventory.items.length; ++i) {
|
||||||
if (inventory.items[i] != null) {
|
if (this.inventory.items[i] != null) {
|
||||||
loot.add(new CraftItemStack(inventory.items[i]));
|
loot.add(new CraftItemStack(this.inventory.items[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < inventory.armor.length; ++i) {
|
for (int i = 0; i < this.inventory.armor.length; ++i) {
|
||||||
if (inventory.armor[i] != null) {
|
if (this.inventory.armor[i] != null) {
|
||||||
loot.add(new CraftItemStack(inventory.armor[i]));
|
loot.add(new CraftItemStack(this.inventory.armor[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftEntity craftEntity = (CraftEntity) getBukkitEntity();
|
org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity();
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
CraftWorld bworld = this.world.getWorld();
|
||||||
Server server = ((WorldServer) world).getServer();
|
|
||||||
|
|
||||||
EntityDeathEvent event = new EntityDeathEvent(craftEntity, loot);
|
EntityDeathEvent event = new EntityDeathEvent(bukkitEntity, loot);
|
||||||
server.getPluginManager().callEvent(event);
|
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.
|
// 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) {
|
for (int i = 0; i < this.inventory.items.length; ++i) {
|
||||||
inventory.items[i] = null;
|
this.inventory.items[i] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < inventory.armor.length; ++i) {
|
for (int i = 0; i < this.inventory.armor.length; ++i) {
|
||||||
inventory.armor[i] = null;
|
this.inventory.armor[i] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
||||||
cworld.dropItemNaturally(craftEntity.getLocation(), stack);
|
bworld.dropItemNaturally(bukkitEntity.getLocation(), stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.x();
|
this.x();
|
||||||
@ -208,8 +202,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag && !this.f.isEmpty()) {
|
if (flag && !this.chunkCoordIntPairQueue.isEmpty()) {
|
||||||
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.f.get(0);
|
ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) this.chunkCoordIntPairQueue.get(0);
|
||||||
|
|
||||||
if (chunkcoordintpair != null) {
|
if (chunkcoordintpair != null) {
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
@ -219,9 +213,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flag1) {
|
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));
|
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);
|
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) {
|
public void receive(Entity entity, int i) {
|
||||||
if (!entity.dead) {
|
if (!entity.dead) {
|
||||||
EntityTracker entitytracker = this.b.b(this.dimension);
|
EntityTracker entitytracker = this.b.getTracker(this.dimension);
|
||||||
|
|
||||||
if (entity instanceof EntityItem) {
|
if (entity instanceof EntityItem) {
|
||||||
entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
|
entitytracker.a(entity, new Packet22Collect(entity.id, this.id));
|
||||||
@ -302,7 +296,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
if (!this.p) {
|
if (!this.p) {
|
||||||
this.q = -1;
|
this.q = -1;
|
||||||
this.p = true;
|
this.p = true;
|
||||||
EntityTracker entitytracker = this.b.b(this.dimension);
|
EntityTracker entitytracker = this.b.getTracker(this.dimension);
|
||||||
|
|
||||||
entitytracker.a(this, new Packet18ArmAnimation(this, 1));
|
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);
|
EnumBedError enumbederror = super.a(i, j, k);
|
||||||
|
|
||||||
if (enumbederror == EnumBedError.OK) {
|
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);
|
Packet17 packet17 = new Packet17(this, 0, i, j, k);
|
||||||
|
|
||||||
entitytracker.a(this, packet17);
|
entitytracker.a(this, packet17);
|
||||||
@ -327,9 +321,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
|
|
||||||
public void a(boolean flag, boolean flag1, boolean flag2) {
|
public void a(boolean flag, boolean flag1, boolean flag2) {
|
||||||
if (this.isSleeping()) {
|
if (this.isSleeping()) {
|
||||||
EntityTracker entitytracker = this.b.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);
|
super.a(flag, flag1, flag2);
|
||||||
@ -340,7 +334,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
|
|
||||||
public void mount(Entity entity) {
|
public void mount(Entity entity) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
setPassengerOf(entity);
|
this.setPassengerOf(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPassengerOf(Entity entity) {
|
public void setPassengerOf(Entity entity) {
|
||||||
@ -368,7 +362,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
this.ah();
|
this.ah();
|
||||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 1, "Crafting", 9));
|
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 1, "Crafting", 9));
|
||||||
this.activeContainer = new ContainerWorkbench(this.inventory, this.world, i, j, k);
|
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);
|
this.activeContainer.a((ICrafting) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +370,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
this.ah();
|
this.ah();
|
||||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 0, iinventory.getName(), iinventory.getSize()));
|
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 0, iinventory.getName(), iinventory.getSize()));
|
||||||
this.activeContainer = new ContainerChest(this.inventory, iinventory);
|
this.activeContainer = new ContainerChest(this.inventory, iinventory);
|
||||||
this.activeContainer.f = this.bN;
|
this.activeContainer.windowId = this.bN;
|
||||||
this.activeContainer.a((ICrafting) this);
|
this.activeContainer.a((ICrafting) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +378,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
this.ah();
|
this.ah();
|
||||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
|
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
|
||||||
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
|
this.activeContainer = new ContainerFurnace(this.inventory, tileentityfurnace);
|
||||||
this.activeContainer.f = this.bN;
|
this.activeContainer.windowId = this.bN;
|
||||||
this.activeContainer.a((ICrafting) this);
|
this.activeContainer.a((ICrafting) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,35 +386,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
this.ah();
|
this.ah();
|
||||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
|
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.bN, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
|
||||||
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
|
this.activeContainer = new ContainerDispenser(this.inventory, tileentitydispenser);
|
||||||
this.activeContainer.f = this.bN;
|
this.activeContainer.windowId = this.bN;
|
||||||
this.activeContainer.a((ICrafting) this);
|
this.activeContainer.a((ICrafting) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Container container, int i, ItemStack itemstack) {
|
public void a(Container container, int i, ItemStack itemstack) {
|
||||||
if (!(container.b(i) instanceof SlotResult)) {
|
if (!(container.b(i) instanceof SlotResult)) {
|
||||||
if (!this.h) {
|
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());
|
this.a(container, container.b());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Container container, List list) {
|
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()));
|
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.j()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Container container, int i, int 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 a(ItemStack itemstack) {}
|
||||||
|
|
||||||
public void x() {
|
public void x() {
|
||||||
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.f));
|
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
|
||||||
this.z();
|
this.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,18 +481,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
public boolean relativeTime = true;
|
public boolean relativeTime = true;
|
||||||
|
|
||||||
public long getPlayerTime() {
|
public long getPlayerTime() {
|
||||||
if (relativeTime) {
|
if (this.relativeTime) {
|
||||||
// Adds timeOffset to the current server time.
|
// Adds timeOffset to the current server time.
|
||||||
return world.getTime() + timeOffset;
|
return this.world.getTime() + this.timeOffset;
|
||||||
} else {
|
} else {
|
||||||
// Adds timeOffset to the beginning of this day.
|
// 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
|
@Override
|
||||||
public String toString() {
|
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
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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.EntityCombustEvent;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
// CraftBukkit end
|
// 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) {
|
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
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
|
||||||
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
EntityCombustEvent event = new EntityCombustEvent(entity);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.fireTicks = 300;
|
this.fireTicks = 300;
|
||||||
@ -91,7 +82,7 @@ public class EntitySkeleton extends EntityMonster {
|
|||||||
|
|
||||||
protected void r() {
|
protected void r() {
|
||||||
// CraftBukkit start - whole method
|
// 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);
|
int count = this.random.nextInt(3);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
@ -103,15 +94,14 @@ public class EntitySkeleton extends EntityMonster {
|
|||||||
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.BONE, count));
|
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.BONE, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
org.bukkit.World bworld = this.world.getWorld();
|
||||||
Server server = ((WorldServer) world).getServer();
|
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||||
CraftEntity entity = (CraftEntity) getBukkitEntity();
|
|
||||||
|
|
||||||
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
|
||||||
cworld.dropItemNaturally(entity.getLocation(), stack);
|
bworld.dropItemNaturally(entity.getLocation(), stack);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,10 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntitySnowball extends Entity {
|
public class EntitySnowball extends Entity {
|
||||||
@ -19,7 +17,7 @@ public class EntitySnowball extends Entity {
|
|||||||
private int e = 0;
|
private int e = 0;
|
||||||
private boolean f = false;
|
private boolean f = false;
|
||||||
public int a = 0;
|
public int a = 0;
|
||||||
public EntityLiving shooter; // CraftBukkit private -> public
|
public EntityLiving shooter; // CraftBukkit - private -> public
|
||||||
private int h;
|
private int h;
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
|
|
||||||
@ -153,15 +151,12 @@ public class EntitySnowball extends Entity {
|
|||||||
if (movingobjectposition.entity != null) {
|
if (movingobjectposition.entity != null) {
|
||||||
boolean stick;
|
boolean stick;
|
||||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||||
CraftServer server = this.world.getServer();
|
|
||||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
|
||||||
int damage = 0;
|
|
||||||
|
|
||||||
// TODO @see EntityArrow#162
|
// TODO @see EntityArrow#162
|
||||||
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, damageCause, damage);
|
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(damagee, projectile, EntityDamageEvent.DamageCause.ENTITY_ATTACK, 0);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
@ -250,7 +245,7 @@ public class EntitySnowball extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void b(EntityHuman entityhuman) {
|
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);
|
this.world.makeSound(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
|
||||||
entityhuman.receive(this, 1);
|
entityhuman.receive(this, 1);
|
||||||
this.die();
|
this.die();
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntitySpider extends EntityMonster {
|
public class EntitySpider extends EntityMonster {
|
||||||
@ -30,7 +28,7 @@ public class EntitySpider extends EntityMonster {
|
|||||||
if (f < 0.5F) {
|
if (f < 0.5F) {
|
||||||
double d0 = 16.0D;
|
double d0 = 16.0D;
|
||||||
|
|
||||||
return this.world.a(this, d0);
|
return this.world.findNearbyPlayer(this, d0);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -53,9 +51,8 @@ public class EntitySpider extends EntityMonster {
|
|||||||
|
|
||||||
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
|
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.FORGOT_TARGET);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (event.getTarget() == null) {
|
if (event.getTarget() == null) {
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.entity.EntityDeathEvent; // CraftBukkit
|
||||||
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
|
|
||||||
|
|
||||||
public class EntitySquid extends EntityWaterAnimal {
|
public class EntitySquid extends EntityWaterAnimal {
|
||||||
|
|
||||||
@ -64,22 +56,21 @@ public class EntitySquid extends EntityWaterAnimal {
|
|||||||
|
|
||||||
protected void r() {
|
protected void r() {
|
||||||
// CraftBukkit start - whole method
|
// 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;
|
int count = this.random.nextInt(3) + 1;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.INK_SACK, count));
|
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.INK_SACK, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
org.bukkit.World bworld = this.world.getWorld();
|
||||||
Server server = ((WorldServer) world).getServer();
|
org.bukkit.entity.Entity entity = this.getBukkitEntity();
|
||||||
CraftEntity entity = (CraftEntity) getBukkitEntity();
|
|
||||||
|
|
||||||
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
EntityDeathEvent event = new EntityDeathEvent(entity, loot);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
||||||
cworld.dropItemNaturally(entity.getLocation(), stack);
|
bworld.dropItemNaturally(entity.getLocation(), stack);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|||||||
|
|
||||||
public class EntityTNTPrimed extends Entity {
|
public class EntityTNTPrimed extends Entity {
|
||||||
|
|
||||||
public int a;
|
public int fuseTicks;
|
||||||
public float yield = 4; // CraftBukkit
|
public float yield = 4; // CraftBukkit
|
||||||
public boolean isIncendiary = false; // CraftBukkit
|
public boolean isIncendiary = false; // CraftBukkit
|
||||||
|
|
||||||
public EntityTNTPrimed(World world) {
|
public EntityTNTPrimed(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
this.a = 0;
|
this.fuseTicks = 0;
|
||||||
this.aI = true;
|
this.aI = true;
|
||||||
this.b(0.98F, 0.98F);
|
this.b(0.98F, 0.98F);
|
||||||
this.height = this.width / 2.0F;
|
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.motX = (double) (-MathHelper.sin(f * 3.1415927F / 180.0F) * 0.02F);
|
||||||
this.motY = 0.20000000298023224D;
|
this.motY = 0.20000000298023224D;
|
||||||
this.motZ = (double) (-MathHelper.cos(f * 3.1415927F / 180.0F) * 0.02F);
|
this.motZ = (double) (-MathHelper.cos(f * 3.1415927F / 180.0F) * 0.02F);
|
||||||
this.a = 80;
|
this.fuseTicks = 80;
|
||||||
this.lastX = d0;
|
this.lastX = d0;
|
||||||
this.lastY = d1;
|
this.lastY = d1;
|
||||||
this.lastZ = d2;
|
this.lastZ = d2;
|
||||||
@ -60,7 +60,7 @@ public class EntityTNTPrimed extends Entity {
|
|||||||
this.motY *= -0.5D;
|
this.motY *= -0.5D;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.a-- <= 0) {
|
if (this.fuseTicks-- <= 0) {
|
||||||
if (!this.world.isStatic) {
|
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.
|
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event.
|
||||||
this.explode();
|
this.explode();
|
||||||
@ -78,7 +78,7 @@ public class EntityTNTPrimed extends Entity {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// float f = 4.0F;
|
// float f = 4.0F;
|
||||||
|
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
CraftServer server = this.world.getServer();
|
||||||
|
|
||||||
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(server, this));
|
ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(server, this));
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
@ -91,10 +91,10 @@ public class EntityTNTPrimed extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void b(NBTTagCompound nbttagcompound) {
|
protected void b(NBTTagCompound nbttagcompound) {
|
||||||
nbttagcompound.a("Fuse", (byte) this.a);
|
nbttagcompound.a("Fuse", (byte) this.fuseTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void a(NBTTagCompound nbttagcompound) {
|
protected void a(NBTTagCompound nbttagcompound) {
|
||||||
this.a = nbttagcompound.c("Fuse");
|
this.fuseTicks = nbttagcompound.c("Fuse");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class EntityTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void a(Entity entity) {
|
public synchronized void track(Entity entity) {
|
||||||
if (entity instanceof EntityPlayer) {
|
if (entity instanceof EntityPlayer) {
|
||||||
this.a(entity, 512, 2);
|
this.a(entity, 512, 2);
|
||||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||||
@ -80,7 +80,7 @@ public class EntityTracker {
|
|||||||
|
|
||||||
this.a.add(entitytrackerentry);
|
this.a.add(entitytrackerentry);
|
||||||
this.b.a(entity.id, 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
|
// CraftBukkit - synchronized
|
||||||
public synchronized void a() {
|
public synchronized void updatePlayers() {
|
||||||
ArrayList arraylist = new ArrayList();
|
ArrayList arraylist = new ArrayList();
|
||||||
Iterator iterator = this.a.iterator();
|
Iterator iterator = this.a.iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
|
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) {
|
if (entitytrackerentry.m && entitytrackerentry.tracker instanceof EntityPlayer) {
|
||||||
arraylist.add((EntityPlayer) entitytrackerentry.tracker);
|
arraylist.add((EntityPlayer) entitytrackerentry.tracker);
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ public class EntityTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - synchronized
|
// 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);
|
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.b.a(entity.id);
|
||||||
|
|
||||||
if (entitytrackerentry != null) {
|
if (entitytrackerentry != null) {
|
||||||
@ -152,7 +152,7 @@ public class EntityTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - synchronized
|
// CraftBukkit - synchronized
|
||||||
public synchronized void trackPlayer(EntityPlayer entityplayer) {
|
public synchronized void untrackPlayer(EntityPlayer entityplayer) {
|
||||||
Iterator iterator = this.a.iterator();
|
Iterator iterator = this.a.iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
@ -249,14 +249,8 @@ public class EntityTrackerEntry {
|
|||||||
} else if (this.tracker instanceof EntityFireball) {
|
} else if (this.tracker instanceof EntityFireball) {
|
||||||
EntityFireball entityfireball = (EntityFireball) this.tracker;
|
EntityFireball entityfireball = (EntityFireball) this.tracker;
|
||||||
// CraftBukkit start - added check for null shooter
|
// CraftBukkit start - added check for null shooter
|
||||||
// Packet23VehicleSpawn packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, ((EntityFireball) this.tracker).shooter.id);
|
int shooter = ((EntityFireball) this.tracker).shooter != null ? ((EntityFireball) this.tracker).shooter.id : 1;
|
||||||
|
Packet23VehicleSpawn packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 63, shooter);
|
||||||
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);
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
packet23vehiclespawn.e = (int) (entityfireball.c * 8000.0D);
|
packet23vehiclespawn.e = (int) (entityfireball.c * 8000.0D);
|
||||||
|
@ -3,7 +3,6 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||||
@ -11,13 +10,12 @@ import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
|||||||
|
|
||||||
public class EntityWeatherStorm extends EntityWeather {
|
public class EntityWeatherStorm extends EntityWeather {
|
||||||
|
|
||||||
private int b;
|
private int lifeTicks;
|
||||||
public long a = 0L;
|
public long a = 0L;
|
||||||
private int c;
|
private int c;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
private CraftWorld cworld;
|
private CraftWorld cworld;
|
||||||
private CraftServer server;
|
|
||||||
public boolean isEffect = false;
|
public boolean isEffect = false;
|
||||||
|
|
||||||
public EntityWeatherStorm(World world, double d0, double d1, double d2) {
|
public EntityWeatherStorm(World world, double d0, double d1, double d2) {
|
||||||
@ -31,25 +29,23 @@ public class EntityWeatherStorm extends EntityWeather {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
this.isEffect = isEffect;
|
this.isEffect = isEffect;
|
||||||
cworld = ((WorldServer) world).getWorld();
|
this.cworld = world.getWorld();
|
||||||
server = ((WorldServer) world).getServer();
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.setPositionRotation(d0, d1, d2, 0.0F, 0.0F);
|
this.setPositionRotation(d0, d1, d2, 0.0F, 0.0F);
|
||||||
this.b = 2;
|
this.lifeTicks = 2;
|
||||||
this.a = this.random.nextLong();
|
this.a = this.random.nextLong();
|
||||||
this.c = this.random.nextInt(3) + 1;
|
this.c = this.random.nextInt(3) + 1;
|
||||||
// CraftBukkit
|
// 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 i = MathHelper.floor(d0);
|
||||||
int j = MathHelper.floor(d1);
|
int j = MathHelper.floor(d1);
|
||||||
int k = MathHelper.floor(d2);
|
int k = MathHelper.floor(d2);
|
||||||
|
|
||||||
if (world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(world, i, j, k)) {
|
if (world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(world, i, j, k)) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(i, j, k), IgniteCause.LIGHTNING, null);
|
||||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
world.setTypeId(i, j, k, Block.FIRE.id);
|
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)) {
|
if (world.getTypeId(j, k, l) == 0 && Block.FIRE.canPlace(world, j, k, l)) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(j, k, l);
|
BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(j, k, l), IgniteCause.LIGHTNING, null);
|
||||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
world.setTypeId(j, k, l, Block.FIRE.id);
|
world.setTypeId(j, k, l, Block.FIRE.id);
|
||||||
}
|
}
|
||||||
@ -78,30 +74,30 @@ public class EntityWeatherStorm extends EntityWeather {
|
|||||||
|
|
||||||
public void o_() {
|
public void o_() {
|
||||||
super.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, "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.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
|
||||||
}
|
}
|
||||||
|
|
||||||
--this.b;
|
--this.lifeTicks;
|
||||||
if (this.b < 0) {
|
if (this.lifeTicks < 0) {
|
||||||
if (this.c == 0) {
|
if (this.c == 0) {
|
||||||
this.die();
|
this.die();
|
||||||
} else if (this.b < -this.random.nextInt(10)) {
|
} else if (this.lifeTicks < -this.random.nextInt(10)) {
|
||||||
--this.c;
|
--this.c;
|
||||||
this.b = 1;
|
this.lifeTicks = 1;
|
||||||
this.a = this.random.nextLong();
|
this.a = this.random.nextLong();
|
||||||
// CraftBukkit
|
// 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 i = MathHelper.floor(this.locX);
|
||||||
int j = MathHelper.floor(this.locY);
|
int j = MathHelper.floor(this.locY);
|
||||||
int k = MathHelper.floor(this.locZ);
|
int k = MathHelper.floor(this.locZ);
|
||||||
|
|
||||||
if (this.world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(this.world, i, j, k)) {
|
if (this.world.getTypeId(i, j, k) == 0 && Block.FIRE.canPlace(this.world, i, j, k)) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
|
BlockIgniteEvent event = new BlockIgniteEvent(this.cworld.getBlockAt(i, j, k), IgniteCause.LIGHTNING, null);
|
||||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, IgniteCause.LIGHTNING, null);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.world.setTypeId(i, j, k, Block.FIRE.id);
|
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;
|
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));
|
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;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
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
|
// CraftBukkit end
|
||||||
|
|
||||||
public class EntityWolf extends EntityAnimal {
|
public class EntityWolf extends EntityAnimal {
|
||||||
@ -48,10 +44,10 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
super.b(nbttagcompound);
|
super.b(nbttagcompound);
|
||||||
nbttagcompound.a("Angry", this.isAngry());
|
nbttagcompound.a("Angry", this.isAngry());
|
||||||
nbttagcompound.a("Sitting", this.isSitting());
|
nbttagcompound.a("Sitting", this.isSitting());
|
||||||
if (this.x() == null) {
|
if (this.getOwnerName() == null) {
|
||||||
nbttagcompound.setString("Owner", "");
|
nbttagcompound.setString("Owner", "");
|
||||||
} else {
|
} 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");
|
String s = nbttagcompound.getString("Owner");
|
||||||
|
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
this.a(s);
|
this.setOwnerName(s);
|
||||||
this.d(true);
|
this.setTamed(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean l_() {
|
protected boolean l_() {
|
||||||
return !this.A();
|
return !this.isTamed();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String g() {
|
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() {
|
protected String h() {
|
||||||
@ -93,8 +89,8 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
|
|
||||||
protected void c_() {
|
protected void c_() {
|
||||||
super.c_();
|
super.c_();
|
||||||
if (!this.e && !this.B() && this.A() && this.vehicle == null) {
|
if (!this.e && !this.B() && this.isTamed() && this.vehicle == null) {
|
||||||
EntityHuman entityhuman = this.world.a(this.x());
|
EntityHuman entityhuman = this.world.a(this.getOwnerName());
|
||||||
|
|
||||||
if (entityhuman != null) {
|
if (entityhuman != null) {
|
||||||
float f = entityhuman.f(this);
|
float f = entityhuman.f(this);
|
||||||
@ -105,24 +101,19 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
} else if (!this.ac()) {
|
} else if (!this.ac()) {
|
||||||
this.setSitting(true);
|
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));
|
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()) {
|
if (!list.isEmpty()) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Entity entity = (Entity) list.get(this.world.random.nextInt(list.size()));
|
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();
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.RANDOM_TARGET);
|
||||||
org.bukkit.entity.Entity bukkitTarget = null;
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
if (entity != null) {
|
|
||||||
bukkitTarget = entity.getBukkitEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.RANDOM_TARGET);
|
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (!event.isCancelled() || event.getTarget() != null ) {
|
if (!event.isCancelled() || event.getTarget() != null ) {
|
||||||
this.c(entity);
|
this.setTarget(entity);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
@ -133,7 +124,7 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isStatic) {
|
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();
|
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||||
|
|
||||||
if (itemstack != null) {
|
if (itemstack != null) {
|
||||||
if (!this.A() && itemstack.id == Item.BONE.id) {
|
if (!this.isTamed() && itemstack.id == Item.BONE.id) {
|
||||||
this.a = true;
|
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();
|
this.a = ((ItemFood) Item.byId[itemstack.id]).l();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,7 +227,7 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.a(pathentity);
|
this.setPathEntity(pathentity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,17 +244,13 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
if (!super.damageEntity((Entity) entity, i)) {
|
if (!super.damageEntity((Entity) entity, i)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!this.A() && !this.isAngry()) {
|
if (!this.isTamed() && !this.isAngry()) {
|
||||||
if (entity instanceof EntityHuman) {
|
if (entity instanceof EntityHuman) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = this.world.getServer();
|
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity bukkitTarget = null;
|
|
||||||
if (entity != null) {
|
|
||||||
bukkitTarget = entity.getBukkitEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (event.getTarget() == null) {
|
if (event.getTarget() == null) {
|
||||||
@ -288,16 +275,12 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
Entity entity1 = (Entity) iterator.next();
|
Entity entity1 = (Entity) iterator.next();
|
||||||
EntityWolf entitywolf = (EntityWolf) entity1;
|
EntityWolf entitywolf = (EntityWolf) entity1;
|
||||||
|
|
||||||
if (!entitywolf.A() && entitywolf.target == null) {
|
if (!entitywolf.isTamed() && entitywolf.target == null) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = this.world.getServer();
|
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity bukkitTarget = null;
|
|
||||||
if (entity != null) {
|
|
||||||
bukkitTarget = entity.getBukkitEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
|
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
if (event.getTarget() == null) {
|
if (event.getTarget() == null) {
|
||||||
@ -314,7 +297,7 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (entity != this && entity != null) {
|
} 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +309,7 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Entity findTarget() {
|
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) {
|
protected void a(Entity entity, float f) {
|
||||||
@ -344,29 +327,29 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
this.attackTicks = 20;
|
this.attackTicks = 20;
|
||||||
byte b0 = 2;
|
byte b0 = 2;
|
||||||
|
|
||||||
if (this.A()) {
|
if (this.isTamed()) {
|
||||||
b0 = 4;
|
b0 = 4;
|
||||||
}
|
}
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = this.world.getServer();
|
|
||||||
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
org.bukkit.entity.Entity damager = this.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
|
org.bukkit.entity.Entity damagee = entity == null ? null : entity.getBukkitEntity();
|
||||||
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
|
||||||
|
|
||||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageCause, b0);
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, EntityDamageEvent.DamageCause.ENTITY_ATTACK, b0);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
entity.damageEntity(this, b0);
|
return;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
|
entity.damageEntity(this, b0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(EntityHuman entityhuman) {
|
public boolean a(EntityHuman entityhuman) {
|
||||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||||
|
|
||||||
if (!this.A()) {
|
if (!this.isTamed()) {
|
||||||
if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
|
if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
|
||||||
--itemstack.count;
|
--itemstack.count;
|
||||||
if (itemstack.count <= 0) {
|
if (itemstack.count <= 0) {
|
||||||
@ -376,11 +359,12 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
// CraftBukkit - added event call and isCancelled check.
|
// CraftBukkit - added event call and isCancelled check.
|
||||||
if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||||
this.d(true);
|
// CraftBukkit end
|
||||||
this.a((PathEntity) null);
|
this.setTamed(true);
|
||||||
|
this.setPathEntity((PathEntity) null);
|
||||||
this.setSitting(true);
|
this.setSitting(true);
|
||||||
this.health = 20;
|
this.health = 20;
|
||||||
this.a(entityhuman.name);
|
this.setOwnerName(entityhuman.name);
|
||||||
this.a(true);
|
this.a(true);
|
||||||
this.world.a(this, (byte) 7);
|
this.world.a(this, (byte) 7);
|
||||||
} else {
|
} 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) {
|
if (!this.world.isStatic) {
|
||||||
this.setSitting(!this.isSitting());
|
this.setSitting(!this.isSitting());
|
||||||
this.aC = false;
|
this.aC = false;
|
||||||
this.a((PathEntity) null);
|
this.setPathEntity((PathEntity) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -440,12 +424,12 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String x() {
|
public String getOwnerName() {
|
||||||
return this.datawatcher.c(17);
|
return this.datawatcher.c(17);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(String s) {
|
public void setOwnerName(String s) {
|
||||||
this.datawatcher.b(17, s);
|
this.datawatcher.watch(17, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSitting() {
|
public boolean isSitting() {
|
||||||
@ -456,9 +440,9 @@ public class EntityWolf extends EntityAnimal {
|
|||||||
byte b0 = this.datawatcher.a(16);
|
byte b0 = this.datawatcher.a(16);
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 1)));
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1)));
|
||||||
} else {
|
} 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);
|
byte b0 = this.datawatcher.a(16);
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 2)));
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 2)));
|
||||||
} else {
|
} 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;
|
return (this.datawatcher.a(16) & 4) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void d(boolean flag) {
|
public void setTamed(boolean flag) {
|
||||||
byte b0 = this.datawatcher.a(16);
|
byte b0 = this.datawatcher.a(16);
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this.datawatcher.b(16, Byte.valueOf((byte) (b0 | 4)));
|
this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 4)));
|
||||||
} else {
|
} 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;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class EntityZombie extends EntityMonster {
|
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) {
|
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
|
// CraftBukkit start
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
|
||||||
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
|
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity());
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
this.fireTicks = 300;
|
this.fireTicks = 300;
|
||||||
|
@ -7,13 +7,10 @@ import java.util.Random;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Server;
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -28,7 +25,7 @@ public class Explosion {
|
|||||||
public double posZ;
|
public double posZ;
|
||||||
public Entity source;
|
public Entity source;
|
||||||
public float size;
|
public float size;
|
||||||
public Set g = new HashSet();
|
public Set blocks = new HashSet();
|
||||||
|
|
||||||
public boolean wasCanceled = false; // CraftBukkit
|
public boolean wasCanceled = false; // CraftBukkit
|
||||||
|
|
||||||
@ -81,7 +78,7 @@ public class Explosion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (f1 > 0.0F) {
|
if (f1 > 0.0F) {
|
||||||
this.g.add(new ChunkPosition(l, i1, j1));
|
this.blocks.add(new ChunkPosition(l, i1, j1));
|
||||||
}
|
}
|
||||||
|
|
||||||
d0 += d3 * (double) f2;
|
d0 += d3 * (double) f2;
|
||||||
@ -120,9 +117,8 @@ public class Explosion {
|
|||||||
double d10 = (1.0D - d7) * d9;
|
double d10 = (1.0D - d7) * d9;
|
||||||
|
|
||||||
// CraftBukkit start - explosion damage hook
|
// 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();
|
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);
|
int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D);
|
||||||
|
|
||||||
if (damagee == null) {
|
if (damagee == null) {
|
||||||
@ -130,9 +126,7 @@ public class Explosion {
|
|||||||
} else if (this.source == null) { // Block explosion
|
} else if (this.source == null) { // Block explosion
|
||||||
// TODO: get the x/y/z of the tnt block?
|
// TODO: get the x/y/z of the tnt block?
|
||||||
// does this even get called ever? @see EntityTNTPrimed - not BlockTNT or whatever
|
// does this even get called ever? @see EntityTNTPrimed - not BlockTNT or whatever
|
||||||
damageType = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
|
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, EntityDamageEvent.DamageCause.BLOCK_EXPLOSION, damageDone);
|
||||||
|
|
||||||
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
|
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
@ -142,10 +136,7 @@ public class Explosion {
|
|||||||
entity.motZ += d2 * d10;
|
entity.motZ += d2 * d10;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
org.bukkit.entity.Entity damager = this.source.getBukkitEntity();
|
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(this.source.getBukkitEntity(), damagee, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damageDone);
|
||||||
damageType = EntityDamageEvent.DamageCause.ENTITY_EXPLOSION;
|
|
||||||
|
|
||||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
|
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
@ -163,7 +154,7 @@ public class Explosion {
|
|||||||
this.size = f;
|
this.size = f;
|
||||||
ArrayList arraylist = new ArrayList();
|
ArrayList arraylist = new ArrayList();
|
||||||
|
|
||||||
arraylist.addAll(this.g);
|
arraylist.addAll(this.blocks);
|
||||||
if (this.a) {
|
if (this.a) {
|
||||||
for (int l2 = arraylist.size() - 1; l2 >= 0; --l2) {
|
for (int l2 = arraylist.size() - 1; l2 >= 0; --l2) {
|
||||||
ChunkPosition chunkposition = (ChunkPosition) arraylist.get(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);
|
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 arraylist = new ArrayList();
|
||||||
|
|
||||||
arraylist.addAll(this.g);
|
arraylist.addAll(this.blocks);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Server server = ((WorldServer) this.world).getServer();
|
org.bukkit.World bworld = this.world.getWorld();
|
||||||
CraftWorld world = ((WorldServer) this.world).getWorld();
|
org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity();
|
||||||
org.bukkit.entity.Entity explode = (this.source == null) ? null : this.source.getBukkitEntity();
|
Location location = new Location(bworld, this.posX, this.posY, this.posZ);
|
||||||
Location location = new Location(world, this.posX, this.posY, this.posZ);
|
|
||||||
|
|
||||||
List<org.bukkit.block.Block> blockList = new ArrayList<org.bukkit.block.Block>();
|
List<org.bukkit.block.Block> blockList = new ArrayList<org.bukkit.block.Block>();
|
||||||
for (int j = arraylist.size() - 1; j >= 0; j--) {
|
for (int j = arraylist.size() - 1; j >= 0; j--) {
|
||||||
ChunkPosition cpos = (ChunkPosition) arraylist.get(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) {
|
if (block.getType() != org.bukkit.Material.AIR) {
|
||||||
blockList.add(block);
|
blockList.add(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList);
|
EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList);
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
wasCanceled = true;
|
this.wasCanceled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
@ -6,7 +6,7 @@ public interface IInventory {
|
|||||||
|
|
||||||
ItemStack getItem(int i);
|
ItemStack getItem(int i);
|
||||||
|
|
||||||
ItemStack a(int i, int j);
|
ItemStack splitStack(int i, int j);
|
||||||
|
|
||||||
void setItem(int i, ItemStack itemstack);
|
void setItem(int i, ItemStack itemstack);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ public class InventoryCraftResult implements IInventory {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
return items;
|
return this.items;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ public class InventoryCraftResult implements IInventory {
|
|||||||
return "Result";
|
return "Result";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i, int j) {
|
public ItemStack splitStack(int i, int j) {
|
||||||
if (this.items[i] != null) {
|
if (this.items[i] != null) {
|
||||||
ItemStack itemstack = this.items[i];
|
ItemStack itemstack = this.items[i];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ public class InventoryCrafting implements IInventory {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
return items;
|
return this.items;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class InventoryCrafting implements IInventory {
|
|||||||
return "Crafting";
|
return "Crafting";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i, int j) {
|
public ItemStack splitStack(int i, int j) {
|
||||||
if (this.items[i] != null) {
|
if (this.items[i] != null) {
|
||||||
ItemStack itemstack;
|
ItemStack itemstack;
|
||||||
|
|
||||||
|
@ -8,9 +8,9 @@ public class InventoryLargeChest implements IInventory {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
ItemStack[] result = new ItemStack[getSize()];
|
ItemStack[] result = new ItemStack[this.getSize()];
|
||||||
for (int i = 0; i < result.length; i++) {
|
for (int i = 0; i < result.length; i++) {
|
||||||
result[i] = getItem(i);
|
result[i] = this.getItem(i);
|
||||||
}
|
}
|
||||||
return result;
|
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);
|
return i >= this.b.getSize() ? this.c.getItem(i - this.b.getSize()) : this.b.getItem(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i, int j) {
|
public ItemStack splitStack(int i, int j) {
|
||||||
return i >= this.b.getSize() ? this.c.a(i - this.b.getSize(), j) : this.b.a(i, 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) {
|
public void setItem(int i, ItemStack itemstack) {
|
||||||
|
@ -11,11 +11,11 @@ public class InventoryPlayer implements IInventory {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
return items;
|
return this.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack[] getArmorContents() {
|
public ItemStack[] getArmorContents() {
|
||||||
return armor;
|
return this.armor;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ public class InventoryPlayer implements IInventory {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int d(ItemStack itemstack) {
|
private int firstPartial(ItemStack itemstack) {
|
||||||
for (int i = 0; i < this.items.length; ++i) {
|
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;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,14 +52,14 @@ public class InventoryPlayer implements IInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start - watch method above! :D
|
// CraftBukkit start - watch method above! :D
|
||||||
public int canPickup(ItemStack itemstack) {
|
public int canHold(ItemStack itemstack) {
|
||||||
int remains = itemstack.count;
|
int remains = itemstack.count;
|
||||||
for (int i = 0; i < this.items.length; ++i) {
|
for (int i = 0; i < this.items.length; ++i) {
|
||||||
if (this.items[i] == null) return itemstack.count;
|
if (this.items[i] == null) return itemstack.count;
|
||||||
|
|
||||||
// Taken from d(ItemStack)I
|
// Taken from firstPartial(ItemStack)
|
||||||
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())) {
|
||||||
remains -= (this.items[i].b() < this.getMaxStackSize() ? this.items[i].b() : this.getMaxStackSize()) - this.items[i].count;
|
remains -= (this.items[i].getMaxStackSize() < this.getMaxStackSize() ? this.items[i].getMaxStackSize() : this.getMaxStackSize()) - this.items[i].count;
|
||||||
}
|
}
|
||||||
if (remains <= 0) return itemstack.count;
|
if (remains <= 0) return itemstack.count;
|
||||||
}
|
}
|
||||||
@ -77,10 +77,11 @@ public class InventoryPlayer implements IInventory {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private int e(ItemStack itemstack) {
|
private int e(ItemStack itemstack) {
|
||||||
int i = itemstack.id;
|
int i = itemstack.id;
|
||||||
int j = itemstack.count;
|
int j = itemstack.count;
|
||||||
int k = this.d(itemstack);
|
int k = this.firstPartial(itemstack);
|
||||||
|
|
||||||
if (k < 0) {
|
if (k < 0) {
|
||||||
k = this.k();
|
k = this.k();
|
||||||
@ -95,8 +96,8 @@ public class InventoryPlayer implements IInventory {
|
|||||||
|
|
||||||
int l = j;
|
int l = j;
|
||||||
|
|
||||||
if (j > this.items[k].b() - this.items[k].count) {
|
if (j > this.items[k].getMaxStackSize() - this.items[k].count) {
|
||||||
l = this.items[k].b() - this.items[k].count;
|
l = this.items[k].getMaxStackSize() - this.items[k].count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l > this.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;
|
int i;
|
||||||
|
|
||||||
if (itemstack.f()) {
|
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;
|
ItemStack[] aitemstack = this.items;
|
||||||
|
|
||||||
if (i >= this.items.length) {
|
if (i >= this.items.length) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
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)) {
|
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);
|
world.setTypeIdAndData(i, j, k, blockbed.id, i1);
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -56,13 +55,13 @@ public class ItemBlock extends Item {
|
|||||||
Block block = Block.byId[this.id];
|
Block block = Block.byId[this.id];
|
||||||
|
|
||||||
// CraftBukkit start - This executes the placement of the block
|
// CraftBukkit start - This executes the placement of the block
|
||||||
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
|
// 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
|
// 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
|
// would happen if you place x step onto another y step, so let's just keep
|
||||||
// track of the entire state
|
// 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)
|
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)) {
|
&& (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
|
||||||
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
|
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -72,13 +71,13 @@ public class ItemDoor extends Item {
|
|||||||
i1 += 4;
|
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);
|
world.setTypeIdAndData(i, j, k, block.id, i1);
|
||||||
|
|
||||||
// CraftBukkit start - bed
|
// CraftBukkit start - bed
|
||||||
world.o = false;
|
world.suppressPhysics = false;
|
||||||
world.applyPhysics(i, j, k, block.id);
|
world.applyPhysics(i, j, k, block.id);
|
||||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, block);
|
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ, block);
|
||||||
|
|
||||||
@ -87,11 +86,11 @@ public class ItemDoor extends Item {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
world.o = true;
|
world.suppressPhysics = true;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
world.setTypeIdAndData(i, j + 1, k, block.id, i1 + 8);
|
world.setTypeIdAndData(i, j + 1, k, block.id, i1 + 8);
|
||||||
world.o = false;
|
world.suppressPhysics = false;
|
||||||
// world.applyPhysics(i, j, k, block.id); // CraftBukkit -- moved up
|
// world.applyPhysics(i, j, k, block.id); // CraftBukkit - moved up
|
||||||
world.applyPhysics(i, j + 1, k, block.id);
|
world.applyPhysics(i, j + 1, k, block.id);
|
||||||
--itemstack.count;
|
--itemstack.count;
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class ItemFlintAndSteel extends Item {
|
public class ItemFlintAndSteel extends Item {
|
||||||
@ -51,23 +47,18 @@ public class ItemFlintAndSteel extends Item {
|
|||||||
|
|
||||||
if (i1 == 0) {
|
if (i1 == 0) {
|
||||||
// CraftBukkit start - store the clicked block
|
// CraftBukkit start - store the clicked block
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k);
|
||||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
|
||||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
|
||||||
|
|
||||||
Player thePlayer = (Player) entityhuman.getBukkitEntity();
|
Player thePlayer = (Player) entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL;
|
BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, thePlayer);
|
||||||
BlockIgniteEvent eventIgnite = new BlockIgniteEvent(blockClicked, igniteCause, thePlayer);
|
world.getServer().getPluginManager().callEvent(eventIgnite);
|
||||||
craftServer.getPluginManager().callEvent(eventIgnite);
|
|
||||||
boolean preventFire = eventIgnite.isCancelled();
|
|
||||||
|
|
||||||
if (preventFire) {
|
if (eventIgnite.isCancelled()) {
|
||||||
itemstack.damage(1, entityhuman);
|
itemstack.damage(1, entityhuman);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
|
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
|
||||||
// CraftBukkit end
|
// 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);
|
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;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -28,7 +27,7 @@ public class ItemHoe extends Item {
|
|||||||
if (world.isStatic) {
|
if (world.isStatic) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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);
|
world.setTypeId(i, j, k, block.id);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package net.minecraft.server;
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
@ -15,7 +14,7 @@ public class ItemInWorldManager {
|
|||||||
private WorldServer world;
|
private WorldServer world;
|
||||||
public EntityHuman player;
|
public EntityHuman player;
|
||||||
private float c = 0.0F;
|
private float c = 0.0F;
|
||||||
private int d;
|
private int lastDigTick;
|
||||||
private int e;
|
private int e;
|
||||||
private int f;
|
private int f;
|
||||||
private int g;
|
private int g;
|
||||||
@ -51,8 +50,8 @@ public class ItemInWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void dig(int i, int j, int k, int l) {
|
public void dig(int i, int j, int k, int l) {
|
||||||
// this.world.a((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
|
// this.world.douseFire((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
|
||||||
this.d = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
this.lastDigTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||||
int i1 = this.world.getTypeId(i, j, k);
|
int i1 = this.world.getTypeId(i, j, k);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@ -76,7 +75,7 @@ public class ItemInWorldManager {
|
|||||||
} else {
|
} else {
|
||||||
Block.byId[i1].b(this.world, i, j, k, this.player);
|
Block.byId[i1].b(this.world, i, j, k, this.player);
|
||||||
// Allow fire punching to be blocked
|
// 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
|
// Handle hitting a block
|
||||||
@ -111,7 +110,7 @@ public class ItemInWorldManager {
|
|||||||
public void a(int i, int j, int k) {
|
public void a(int i, int j, int k) {
|
||||||
if (i == this.e && j == this.f && k == this.g) {
|
if (i == this.e && j == this.f && k == this.g) {
|
||||||
this.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
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);
|
int i1 = this.world.getTypeId(i, j, k);
|
||||||
|
|
||||||
if (i1 != 0) {
|
if (i1 != 0) {
|
||||||
@ -125,7 +124,7 @@ public class ItemInWorldManager {
|
|||||||
this.j = i;
|
this.j = i;
|
||||||
this.k = j;
|
this.k = j;
|
||||||
this.l = k;
|
this.l = k;
|
||||||
this.m = this.d;
|
this.m = this.lastDigTick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit start - force blockreset to client
|
// CraftBukkit start - force blockreset to client
|
||||||
@ -152,12 +151,10 @@ public class ItemInWorldManager {
|
|||||||
public boolean c(int i, int j, int k) {
|
public boolean c(int i, int j, int k) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.player instanceof EntityPlayer) {
|
if (this.player instanceof EntityPlayer) {
|
||||||
CraftServer server = ((WorldServer) this.world).getServer();
|
org.bukkit.block.Block block = this.world.getWorld().getBlockAt(i, j, k);
|
||||||
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();
|
|
||||||
|
|
||||||
BlockBreakEvent event = new BlockBreakEvent(block, player);
|
BlockBreakEvent event = new BlockBreakEvent(block, (org.bukkit.entity.Player) this.player.getBukkitEntity());
|
||||||
server.getPluginManager().callEvent(event);
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,15 +1,8 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.painting.PaintingPlaceEvent;
|
import org.bukkit.event.painting.PaintingPlaceEvent;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -44,15 +37,13 @@ public class ItemPainting extends Item {
|
|||||||
if (entitypainting.h()) {
|
if (entitypainting.h()) {
|
||||||
if (!world.isStatic) {
|
if (!world.isStatic) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
|
||||||
Painting painting = (Painting) entitypainting.getBukkitEntity();
|
|
||||||
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(i, j, k);
|
||||||
BlockFace blockFace = CraftBlock.notchToBlockFace(l);
|
org.bukkit.block.BlockFace blockFace = CraftBlock.notchToBlockFace(l);
|
||||||
|
|
||||||
PaintingPlaceEvent event = new PaintingPlaceEvent(painting, who, blockClicked, blockFace);
|
PaintingPlaceEvent event = new PaintingPlaceEvent((org.bukkit.entity.Painting) entitypainting.getBukkitEntity(), who, blockClicked, blockFace);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -47,7 +46,7 @@ public class ItemRedstone extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
|
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
|
world.setRawTypeId(i, j, k, Block.REDSTONE_WIRE.id); // CraftBukkit - We update after the event
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -54,7 +53,7 @@ public class ItemReed extends Item {
|
|||||||
Block block = Block.byId[this.id];
|
Block block = Block.byId[this.id];
|
||||||
|
|
||||||
// CraftBukkit start - This executes the placement of the block
|
// CraftBukkit start - This executes the placement of the block
|
||||||
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)
|
* @see net.minecraft.server.World#setTypeId(int i, int j, int k, int l)
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -23,12 +22,13 @@ public class ItemSeeds extends Item {
|
|||||||
int i1 = world.getTypeId(i, j, k);
|
int i1 = world.getTypeId(i, j, k);
|
||||||
|
|
||||||
if (i1 == Block.SOIL.id && world.isEmpty(i, j + 1, 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);
|
world.setTypeId(i, j + 1, k, this.id);
|
||||||
|
|
||||||
// CraftBukkit start - seeds
|
// CraftBukkit start - seeds
|
||||||
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, this.id);
|
BlockPlaceEvent event = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, i, j, k, this.id);
|
||||||
|
|
||||||
if (event.isCancelled() || !event.canBuild()) {
|
if (event.isCancelled() || !event.canBuild()) {
|
||||||
event.getBlockPlaced().setTypeId(0);
|
event.getBlockPlaced().setTypeId(0);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
@ -45,7 +44,7 @@ public class ItemSign extends Item {
|
|||||||
if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
|
if (!Block.SIGN_POST.canPlace(world, i, j, k)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
|
||||||
|
|
||||||
if (l == 1) {
|
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);
|
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");
|
this.damage = nbttagcompound.d("Damage");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int b() {
|
public int getMaxStackSize() {
|
||||||
return this.getItem().getMaxStackSize();
|
return this.getItem().getMaxStackSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean c() {
|
public boolean isStackable() {
|
||||||
return this.b() > 1 && (!this.d() || !this.f());
|
return this.getMaxStackSize() > 1 && (!this.d() || !this.f());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean d() {
|
public boolean d() {
|
||||||
return Item.byId[this.id].e() > 0;
|
return Item.byId[this.id].e() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean e() {
|
public boolean usesData() {
|
||||||
return Item.byId[this.id].d();
|
return Item.byId[this.id].d();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ public final class ItemStack {
|
|||||||
Item.byId[this.id].a(this, entityliving);
|
Item.byId[this.id].a(this, entityliving);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack j() {
|
public ItemStack cloneItemStack() {
|
||||||
return new ItemStack(this.id, this.count, this.damage);
|
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);
|
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;
|
return this.id == itemstack.id && this.damage == itemstack.damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack b(ItemStack itemstack) {
|
public static ItemStack b(ItemStack itemstack) {
|
||||||
return itemstack == null ? null : itemstack.j();
|
return itemstack == null ? null : itemstack.cloneItemStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -19,7 +19,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|||||||
worldmap.b = world.q().c();
|
worldmap.b = world.q().c();
|
||||||
worldmap.c = world.q().e();
|
worldmap.c = world.q().e();
|
||||||
worldmap.e = 3;
|
worldmap.e = 3;
|
||||||
worldmap.d = (byte) ((WorldServer) world).dimension; // CraftBukkit
|
worldmap.map = (byte) world.worldProvider.dimension;
|
||||||
worldmap.a();
|
worldmap.a();
|
||||||
world.a(s, (WorldMapBase) worldmap);
|
world.a(s, (WorldMapBase) worldmap);
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(World world, Entity entity, WorldMap worldmap) {
|
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 short1 = 128;
|
||||||
short short2 = 128;
|
short short2 = 128;
|
||||||
int i = 1 << worldmap.e;
|
int i = 1 << worldmap.e;
|
||||||
@ -61,7 +61,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|||||||
byte b1 = 0;
|
byte b1 = 0;
|
||||||
byte b2 = 0;
|
byte b2 = 0;
|
||||||
int[] aint = new int[256];
|
int[] aint = new int[256];
|
||||||
Chunk chunk = world.b(i3, j3);
|
Chunk chunk = world.getChunkAtWorldCoords(i3, j3);
|
||||||
int k3 = i3 & 15;
|
int k3 = i3 & 15;
|
||||||
int l3 = j3 & 15;
|
int l3 = j3 & 15;
|
||||||
int i4 = 0;
|
int i4 = 0;
|
||||||
@ -222,7 +222,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
|
|||||||
worldmap.b = MathHelper.floor(entityhuman.locX);
|
worldmap.b = MathHelper.floor(entityhuman.locX);
|
||||||
worldmap.c = MathHelper.floor(entityhuman.locZ);
|
worldmap.c = MathHelper.floor(entityhuman.locZ);
|
||||||
worldmap.e = 3;
|
worldmap.e = 3;
|
||||||
worldmap.d = (byte) ((WorldServer) world).dimension; // CraftBukkit
|
worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit
|
||||||
worldmap.a();
|
worldmap.a();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import org.bukkit.plugin.PluginLoadOrder;
|
|||||||
public class MinecraftServer implements Runnable, ICommandListener {
|
public class MinecraftServer implements Runnable, ICommandListener {
|
||||||
|
|
||||||
public static Logger log = Logger.getLogger("Minecraft");
|
public static Logger log = Logger.getLogger("Minecraft");
|
||||||
public static HashMap b = new HashMap();
|
public static HashMap trackerList = new HashMap();
|
||||||
public NetworkListenThread networkListenThread;
|
public NetworkListenThread networkListenThread;
|
||||||
public PropertyManager propertyManager;
|
public PropertyManager propertyManager;
|
||||||
// public WorldServer[] worldServer; // CraftBukkit - removed!
|
// public WorldServer[] worldServer; // CraftBukkit - removed!
|
||||||
@ -51,7 +51,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
public boolean onlineMode;
|
public boolean onlineMode;
|
||||||
public boolean spawnAnimals;
|
public boolean spawnAnimals;
|
||||||
public boolean pvpMode;
|
public boolean pvpMode;
|
||||||
public boolean o;
|
public boolean allowFlight;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
public List<WorldServer> worlds = new ArrayList<WorldServer>();
|
||||||
@ -96,13 +96,13 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.info("Loading properties");
|
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", "");
|
String s = this.propertyManager.getString("server-ip", "");
|
||||||
|
|
||||||
this.onlineMode = this.propertyManager.getBoolean("online-mode", true);
|
this.onlineMode = this.propertyManager.getBoolean("online-mode", true);
|
||||||
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
|
this.spawnAnimals = this.propertyManager.getBoolean("spawn-animals", true);
|
||||||
this.pvpMode = this.propertyManager.getBoolean("pvp", 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;
|
InetAddress inetaddress = null;
|
||||||
|
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
@ -154,9 +154,9 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
|
|
||||||
if (this.propertyManager.properties.containsKey("spawn-protection")) {
|
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.");
|
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.properties.remove("spawn-protection");
|
||||||
this.propertyManager.b();
|
this.propertyManager.savePropertiesFile();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
String worldType = Environment.getEnvironment(dimension).toString().toLowerCase();
|
String worldType = Environment.getEnvironment(dimension).toString().toLowerCase();
|
||||||
String name = (dimension == 0) ? s : s + "_" + worldType;
|
String name = (dimension == 0) ? s : s + "_" + worldType;
|
||||||
|
|
||||||
ChunkGenerator gen = server.getGenerator(name);
|
ChunkGenerator gen = this.server.getGenerator(name);
|
||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, dimension, i, org.bukkit.World.Environment.getEnvironment(dimension), gen); // CraftBukkit
|
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) {
|
if (gen != null) {
|
||||||
world.getWorld().getPopulators().addAll(gen.getDefaultPopulators(world.getWorld()));
|
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.tracker = new EntityTracker(this, dimension);
|
||||||
world.addIWorldAccess(new WorldManager(this, world));
|
world.addIWorldAccess(new WorldManager(this, world));
|
||||||
world.spawnMonsters = this.propertyManager.getBoolean("spawn-monsters", true) ? 1 : 0;
|
world.spawnMonsters = this.propertyManager.getBoolean("spawn-monsters", true) ? 1 : 0;
|
||||||
world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
|
world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
|
||||||
worlds.add(world);
|
this.worlds.add(world);
|
||||||
this.serverConfigurationManager.setPlayerFileData(worlds.toArray(new WorldServer[0]));
|
this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0]));
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -262,11 +262,11 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
// } // CraftBukkit
|
// } // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Craftbukkit start
|
// CraftBukkit start
|
||||||
for (World world : worlds) {
|
for (World world : this.worlds) {
|
||||||
server.getPluginManager().callEvent(new WorldLoadEvent(world.getWorld()));
|
this.server.getPluginManager().callEvent(new WorldLoadEvent(world.getWorld()));
|
||||||
}
|
}
|
||||||
// Craftbukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.e();
|
this.e();
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
this.i = null;
|
this.i = null;
|
||||||
this.j = 0;
|
this.j = 0;
|
||||||
|
|
||||||
server.enablePlugins(PluginLoadOrder.POSTWORLD);
|
this.server.enablePlugins(PluginLoadOrder.POSTWORLD); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveChunks() { // CraftBukkit - private -> default
|
void saveChunks() { // CraftBukkit - private -> default
|
||||||
@ -295,11 +295,11 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
worldserver.saveLevel();
|
worldserver.saveLevel();
|
||||||
|
|
||||||
WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld());
|
WorldSaveEvent event = new WorldSaveEvent(worldserver.getWorld());
|
||||||
server.getPluginManager().callEvent(event);
|
this.server.getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldServer world = this.worlds.get(0);
|
WorldServer world = this.worlds.get(0);
|
||||||
if (!world.E) {
|
if (!world.canSave) {
|
||||||
this.serverConfigurationManager.savePlayers();
|
this.serverConfigurationManager.savePlayers();
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -308,8 +308,8 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
public void stop() { // CraftBukkit - private -> public
|
public void stop() { // CraftBukkit - private -> public
|
||||||
log.info("Stopping server");
|
log.info("Stopping server");
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (server != null) {
|
if (this.server != null) {
|
||||||
server.disablePlugins();
|
this.server.disablePlugins();
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -400,14 +400,14 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
|
|
||||||
private void h() {
|
private void h() {
|
||||||
ArrayList arraylist = new ArrayList();
|
ArrayList arraylist = new ArrayList();
|
||||||
Iterator iterator = b.keySet().iterator();
|
Iterator iterator = trackerList.keySet().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
String s = (String) iterator.next();
|
String s = (String) iterator.next();
|
||||||
int i = ((Integer) b.get(s)).intValue();
|
int i = ((Integer) trackerList.get(s)).intValue();
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
b.put(s, Integer.valueOf(i - 1));
|
trackerList.put(s, Integer.valueOf(i - 1));
|
||||||
} else {
|
} else {
|
||||||
arraylist.add(s);
|
arraylist.add(s);
|
||||||
}
|
}
|
||||||
@ -416,7 +416,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < arraylist.size(); ++j) {
|
for (j = 0; j < arraylist.size(); ++j) {
|
||||||
b.remove(arraylist.get(j));
|
trackerList.remove(arraylist.get(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
AxisAlignedBB.a();
|
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
|
// CraftBukkit end
|
||||||
|
|
||||||
worldserver.doTick();
|
worldserver.doTick();
|
||||||
@ -453,7 +453,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
for (j = 0; j < this.worlds.size(); ++j) {
|
for (j = 0; j < this.worlds.size(); ++j) {
|
||||||
this.worlds.get(j).tracker.a();
|
this.worlds.get(j).tracker.updatePlayers();
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
|
|||||||
ServerCommand servercommand = (ServerCommand) this.s.remove(0);
|
ServerCommand servercommand = (ServerCommand) this.s.remove(0);
|
||||||
|
|
||||||
// this.consoleCommandHandler.handle(servercommand); // CraftBukkit - Removed its now called in server.displatchCommand
|
// 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";
|
return "CONSOLE";
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldServer a(int i) {
|
public WorldServer getWorldServer(int i) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
for (WorldServer world : worlds) {
|
for (WorldServer world : this.worlds) {
|
||||||
if (world.dimension == i) {
|
if (world.dimension == i) {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return worlds.get(0);
|
return this.worlds.get(0);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityTracker b(int i) {
|
public EntityTracker getTracker(int i) {
|
||||||
return a(i).tracker; // CraftBukkit
|
return this.getWorldServer(i).tracker; // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRunning(MinecraftServer minecraftserver) {
|
public static boolean isRunning(MinecraftServer minecraftserver) {
|
||||||
|
@ -24,7 +24,7 @@ public class NetLoginHandler extends NetHandler {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public Socket getSocket() {
|
public Socket getSocket() {
|
||||||
return networkManager.socket;
|
return this.networkManager.socket;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class NetLoginHandler extends NetHandler {
|
|||||||
public void disconnect(String s) {
|
public void disconnect(String s) {
|
||||||
try {
|
try {
|
||||||
a.info("Disconnecting " + this.b() + ": " + s);
|
a.info("Disconnecting " + this.b() + ": " + s);
|
||||||
this.networkManager.a((Packet) (new Packet255KickDisconnect(s)));
|
this.networkManager.queue(new Packet255KickDisconnect(s));
|
||||||
this.networkManager.d();
|
this.networkManager.d();
|
||||||
this.c = true;
|
this.c = true;
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
@ -55,9 +55,9 @@ public class NetLoginHandler extends NetHandler {
|
|||||||
public void a(Packet2Handshake packet2handshake) {
|
public void a(Packet2Handshake packet2handshake) {
|
||||||
if (this.server.onlineMode) {
|
if (this.server.onlineMode) {
|
||||||
this.i = Long.toHexString(d.nextLong());
|
this.i = Long.toHexString(d.nextLong());
|
||||||
this.networkManager.a((Packet) (new Packet2Handshake(this.i)));
|
this.networkManager.queue(new Packet2Handshake(this.i));
|
||||||
} else {
|
} 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;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.util.logging.Level;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandException;
|
import org.bukkit.command.CommandException;
|
||||||
@ -17,8 +16,18 @@ import org.bukkit.craftbukkit.CraftServer;
|
|||||||
import org.bukkit.craftbukkit.TextWrapper;
|
import org.bukkit.craftbukkit.TextWrapper;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.*;
|
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
|
// CraftBukkit end
|
||||||
|
|
||||||
public class NetServerHandler extends NetHandler implements ICommandListener {
|
public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||||
@ -35,7 +44,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
private double x;
|
private double x;
|
||||||
private double y;
|
private double y;
|
||||||
private double z;
|
private double z;
|
||||||
private boolean m = true;
|
private boolean checkMovement = true;
|
||||||
private Map n = new HashMap();
|
private Map n = new HashMap();
|
||||||
|
|
||||||
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
||||||
@ -46,7 +55,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
entityplayer.netServerHandler = this;
|
entityplayer.netServerHandler = this;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
server = minecraftserver.server;
|
this.server = minecraftserver.server;
|
||||||
}
|
}
|
||||||
private final CraftServer server;
|
private final CraftServer server;
|
||||||
private int lastTick = MinecraftServer.currentTick;
|
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
|
// Store the last block right clicked and what type it was
|
||||||
private int lastMaterial;
|
private int lastMaterial;
|
||||||
|
|
||||||
public Player getPlayer() {
|
public CraftPlayer getPlayer() {
|
||||||
return (this.player == null) ? null : (CraftPlayer) player.getBukkitEntity();
|
return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -81,8 +90,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
public void disconnect(String s) {
|
public void disconnect(String s) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
String leaveMessage = "\u00A7e" + this.player.name + " left the game.";
|
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()) {
|
if (event.isCancelled()) {
|
||||||
// Do not kick the player
|
// Do not kick the player
|
||||||
return;
|
return;
|
||||||
@ -111,33 +122,32 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet10Flying packet10flying) {
|
public void a(Packet10Flying packet10flying) {
|
||||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
|
|
||||||
this.i = true;
|
this.i = true;
|
||||||
double d0;
|
double d0;
|
||||||
|
|
||||||
if (!this.m) {
|
if (!this.checkMovement) {
|
||||||
d0 = packet10flying.y - this.y;
|
d0 = packet10flying.y - this.y;
|
||||||
if (packet10flying.x == this.x && d0 * d0 < 0.01D && packet10flying.z == this.z) {
|
if (packet10flying.x == this.x && d0 * d0 < 0.01D && packet10flying.z == this.z) {
|
||||||
this.m = true;
|
this.checkMovement = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Player player = getPlayer();
|
Player player = this.getPlayer();
|
||||||
Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch);
|
Location from = new Location(player.getWorld(), this.lastPosX, this.lastPosY, this.lastPosZ, this.lastYaw, this.lastPitch);
|
||||||
Location to = player.getLocation();
|
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);
|
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);
|
float deltaAngle = Math.abs(this.lastYaw - this.player.yaw) + Math.abs(this.lastPitch - this.player.pitch);
|
||||||
|
|
||||||
if (delta > 1f / 256 || deltaAngle > 10f) {
|
if (delta > 1f / 256 || deltaAngle > 10f) {
|
||||||
// Skip the first time we do this
|
// 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);
|
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
||||||
|
this.server.getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
// If the event is cancelled we move the player back to their old location.
|
// If the event is cancelled we move the player back to their old location.
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
@ -202,7 +212,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.m && !this.player.dead) {
|
if (this.checkMovement && !this.player.dead) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
double d1;
|
double d1;
|
||||||
double d2;
|
double d2;
|
||||||
@ -298,7 +308,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
this.player.a(true);
|
this.player.a(true);
|
||||||
this.player.br = 0.0F;
|
this.player.br = 0.0F;
|
||||||
this.player.setLocation(this.x, this.y, this.z, f2, f3);
|
this.player.setLocation(this.x, this.y, this.z, f2, f3);
|
||||||
if (!this.m) {
|
if (!this.checkMovement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +321,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
|
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
|
||||||
|
|
||||||
// Added this.m condition to solve this check being triggered by teleports
|
// 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);
|
a.warning(this.player.name + " moved too quickly! Elapsed ticks: " + (elapsedTicks == 0 ? 1 : elapsedTicks) + ", Distance change: " + d8);
|
||||||
this.disconnect("You moved too quickly :( (Hacking?)");
|
this.disconnect("You moved too quickly :( (Hacking?)");
|
||||||
return;
|
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);
|
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) {
|
if (d6 >= -0.03125D) {
|
||||||
++this.h;
|
++this.h;
|
||||||
if (this.h > 80) {
|
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) {
|
public void a(double d0, double d1, double d2, float f, float f1) {
|
||||||
// CraftBukkit start - Delegate to teleport(Location)
|
// CraftBukkit start - Delegate to teleport(Location)
|
||||||
Player player = getPlayer();
|
Player player = this.getPlayer();
|
||||||
Location from = player.getLocation();
|
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);
|
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
|
||||||
server.getPluginManager().callEvent(event);
|
this.server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
from = event.getFrom();
|
from = event.getFrom();
|
||||||
to = event.isCancelled() ? from : event.getTo();
|
to = event.isCancelled() ? from : event.getTo();
|
||||||
|
|
||||||
teleport(to);
|
this.teleport(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teleport(Location dest) {
|
public void teleport(Location dest) {
|
||||||
@ -403,7 +413,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.m = false;
|
this.checkMovement = false;
|
||||||
this.x = d0;
|
this.x = d0;
|
||||||
this.y = d1;
|
this.y = d1;
|
||||||
this.z = d2;
|
this.z = d2;
|
||||||
@ -412,13 +422,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet14BlockDig packet14blockdig) {
|
public void a(Packet14BlockDig packet14blockdig) {
|
||||||
// CraftBukkit start
|
if (this.player.dead) return; // CraftBukkit
|
||||||
if (this.player.dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
|
|
||||||
if (packet14blockdig.e == 4) {
|
if (packet14blockdig.e == 4) {
|
||||||
this.player.E();
|
this.player.E();
|
||||||
@ -459,7 +465,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
|
|
||||||
if (packet14blockdig.e == 0) {
|
if (packet14blockdig.e == 0) {
|
||||||
// CraftBukkit
|
// CraftBukkit
|
||||||
if (i1 < server.getSpawnRadius() && !flag) {
|
if (i1 < this.server.getSpawnRadius() && !flag) {
|
||||||
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
|
this.player.netServerHandler.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit - add face argument
|
// CraftBukkit - add face argument
|
||||||
@ -486,15 +492,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet15Place packet15place) {
|
public void a(Packet15Place packet15place) {
|
||||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.player.dead) {
|
if (this.player.dead) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is b horrible hack needed because the client sends 2 packets on 'right mouse click'
|
// This is a 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
|
// 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
|
// 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
|
// 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
|
// -- Grum
|
||||||
|
|
||||||
if (packet15place.face == 255) {
|
if (packet15place.face == 255) {
|
||||||
if (packet15place.itemstack != null && packet15place.itemstack.id == lastMaterial && lastPacket != null && packet15place.timestamp - lastPacket < 100) {
|
if (packet15place.itemstack != null && packet15place.itemstack.id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) {
|
||||||
lastPacket = null;
|
this.lastPacket = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lastMaterial = packet15place.itemstack == null ? -1 : packet15place.itemstack.id;
|
this.lastMaterial = packet15place.itemstack == null ? -1 : packet15place.itemstack.id;
|
||||||
lastPacket = packet15place.timestamp;
|
this.lastPacket = packet15place.timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - if rightclick decremented the item, always send the update packet.
|
// 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
|
// 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;
|
boolean always = false;
|
||||||
|
|
||||||
// CraftBukkit end
|
// 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,
|
// 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
|
// inventory update packet to get sent
|
||||||
always = (itemstack.count != itemstackAmount);
|
always = (itemstack.count != itemstackAmount);
|
||||||
// CraftBukkit end
|
// 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
|
// 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) {
|
if (Math.pow(eyeLoc.getX() - i, 2) + Math.pow(eyeLoc.getY() - j, 2) + Math.pow(eyeLoc.getZ() - k, 2) > PLACE_DISTANCE_SQUARED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -604,14 +608,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
this.player.h = false;
|
this.player.h = false;
|
||||||
// CraftBukkit
|
// CraftBukkit
|
||||||
if (!ItemStack.equals(this.player.inventory.getItemInHand(), packet15place.itemstack) || always) {
|
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;
|
worldserver.weirdIsOpCache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(String s, Object[] aobject) {
|
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);
|
a.info(this.player.name + " lost connection: " + s);
|
||||||
// CraftBukkit start - we need to handle custom quit messages
|
// CraftBukkit start - we need to handle custom quit messages
|
||||||
@ -632,31 +636,27 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (packet instanceof Packet6SpawnPosition) {
|
if (packet instanceof Packet6SpawnPosition) {
|
||||||
Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet;
|
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) {
|
} else if (packet instanceof Packet3Chat) {
|
||||||
String message = ((Packet3Chat) packet).a;
|
String message = ((Packet3Chat) packet).message;
|
||||||
for (final String line: TextWrapper.wrapText(message)) {
|
for (final String line: TextWrapper.wrapText(message)) {
|
||||||
this.networkManager.a(new Packet3Chat(line));
|
this.networkManager.queue(new Packet3Chat(line));
|
||||||
}
|
}
|
||||||
packet = null;
|
packet = null;
|
||||||
}
|
}
|
||||||
if (packet != null) this.networkManager.a(packet);
|
if (packet != null) this.networkManager.queue(packet);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.g = this.f;
|
this.g = this.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
|
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
|
||||||
// CraftBukkit start
|
if (this.player.dead) return; // CraftBukkit
|
||||||
if (this.player.dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex <= InventoryPlayer.e()) {
|
if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex <= InventoryPlayer.e()) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
PlayerItemHeldEvent event = new PlayerItemHeldEvent(getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
|
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
|
||||||
server.getPluginManager().callEvent(event);
|
this.server.getPluginManager().callEvent(event);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
|
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
|
||||||
@ -666,7 +666,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet3Chat packet3chat) {
|
public void a(Packet3Chat packet3chat) {
|
||||||
String s = packet3chat.a;
|
String s = packet3chat.message;
|
||||||
|
|
||||||
if (s.length() > 100) {
|
if (s.length() > 100) {
|
||||||
this.disconnect("Chat message too long");
|
this.disconnect("Chat message too long");
|
||||||
@ -674,14 +674,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
s = s.trim();
|
s = s.trim();
|
||||||
|
|
||||||
for (int i = 0; i < s.length(); ++i) {
|
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");
|
this.disconnect("Illegal characters in chat");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
chat(s);
|
this.chat(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,9 +691,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
this.handleCommand(s);
|
this.handleCommand(s);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Player player = getPlayer();
|
Player player = this.getPlayer();
|
||||||
PlayerChatEvent event = new PlayerChatEvent(player, s);
|
PlayerChatEvent event = new PlayerChatEvent(player, s);
|
||||||
server.getPluginManager().callEvent(event);
|
this.server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
@ -713,21 +713,22 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
|
|
||||||
private void handleCommand(String s) {
|
private void handleCommand(String s) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftPlayer player = (CraftPlayer) getPlayer();
|
CraftPlayer player = this.getPlayer();
|
||||||
|
|
||||||
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s);
|
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s);
|
||||||
server.getPluginManager().callEvent(event);
|
this.server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (server.dispatchCommand(player, s.substring(1))) {
|
if (this.server.dispatchCommand(player, s.substring(1))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (CommandException ex) {
|
} catch (CommandException ex) {
|
||||||
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to perform this command");
|
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;
|
return;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -768,11 +769,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet18ArmAnimation packet18armanimation) {
|
public void a(Packet18ArmAnimation packet18armanimation) {
|
||||||
// CraftBukkit start
|
if (this.player.dead) return; // CraftBukkit
|
||||||
if (this.player.dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
if (packet18armanimation.b == 1) {
|
if (packet18armanimation.b == 1) {
|
||||||
// CraftBukkit start - raytrace to look for 'rogue armswings'
|
// CraftBukkit start - raytrace to look for 'rogue armswings'
|
||||||
@ -799,9 +796,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Arm swing animation
|
// Arm swing animation
|
||||||
Player player = getPlayer();
|
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer());
|
||||||
PlayerAnimationEvent event = new PlayerAnimationEvent(player);
|
this.server.getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.player.k_();
|
this.player.k_();
|
||||||
@ -810,14 +806,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
|
|
||||||
public void a(Packet19EntityAction packet19entityaction) {
|
public void a(Packet19EntityAction packet19entityaction) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.player.dead) {
|
if (this.player.dead) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (packet19entityaction.animation == 1 || packet19entityaction.animation == 2) {
|
if (packet19entityaction.animation == 1 || packet19entityaction.animation == 2) {
|
||||||
Player player = getPlayer();
|
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packet19entityaction.animation == 1);
|
||||||
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(player, packet19entityaction.animation == 1);
|
this.server.getPluginManager().callEvent(event);
|
||||||
server.getPluginManager().callEvent(event);
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -830,7 +824,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
this.player.setSneak(false);
|
this.player.setSneak(false);
|
||||||
} else if (packet19entityaction.animation == 3) {
|
} else if (packet19entityaction.animation == 3) {
|
||||||
this.player.a(false, true, true);
|
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) {
|
public void a(Packet7UseEntity packet7useentity) {
|
||||||
// CraftBukkit start
|
if (this.player.dead) return; // CraftBukkit
|
||||||
if (this.player.dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
Entity entity = worldserver.getEntity(packet7useentity.target);
|
Entity entity = worldserver.getEntity(packet7useentity.target);
|
||||||
ItemStack itemInHand = this.player.inventory.getItemInHand();
|
ItemStack itemInHand = this.player.inventory.getItemInHand();
|
||||||
|
|
||||||
if (entity != null && this.player.e(entity) && this.player.g(entity) < 36.0D) {
|
if (entity != null && this.player.e(entity) && this.player.g(entity) < 36.0D) {
|
||||||
if (packet7useentity.c == 0) {
|
if (packet7useentity.c == 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
PlayerInteractEntityEvent piee = new PlayerInteractEntityEvent((Player) getPlayer(), entity.getBukkitEntity());
|
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity());
|
||||||
server.getPluginManager().callEvent(piee);
|
this.server.getPluginManager().callEvent(event);
|
||||||
if (piee.isCancelled()) {
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.player.c(entity);
|
this.player.c(entity);
|
||||||
// CraftBukkit start - update the client if the item is an infinite one
|
// CraftBukkit start - update the client if the item is an infinite one
|
||||||
if (itemInHand != null && itemInHand.count <= -1) {
|
if (itemInHand != null && itemInHand.count <= -1) {
|
||||||
this.player.a(this.player.activeContainer);
|
this.player.updateInventory(this.player.activeContainer);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
} else if (packet7useentity.c == 1) {
|
} else if (packet7useentity.c == 1) {
|
||||||
this.player.d(entity);
|
this.player.d(entity);
|
||||||
// CraftBukkit start - update the client if the item is an infinite one
|
// CraftBukkit start - update the client if the item is an infinite one
|
||||||
if (itemInHand != null && itemInHand.count <= -1) {
|
if (itemInHand != null && itemInHand.count <= -1) {
|
||||||
this.player.a(this.player.activeContainer);
|
this.player.updateInventory(this.player.activeContainer);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
@ -889,33 +880,22 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
|
|
||||||
public void a(Packet9Respawn packet9respawn) {
|
public void a(Packet9Respawn packet9respawn) {
|
||||||
if (this.player.health <= 0) {
|
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
|
this.getPlayer().setHandle(this.player); // CraftBukkit
|
||||||
CraftPlayer player = (CraftPlayer) getPlayer();
|
|
||||||
player.setHandle(this.player);
|
|
||||||
// CraftBukkit end
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet101CloseWindow packet101closewindow) {
|
public void a(Packet101CloseWindow packet101closewindow) {
|
||||||
// CraftBukkit start
|
if (this.player.dead) return; // CraftBukkit
|
||||||
if (this.player.dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
this.player.z();
|
this.player.z();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet102WindowClick packet102windowclick) {
|
public void a(Packet102WindowClick packet102windowclick) {
|
||||||
// CraftBukkit start
|
if (this.player.dead) return; // CraftBukkit
|
||||||
if (this.player.dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
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);
|
ItemStack itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, packet102windowclick.f, this.player);
|
||||||
|
|
||||||
if (ItemStack.equals(packet102windowclick.e, itemstack)) {
|
if (ItemStack.equals(packet102windowclick.e, itemstack)) {
|
||||||
@ -925,7 +905,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
this.player.y();
|
this.player.y();
|
||||||
this.player.h = false;
|
this.player.h = false;
|
||||||
} else {
|
} 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.netServerHandler.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
|
||||||
this.player.activeContainer.a(this.player, false);
|
this.player.activeContainer.a(this.player, false);
|
||||||
ArrayList arraylist = new ArrayList();
|
ArrayList arraylist = new ArrayList();
|
||||||
@ -940,27 +920,19 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet106Transaction packet106transaction) {
|
public void a(Packet106Transaction packet106transaction) {
|
||||||
// CraftBukkit start
|
if (this.player.dead) return; // CraftBukkit
|
||||||
if (this.player.dead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
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);
|
this.player.activeContainer.a(this.player, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet130UpdateSign packet130updatesign) {
|
public void a(Packet130UpdateSign packet130updatesign) {
|
||||||
// CraftBukkit start
|
if (this.player.dead) return; // CraftBukkit
|
||||||
if (this.player.dead) {
|
|
||||||
return;
|
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
//
|
|
||||||
WorldServer worldserver = this.minecraftServer.a(this.player.dimension);
|
|
||||||
|
|
||||||
if (worldserver.isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) {
|
if (worldserver.isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) {
|
||||||
TileEntity tileentity = worldserver.getTileEntity(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;
|
flag = false;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {
|
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;
|
flag = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1005,9 +977,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
TileEntitySign tileentitysign1 = (TileEntitySign) tileentity;
|
TileEntitySign tileentitysign1 = (TileEntitySign) tileentity;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
Player player = server.getPlayer(this.player);
|
Player player = this.server.getPlayer(this.player);
|
||||||
SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), server.getPlayer(this.player), packet130updatesign.lines);
|
SignChangeEvent event = new SignChangeEvent((CraftBlock) player.getWorld().getBlockAt(j, k, i), this.server.getPlayer(this.player), packet130updatesign.lines);
|
||||||
server.getPluginManager().callEvent(event);
|
this.server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
for (int l = 0; l < 4; ++l) {
|
for (int l = 0; l < 4; ++l) {
|
||||||
|
@ -9,7 +9,6 @@ import java.net.SocketException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException; // CraftBukkit
|
|
||||||
|
|
||||||
public class NetworkManager {
|
public class NetworkManager {
|
||||||
|
|
||||||
@ -23,8 +22,8 @@ public class NetworkManager {
|
|||||||
private DataOutputStream output;
|
private DataOutputStream output;
|
||||||
private boolean l = true;
|
private boolean l = true;
|
||||||
private List m = Collections.synchronizedList(new ArrayList());
|
private List m = Collections.synchronizedList(new ArrayList());
|
||||||
private List n = Collections.synchronizedList(new ArrayList());
|
private List highPriorityQueue = Collections.synchronizedList(new ArrayList());
|
||||||
private List o = Collections.synchronizedList(new ArrayList());
|
private List lowPriorityQueue = Collections.synchronizedList(new ArrayList());
|
||||||
private NetHandler p;
|
private NetHandler p;
|
||||||
private boolean q = false;
|
private boolean q = false;
|
||||||
private Thread r;
|
private Thread r;
|
||||||
@ -37,7 +36,7 @@ public class NetworkManager {
|
|||||||
public static int[] d = new int[256];
|
public static int[] d = new int[256];
|
||||||
public static int[] e = new int[256];
|
public static int[] e = new int[256];
|
||||||
public int f = 0;
|
public int f = 0;
|
||||||
private int y = 50;
|
private int lowPriorityQueueDelay = 50;
|
||||||
|
|
||||||
public NetworkManager(Socket socket, String s, NetHandler nethandler) {
|
public NetworkManager(Socket socket, String s, NetHandler nethandler) {
|
||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
@ -55,11 +54,15 @@ public class NetworkManager {
|
|||||||
socket.setSoTimeout(30000);
|
socket.setSoTimeout(30000);
|
||||||
this.input = new DataInputStream(socket.getInputStream());
|
this.input = new DataInputStream(socket.getInputStream());
|
||||||
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
|
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
|
||||||
|
} catch (java.io.IOException socketexception) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
} catch (IOException socketexception) {
|
|
||||||
System.err.println(socketexception.getMessage());
|
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.s = new NetworkReaderThread(this, s + " read thread");
|
||||||
this.r = new NetworkWriterThread(this, s + " write thread");
|
this.r = new NetworkWriterThread(this, s + " write thread");
|
||||||
this.s.start();
|
this.s.start();
|
||||||
@ -70,16 +73,16 @@ public class NetworkManager {
|
|||||||
this.p = nethandler;
|
this.p = nethandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(Packet packet) {
|
public void queue(Packet packet) {
|
||||||
if (!this.q) {
|
if (!this.q) {
|
||||||
Object object = this.g;
|
Object object = this.g;
|
||||||
|
|
||||||
synchronized (this.g) {
|
synchronized (this.g) {
|
||||||
this.x += packet.a() + 1;
|
this.x += packet.a() + 1;
|
||||||
if (packet.k) {
|
if (packet.k) {
|
||||||
this.o.add(packet);
|
this.lowPriorityQueue.add(packet);
|
||||||
} else {
|
} else {
|
||||||
this.n.add(packet);
|
this.highPriorityQueue.add(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,10 +97,10 @@ public class NetworkManager {
|
|||||||
int i;
|
int i;
|
||||||
int[] aint;
|
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;
|
object = this.g;
|
||||||
synchronized (this.g) {
|
synchronized (this.g) {
|
||||||
packet = (Packet) this.n.remove(0);
|
packet = (Packet) this.highPriorityQueue.remove(0);
|
||||||
this.x -= packet.a() + 1;
|
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
|
// 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;
|
object = this.g;
|
||||||
synchronized (this.g) {
|
synchronized (this.g) {
|
||||||
packet = (Packet) this.o.remove(0);
|
packet = (Packet) this.lowPriorityQueue.remove(0);
|
||||||
this.x -= packet.a() + 1;
|
this.x -= packet.a() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +123,7 @@ public class NetworkManager {
|
|||||||
aint = e;
|
aint = e;
|
||||||
i = packet.b();
|
i = packet.b();
|
||||||
aint[i] += packet.a() + 1;
|
aint[i] += packet.a() + 1;
|
||||||
this.y = 0;
|
this.lowPriorityQueueDelay = 0;
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +244,7 @@ public class NetworkManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int e() {
|
public int e() {
|
||||||
return this.o.size();
|
return this.lowPriorityQueue.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean a(NetworkManager networkmanager) {
|
static boolean a(NetworkManager networkmanager) {
|
||||||
|
@ -9,11 +9,6 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
import java.net.SocketException;
|
|
||||||
import java.net.SocketTimeoutException;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public abstract class Packet {
|
public abstract class Packet {
|
||||||
|
|
||||||
private static Map a = new HashMap();
|
private static Map a = new HashMap();
|
||||||
@ -90,10 +85,10 @@ public abstract class Packet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
catch (SocketTimeoutException exception) {
|
catch (java.net.SocketTimeoutException exception) {
|
||||||
System.out.println("Read timed out");
|
System.out.println("Read timed out");
|
||||||
return null;
|
return null;
|
||||||
} catch (SocketException exception) {
|
} catch (java.net.SocketException exception) {
|
||||||
System.out.println("Connection reset");
|
System.out.println("Connection reset");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,12 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
|
||||||
import java.io.IOException; // CraftBukkit
|
import java.io.IOException; // CraftBukkit
|
||||||
|
|
||||||
public class Packet3Chat extends Packet {
|
public class Packet3Chat extends Packet {
|
||||||
|
|
||||||
public String a;
|
public String message;
|
||||||
|
|
||||||
public Packet3Chat() {}
|
public Packet3Chat() {}
|
||||||
|
|
||||||
@ -17,15 +18,15 @@ public class Packet3Chat extends Packet {
|
|||||||
}
|
}
|
||||||
// CraftBukkit end */
|
// CraftBukkit end */
|
||||||
|
|
||||||
this.a = s;
|
this.message = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit
|
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
|
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
|
||||||
a(this.a, dataoutputstream);
|
a(this.message, dataoutputstream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(NetHandler nethandler) {
|
public void a(NetHandler nethandler) {
|
||||||
@ -33,6 +34,6 @@ public class Packet3Chat extends Packet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int a() {
|
public int a() {
|
||||||
return this.a.length();
|
return this.message.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,13 @@ public class Packet51MapChunk extends Packet {
|
|||||||
this.k = true;
|
this.k = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - start
|
// CraftBukkit start
|
||||||
public Packet51MapChunk(int i, int j, int k, int l, int i1, int j1, World world) {
|
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) {
|
public Packet51MapChunk(int i, int j, int k, int l, int i1, int j1, byte[] data) {
|
||||||
// CraftBukkit - end
|
// CraftBukkit end
|
||||||
this.k = true;
|
this.k = true;
|
||||||
this.a = i;
|
this.a = i;
|
||||||
this.b = j;
|
this.b = j;
|
||||||
|
@ -8,7 +8,7 @@ class PlayerInstance {
|
|||||||
private List b;
|
private List b;
|
||||||
private int chunkX;
|
private int chunkX;
|
||||||
private int chunkZ;
|
private int chunkZ;
|
||||||
private ChunkCoordIntPair e;
|
private ChunkCoordIntPair location;
|
||||||
private short[] dirtyBlocks;
|
private short[] dirtyBlocks;
|
||||||
private int dirtyCount;
|
private int dirtyCount;
|
||||||
private int h;
|
private int h;
|
||||||
@ -27,7 +27,7 @@ class PlayerInstance {
|
|||||||
this.dirtyCount = 0;
|
this.dirtyCount = 0;
|
||||||
this.chunkX = i;
|
this.chunkX = i;
|
||||||
this.chunkZ = j;
|
this.chunkZ = j;
|
||||||
this.e = new ChunkCoordIntPair(i, j);
|
this.location = new ChunkCoordIntPair(i, j);
|
||||||
playermanager.a().chunkProviderServer.getChunkAt(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);
|
throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.chunkX + ", " + this.chunkZ);
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (entityplayer.g.add(this.e)) {
|
if (entityplayer.playerChunkCoordIntPairs.add(this.location)) {
|
||||||
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.e.x, this.e.z, true));
|
entityplayer.netServerHandler.sendPacket(new Packet50PreChunk(this.location.x, this.location.z, true));
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.b.add(entityplayer);
|
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);
|
this.playerManager.a().chunkProviderServer.queueUnload(this.chunkX, this.chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
entityplayer.f.remove(this.e);
|
entityplayer.chunkCoordIntPairQueue.remove(this.location);
|
||||||
// CraftBukkit - contains -> remove -- TODO VERIFY!!!!
|
// 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));
|
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) {
|
for (int i = 0; i < this.b.size(); ++i) {
|
||||||
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
EntityPlayer entityplayer = (EntityPlayer) this.b.get(i);
|
||||||
|
|
||||||
if (entityplayer.g.contains(this.e)) {
|
if (entityplayer.playerChunkCoordIntPairs.contains(this.location)) {
|
||||||
entityplayer.netServerHandler.sendPacket(packet);
|
entityplayer.netServerHandler.sendPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,9 @@ package net.minecraft.server;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
public class PlayerManager {
|
public class PlayerManager {
|
||||||
|
|
||||||
public List a = new ArrayList();
|
public List managedPlayers = new ArrayList();
|
||||||
private PlayerList b = new PlayerList();
|
private PlayerList b = new PlayerList();
|
||||||
private List c = new ArrayList();
|
private List c = new ArrayList();
|
||||||
private MinecraftServer server;
|
private MinecraftServer server;
|
||||||
@ -31,7 +26,7 @@ public class PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WorldServer a() {
|
public WorldServer a() {
|
||||||
return this.server.a(this.e);
|
return this.server.getWorldServer(this.e);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flush() {
|
public void flush() {
|
||||||
@ -99,7 +94,7 @@ public class PlayerManager {
|
|||||||
this.a(i + i1, j + j1, true).a(entityplayer);
|
this.a(i + i1, j + j1, true).a(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.a.add(entityplayer);
|
this.managedPlayers.add(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(EntityPlayer 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) {
|
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) {
|
if (i1 > 1 || i1 < -1 || j1 > 1 || j1 < -1) {
|
||||||
final int x = i;
|
final int x = i;
|
||||||
final int z = j;
|
final int z = j;
|
||||||
List<ChunkCoordIntPair> chunksToSend = entityplayer.f;
|
List<ChunkCoordIntPair> chunksToSend = entityplayer.chunkCoordIntPairQueue;
|
||||||
Collections.sort(chunksToSend, new Comparator<ChunkCoordIntPair>() {
|
|
||||||
|
java.util.Collections.sort(chunksToSend, new java.util.Comparator<ChunkCoordIntPair>() {
|
||||||
public int compare(ChunkCoordIntPair a, ChunkCoordIntPair b) {
|
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));
|
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;
|
return this.f * 16 - 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.util.Random;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.event.world.PortalCreateEvent;
|
import org.bukkit.event.world.PortalCreateEvent;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -225,9 +224,9 @@ public class PortalTravelAgent {
|
|||||||
boolean flag;
|
boolean flag;
|
||||||
|
|
||||||
// CraftBukkit start - portal create event
|
// 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
|
// 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 (d0 < 0.0D) {
|
||||||
if (i1 < 70) {
|
if (i1 < 70) {
|
||||||
@ -246,10 +245,7 @@ public class PortalTravelAgent {
|
|||||||
i3 = i5 + (k2 - 1) * k5 + l2 * l5;
|
i3 = i5 + (k2 - 1) * k5 + l2 * l5;
|
||||||
l3 = j5 + j3;
|
l3 = j5 + j3;
|
||||||
k3 = j2 + (k2 - 1) * l5 - l2 * k5;
|
k3 = j2 + (k2 - 1) * l5 - l2 * k5;
|
||||||
org.bukkit.block.Block b = craftWorld.getBlockAt(i3, l3, k3);
|
blocks.add(bworld.getBlockAt(i3, l3, k3));
|
||||||
if (!blocks.contains(b)) {
|
|
||||||
blocks.add(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,16 +257,14 @@ public class PortalTravelAgent {
|
|||||||
i3 = i5 + (k2 - 1) * k5;
|
i3 = i5 + (k2 - 1) * k5;
|
||||||
l3 = j5 + j3;
|
l3 = j5 + j3;
|
||||||
k3 = j2 + (k2 - 1) * l5;
|
k3 = j2 + (k2 - 1) * l5;
|
||||||
org.bukkit.block.Block b = craftWorld.getBlockAt(i3, l3, k3);
|
blocks.add(bworld.getBlockAt(i3, l3, k3));
|
||||||
if (!blocks.contains(b)) {
|
|
||||||
blocks.add(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PortalCreateEvent event = new PortalCreateEvent(blocks, (org.bukkit.World) craftWorld);
|
PortalCreateEvent event = new PortalCreateEvent(blocks, bworld);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -301,7 +295,7 @@ public class PortalTravelAgent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (l2 = 0; l2 < 4; ++l2) {
|
for (l2 = 0; l2 < 4; ++l2) {
|
||||||
world.o = true;
|
world.suppressPhysics = true;
|
||||||
|
|
||||||
for (k2 = 0; k2 < 4; ++k2) {
|
for (k2 = 0; k2 < 4; ++k2) {
|
||||||
for (j3 = -1; j3 < 4; ++j3) {
|
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 (k2 = 0; k2 < 4; ++k2) {
|
||||||
for (j3 = -1; j3 < 4; ++j3) {
|
for (j3 = -1; j3 < 4; ++j3) {
|
||||||
|
@ -7,12 +7,10 @@ import java.util.Properties;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import joptsimple.OptionSet; // CraftBukkit
|
|
||||||
|
|
||||||
public class PropertyManager {
|
public class PropertyManager {
|
||||||
|
|
||||||
public static Logger a = Logger.getLogger("Minecraft");
|
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;
|
private File c;
|
||||||
|
|
||||||
public PropertyManager(File file1) {
|
public PropertyManager(File file1) {
|
||||||
@ -31,17 +29,17 @@ public class PropertyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// 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((File) options.valueOf("config"));
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T getOverride(String name, T value) {
|
private <T> T getOverride(String name, T value) {
|
||||||
if ((options != null) && (options.has(name))) {
|
if ((this.options != null) && (this.options.has(name))) {
|
||||||
return (T) options.valueOf(name);
|
return (T) this.options.valueOf(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@ -50,10 +48,10 @@ public class PropertyManager {
|
|||||||
|
|
||||||
public void a() {
|
public void a() {
|
||||||
a.log(Level.INFO, "Generating new properties file");
|
a.log(Level.INFO, "Generating new properties file");
|
||||||
this.b();
|
this.savePropertiesFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void b() {
|
public void savePropertiesFile() {
|
||||||
try {
|
try {
|
||||||
this.properties.store(new FileOutputStream(this.c), "Minecraft server properties");
|
this.properties.store(new FileOutputStream(this.c), "Minecraft server properties");
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
@ -64,19 +62,19 @@ public class PropertyManager {
|
|||||||
|
|
||||||
public String getString(String s, String s1) {
|
public String getString(String s, String s1) {
|
||||||
if (!this.properties.containsKey(s)) {
|
if (!this.properties.containsKey(s)) {
|
||||||
s1 = getOverride(s, s1); // CraftBukkit
|
s1 = this.getOverride(s, s1); // CraftBukkit
|
||||||
this.properties.setProperty(s, s1);
|
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) {
|
public int getInt(String s, int i) {
|
||||||
try {
|
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) {
|
} catch (Exception exception) {
|
||||||
i = getOverride(s, i); // CraftBukkit
|
i = this.getOverride(s, i); // CraftBukkit
|
||||||
this.properties.setProperty(s, "" + i);
|
this.properties.setProperty(s, "" + i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -84,17 +82,17 @@ public class PropertyManager {
|
|||||||
|
|
||||||
public boolean getBoolean(String s, boolean flag) {
|
public boolean getBoolean(String s, boolean flag) {
|
||||||
try {
|
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) {
|
} catch (Exception exception) {
|
||||||
flag = getOverride(s, flag); // CraftBukkit
|
flag = this.getOverride(s, flag); // CraftBukkit
|
||||||
this.properties.setProperty(s, "" + flag);
|
this.properties.setProperty(s, "" + flag);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void b(String s, boolean 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.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) {
|
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);
|
super(minecraftserver, idatamanager, s, i, j, env, gen);
|
||||||
// CraftBukkit end
|
// 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.CraftServer;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
|
import org.bukkit.craftbukkit.command.ColouredConsoleSender;
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerPortalEvent;
|
import org.bukkit.event.player.PlayerPortalEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -51,7 +50,7 @@ public class ServerConfigurationManager {
|
|||||||
public ServerConfigurationManager(MinecraftServer minecraftserver) {
|
public ServerConfigurationManager(MinecraftServer minecraftserver) {
|
||||||
minecraftserver.server = new CraftServer(minecraftserver, this);
|
minecraftserver.server = new CraftServer(minecraftserver, this);
|
||||||
minecraftserver.console = new ColouredConsoleSender(minecraftserver.server);
|
minecraftserver.console = new ColouredConsoleSender(minecraftserver.server);
|
||||||
cserver = minecraftserver.server;
|
this.cserver = minecraftserver.server;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.server = minecraftserver;
|
this.server = minecraftserver;
|
||||||
@ -82,13 +81,13 @@ public class ServerConfigurationManager {
|
|||||||
public void a(EntityPlayer entityplayer) {
|
public void a(EntityPlayer entityplayer) {
|
||||||
// CraftBukkit - removed playermanagers
|
// CraftBukkit - removed playermanagers
|
||||||
for (WorldServer world : this.server.worlds) {
|
for (WorldServer world : this.server.worlds) {
|
||||||
if (world.manager.a.contains(entityplayer)) {
|
if (world.manager.managedPlayers.contains(entityplayer)) {
|
||||||
world.manager.removePlayer(entityplayer);
|
world.manager.removePlayer(entityplayer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.a(entityplayer.dimension).addPlayer(entityplayer);
|
this.getPlayerManager(entityplayer.dimension).addPlayer(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);
|
worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||||
}
|
}
|
||||||
@ -97,14 +96,13 @@ public class ServerConfigurationManager {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.server.worlds.size() == 0) {
|
if (this.server.worlds.size() == 0) {
|
||||||
return this.server.propertyManager.getInt("view-distance", 10) * 16 - 16;
|
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
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerManager a(int i) {
|
private PlayerManager getPlayerManager(int i) {
|
||||||
return server.a(i).manager; // CraftBukkit
|
return this.server.getWorldServer(i).manager; // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public void b(EntityPlayer entityplayer) {
|
public void b(EntityPlayer entityplayer) {
|
||||||
@ -113,7 +111,7 @@ public class ServerConfigurationManager {
|
|||||||
|
|
||||||
public void c(EntityPlayer entityplayer) {
|
public void c(EntityPlayer entityplayer) {
|
||||||
this.players.add(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);
|
worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
|
||||||
|
|
||||||
@ -122,8 +120,8 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
|
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game.");
|
||||||
cserver.getPluginManager().callEvent(playerJoinEvent);
|
this.cserver.getPluginManager().callEvent(playerJoinEvent);
|
||||||
|
|
||||||
String joinMessage = playerJoinEvent.getJoinMessage();
|
String joinMessage = playerJoinEvent.getJoinMessage();
|
||||||
|
|
||||||
@ -133,25 +131,25 @@ public class ServerConfigurationManager {
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
worldserver.addEntity(entityplayer);
|
worldserver.addEntity(entityplayer);
|
||||||
this.a(entityplayer.dimension).addPlayer(entityplayer);
|
this.getPlayerManager(entityplayer.dimension).addPlayer(entityplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void d(EntityPlayer 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
|
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - changed return type
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// Quitting must be before we do final save of data, in case plugins need to modify it
|
// Quitting must be before we do final save of data, in case plugins need to modify it
|
||||||
this.a(entityplayer.dimension).removePlayer(entityplayer);
|
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
|
||||||
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
|
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game.");
|
||||||
cserver.getPluginManager().callEvent(playerQuitEvent);
|
this.cserver.getPluginManager().callEvent(playerQuitEvent);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.playerFileData.a(entityplayer);
|
this.playerFileData.a(entityplayer);
|
||||||
this.server.a(entityplayer.dimension).kill(entityplayer);
|
this.server.getWorldServer(entityplayer.dimension).kill(entityplayer);
|
||||||
this.players.remove(entityplayer);
|
this.players.remove(entityplayer);
|
||||||
this.a(entityplayer.dimension).removePlayer(entityplayer);
|
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
|
||||||
|
|
||||||
return playerQuitEvent.getQuitMessage(); // CraftBukkit
|
return playerQuitEvent.getQuitMessage(); // CraftBukkit
|
||||||
}
|
}
|
||||||
@ -161,7 +159,7 @@ public class ServerConfigurationManager {
|
|||||||
// Instead of kicking then returning, we need to store the kick reason
|
// 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
|
// 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
|
// 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();
|
Player player = (entity == null) ? null : (Player) entity.getBukkitEntity();
|
||||||
PlayerLoginEvent event = new PlayerLoginEvent(player);
|
PlayerLoginEvent event = new PlayerLoginEvent(player);
|
||||||
|
|
||||||
@ -183,7 +181,7 @@ public class ServerConfigurationManager {
|
|||||||
event.disallow(PlayerLoginEvent.Result.ALLOWED, s1);
|
event.disallow(PlayerLoginEvent.Result.ALLOWED, s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cserver.getPluginManager().callEvent(event);
|
this.cserver.getPluginManager().callEvent(event);
|
||||||
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
||||||
netloginhandler.disconnect(event.getKickMessage());
|
netloginhandler.disconnect(event.getKickMessage());
|
||||||
return null;
|
return null;
|
||||||
@ -202,49 +200,50 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public EntityPlayer a(EntityPlayer entityplayer, int i) {
|
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i) {
|
||||||
return a(entityplayer, i, null);
|
return this.moveToWorld(entityplayer, i, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityPlayer a(EntityPlayer entityplayer, int i, Location location) {
|
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, Location location) {
|
||||||
this.server.b(entityplayer.dimension).trackPlayer(entityplayer);
|
this.server.getTracker(entityplayer.dimension).untrackPlayer(entityplayer);
|
||||||
this.a(entityplayer.dimension).removePlayer(entityplayer);
|
// this.server.getTracker(entityplayer.dimension).untrackEntity(entityplayer); // CraftBukkit
|
||||||
|
this.getPlayerManager(entityplayer.dimension).removePlayer(entityplayer);
|
||||||
this.players.remove(entityplayer);
|
this.players.remove(entityplayer);
|
||||||
this.server.a(entityplayer.dimension).removeEntity(entityplayer);
|
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
|
||||||
ChunkCoordinates chunkcoordinates = entityplayer.M();
|
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
EntityPlayer entityplayer1 = entityplayer;
|
EntityPlayer entityplayer1 = entityplayer;
|
||||||
|
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
boolean isBedSpawn = false;
|
boolean isBedSpawn = false;
|
||||||
CraftWorld cw = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
|
CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld);
|
||||||
if (cw != null && chunkcoordinates != null) {
|
if (cworld != null && chunkcoordinates != null) {
|
||||||
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cw.getHandle(), chunkcoordinates);
|
ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cworld.getHandle(), chunkcoordinates);
|
||||||
if (chunkcoordinates1 != null) {
|
if (chunkcoordinates1 != null) {
|
||||||
isBedSpawn = true;
|
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 {
|
} else {
|
||||||
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0));
|
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
cw = (CraftWorld) this.server.server.getWorlds().get(0);
|
cworld = (CraftWorld) this.server.server.getWorlds().get(0);
|
||||||
chunkcoordinates = cw.getHandle().getSpawn();
|
chunkcoordinates = cworld.getHandle().getSpawn();
|
||||||
location = new Location(cw, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5);
|
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);
|
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
|
||||||
cserver.getPluginManager().callEvent(respawnEvent);
|
this.cserver.getPluginManager().callEvent(respawnEvent);
|
||||||
|
|
||||||
location = respawnEvent.getRespawnLocation();
|
location = respawnEvent.getRespawnLocation();
|
||||||
entityplayer.health = 20;
|
entityplayer.health = 20;
|
||||||
entityplayer.fireTicks = 0;
|
entityplayer.fireTicks = 0;
|
||||||
entityplayer.fallDistance = 0;
|
entityplayer.fallDistance = 0;
|
||||||
} else {
|
} else {
|
||||||
location.setWorld(this.server.a(i).getWorld());
|
location.setWorld(this.server.getWorldServer(i).getWorld());
|
||||||
}
|
}
|
||||||
WorldServer worldserver = ((CraftWorld) location.getWorld()).getHandle();
|
WorldServer worldserver = ((CraftWorld) location.getWorld()).getHandle();
|
||||||
entityplayer1.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
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());
|
byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId());
|
||||||
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0)));
|
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0)));
|
||||||
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension));
|
entityplayer1.netServerHandler.sendPacket(new Packet9Respawn(actualDimension));
|
||||||
entityplayer1.a(worldserver);
|
entityplayer1.spawnIn(worldserver);
|
||||||
entityplayer1.dead = false;
|
entityplayer1.dead = false;
|
||||||
entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
|
entityplayer1.netServerHandler.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.a(entityplayer1, worldserver);
|
this.a(entityplayer1, worldserver);
|
||||||
this.a(entityplayer1.dimension).addPlayer(entityplayer1);
|
this.getPlayerManager(entityplayer1.dimension).addPlayer(entityplayer1);
|
||||||
worldserver.addEntity(entityplayer1);
|
worldserver.addEntity(entityplayer1);
|
||||||
this.players.add(entityplayer1);
|
this.players.add(entityplayer1);
|
||||||
this.g(entityplayer1); // CraftBukkit
|
this.updateClient(entityplayer1); // CraftBukkit
|
||||||
entityplayer1.w();
|
entityplayer1.w();
|
||||||
return entityplayer1;
|
return entityplayer1;
|
||||||
}
|
}
|
||||||
@ -276,8 +275,8 @@ public class ServerConfigurationManager {
|
|||||||
public void f(EntityPlayer entityplayer) {
|
public void f(EntityPlayer entityplayer) {
|
||||||
// CraftBukkit start -- Replaced the standard handling of portals with a more customised method.
|
// CraftBukkit start -- Replaced the standard handling of portals with a more customised method.
|
||||||
int dimension = entityplayer.dimension;
|
int dimension = entityplayer.dimension;
|
||||||
WorldServer fromWorld = this.server.a(dimension);
|
WorldServer fromWorld = this.server.getWorldServer(dimension);
|
||||||
WorldServer toWorld = this.server.a(dimension == -1 ? 0 : -1);
|
WorldServer toWorld = this.server.getWorldServer(dimension == -1 ? 0 : -1);
|
||||||
double blockRatio = dimension == -1 ? 8 : 0.125;
|
double blockRatio = dimension == -1 ? 8 : 0.125;
|
||||||
|
|
||||||
Location fromLocation = new Location(fromWorld.getWorld(), entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
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()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location finalLocation = event.getTo();
|
Location finalLocation = event.getTo();
|
||||||
if(event.useTravelAgent()){
|
if (event.useTravelAgent()) {
|
||||||
finalLocation = pta.findOrCreate(finalLocation);
|
finalLocation = pta.findOrCreate(finalLocation);
|
||||||
}
|
}
|
||||||
toWorld = ((CraftWorld) finalLocation.getWorld()).getHandle();
|
toWorld = ((CraftWorld) finalLocation.getWorld()).getHandle();
|
||||||
this.a(entityplayer, toWorld.dimension, finalLocation);
|
this.moveToWorld(entityplayer, toWorld.dimension, finalLocation);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void flagDirty(int i, int j, int k, int l) {
|
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) {
|
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) {
|
public void sendPacketNearby(double d0, double d1, double d2, double d3, int i, Packet packet) {
|
||||||
this.a((EntityHuman) null, d0, d1, d2, d3, i, 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) {
|
for (int j = 0; j < this.players.size(); ++j) {
|
||||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
|
EntityPlayer entityplayer = (EntityPlayer) this.players.get(j);
|
||||||
|
|
||||||
@ -611,8 +611,8 @@ public class ServerConfigurationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void g(EntityPlayer entityplayer) {
|
public void updateClient(EntityPlayer entityplayer) {
|
||||||
entityplayer.a(entityplayer.defaultContainer);
|
entityplayer.updateInventory(entityplayer.defaultContainer);
|
||||||
entityplayer.B();
|
entityplayer.B();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class Slot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i) {
|
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) {
|
public boolean a(IInventory iinventory, int i) {
|
||||||
|
@ -4,13 +4,6 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
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 {
|
public class ThreadCommandReader extends Thread {
|
||||||
|
|
||||||
final MinecraftServer server;
|
final MinecraftServer server;
|
||||||
@ -20,27 +13,25 @@ public class ThreadCommandReader extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
// CraftBukkit start
|
jline.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit
|
||||||
ConsoleReader bufferedreader = this.server.reader;
|
|
||||||
String s = null;
|
String s = null;
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// CraftBukkit start - JLine disabling compatibility
|
// CraftBukkit start - JLine disabling compatibility
|
||||||
while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
|
while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
|
||||||
if (Main.useJline) {
|
if (org.bukkit.craftbukkit.Main.useJline) {
|
||||||
s = bufferedreader.readLine(">", null);
|
s = bufferedreader.readLine(">", null);
|
||||||
} else {
|
} else {
|
||||||
s = bufferedreader.readLine();
|
s = bufferedreader.readLine();
|
||||||
}
|
}
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
// CraftBukkit end
|
|
||||||
this.server.issueCommand(s, this.server);
|
this.server.issueCommand(s, this.server);
|
||||||
}
|
}
|
||||||
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
} catch (IOException ioexception) {
|
} catch (IOException ioexception) {
|
||||||
// CraftBukkit
|
// 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());
|
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) {
|
if (event.getResult() != PlayerPreLoginEvent.Result.ALLOWED) {
|
||||||
this.netLoginHandler.disconnect(event.getKickMessage());
|
this.netLoginHandler.disconnect(event.getKickMessage());
|
||||||
|
@ -6,7 +6,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
return items;
|
return this.items;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
|||||||
return this.items[i];
|
return this.items[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i, int j) {
|
public ItemStack splitStack(int i, int j) {
|
||||||
if (this.items[i] != null) {
|
if (this.items[i] != null) {
|
||||||
ItemStack itemstack;
|
ItemStack itemstack;
|
||||||
|
|
||||||
@ -94,6 +94,6 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a_(EntityHuman entityhuman) {
|
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
|
// CraftBukkit start
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
return items;
|
return this.items;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
|||||||
return this.items[i];
|
return this.items[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i, int j) {
|
public ItemStack splitStack(int i, int j) {
|
||||||
if (this.items[i] != null) {
|
if (this.items[i] != null) {
|
||||||
ItemStack itemstack;
|
ItemStack itemstack;
|
||||||
|
|
||||||
@ -63,11 +63,11 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack b() {
|
public ItemStack b() {
|
||||||
int i = findDispenseSlot();
|
int i = this.findDispenseSlot();
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
return this.a(i, 1);
|
return this.splitStack(i, 1);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -124,6 +124,6 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a_(EntityHuman entityhuman) {
|
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;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||||
@ -12,13 +10,13 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
|
|
||||||
private ItemStack[] items = new ItemStack[3];
|
private ItemStack[] items = new ItemStack[3];
|
||||||
public int burnTime = 0;
|
public int burnTime = 0;
|
||||||
public int b = 0;
|
public int ticksForCurrentFuel = 0;
|
||||||
public int cookTime = 0;
|
public int cookTime = 0;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
private int lastTick = (int) (System.currentTimeMillis() / 50);
|
private int lastTick = (int) (System.currentTimeMillis() / 50);
|
||||||
public ItemStack[] getContents() {
|
public ItemStack[] getContents() {
|
||||||
return items;
|
return this.items;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -32,7 +30,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
return this.items[i];
|
return this.items[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack a(int i, int j) {
|
public ItemStack splitStack(int i, int j) {
|
||||||
if (this.items[i] != null) {
|
if (this.items[i] != null) {
|
||||||
ItemStack itemstack;
|
ItemStack itemstack;
|
||||||
|
|
||||||
@ -81,7 +79,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
|
|
||||||
this.burnTime = nbttagcompound.d("BurnTime");
|
this.burnTime = nbttagcompound.d("BurnTime");
|
||||||
this.cookTime = nbttagcompound.d("CookTime");
|
this.cookTime = nbttagcompound.d("CookTime");
|
||||||
this.b = this.a(this.items[1]);
|
this.ticksForCurrentFuel = this.fuelTime(this.items[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void b(NBTTagCompound nbttagcompound) {
|
public void b(NBTTagCompound nbttagcompound) {
|
||||||
@ -107,7 +105,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean f() {
|
public boolean isBurning() {
|
||||||
return this.burnTime > 0;
|
return this.burnTime > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,41 +117,38 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
int currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
int currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||||
int elapsedTicks = currentTick - this.lastTick;
|
int elapsedTicks = currentTick - this.lastTick;
|
||||||
this.lastTick = currentTick;
|
this.lastTick = currentTick;
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
if (this.f() && this.h()) {
|
// CraftBukkit - moved from below
|
||||||
// CraftBukkit start -- handle multiple elapsed ticks
|
if (this.isBurning() && this.canBurn()) {
|
||||||
this.cookTime += elapsedTicks;
|
this.cookTime += elapsedTicks;
|
||||||
if (this.cookTime >= 200) {
|
if (this.cookTime >= 200) {
|
||||||
this.cookTime %= 200;
|
this.cookTime %= 200;
|
||||||
// CraftBukkit end
|
this.burn();
|
||||||
this.g();
|
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.cookTime = 0;
|
this.cookTime = 0;
|
||||||
}
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
if (this.burnTime > 0) {
|
if (this.burnTime > 0) {
|
||||||
this.burnTime -= elapsedTicks; // CraftBukkit
|
this.burnTime -= elapsedTicks; // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
// CraftBukkit start -- handle multiple elapsed ticks
|
// CraftBukkit start - handle multiple elapsed ticks
|
||||||
if (this.burnTime <= 0 && this.h() && this.items[1] != null) { // CraftBukkit == to <=
|
if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <=
|
||||||
CraftServer cserver = this.world.getServer();
|
|
||||||
CraftWorld cworld = this.world.getWorld();
|
|
||||||
CraftItemStack fuel = new CraftItemStack(this.items[1]);
|
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]));
|
FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), fuel, this.fuelTime(this.items[1]));
|
||||||
cserver.getPluginManager().callEvent(furnaceBurnEvent);
|
this.world.getServer().getPluginManager().callEvent(furnaceBurnEvent);
|
||||||
|
|
||||||
if (furnaceBurnEvent.isCancelled()) {
|
if (furnaceBurnEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.b = this.a(this.items[1]);
|
this.ticksForCurrentFuel = this.fuelTime(this.items[1]);
|
||||||
this.burnTime += this.b;
|
this.burnTime += this.ticksForCurrentFuel;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
if (this.burnTime > 0) {
|
if (this.burnTime > 0) {
|
||||||
flag1 = true;
|
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) {
|
if (flag != this.burnTime > 0) {
|
||||||
flag1 = true;
|
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) {
|
if (this.items[0] == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} 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
|
// 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() {
|
public void burn() {
|
||||||
if (this.h()) {
|
if (this.canBurn()) {
|
||||||
ItemStack itemstack = FurnaceRecipes.a().a(this.items[0].getItem().id);
|
ItemStack itemstack = FurnaceRecipes.getInstance().a(this.items[0].getItem().id);
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer cserver = this.world.getServer();
|
|
||||||
CraftWorld cworld = this.world.getWorld();
|
|
||||||
CraftItemStack source = new CraftItemStack(this.items[0]);
|
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);
|
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), source, result);
|
||||||
cserver.getPluginManager().callEvent(furnaceSmeltEvent);
|
this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
|
||||||
|
|
||||||
if (furnaceSmeltEvent.isCancelled()) {
|
if (furnaceSmeltEvent.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -208,11 +214,11 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
org.bukkit.inventory.ItemStack oldResult = furnaceSmeltEvent.getResult();
|
org.bukkit.inventory.ItemStack oldResult = furnaceSmeltEvent.getResult();
|
||||||
ItemStack newResult = new ItemStack(oldResult.getTypeId(), oldResult.getAmount(), oldResult.getDurability());
|
ItemStack newResult = new ItemStack(oldResult.getTypeId(), oldResult.getAmount(), oldResult.getDurability());
|
||||||
itemstack = newResult;
|
itemstack = newResult;
|
||||||
// CraftBukkit end
|
|
||||||
if (this.items[2] == null) {
|
if (this.items[2] == null) {
|
||||||
this.items[2] = itemstack;
|
this.items[2] = itemstack.cloneItemStack();
|
||||||
} else if (this.items[2].id == itemstack.id) {
|
} else if (this.items[2].id == itemstack.id) {
|
||||||
// CraftBukkit start - compare damage too
|
// CraftBukkit - compare damage too
|
||||||
if (this.items[2].damage == itemstack.damage) {
|
if (this.items[2].damage == itemstack.damage) {
|
||||||
this.items[2].count += itemstack.count;
|
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) {
|
if (itemstack == null) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@ -237,6 +243,6 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a_(EntityHuman entityhuman) {
|
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;
|
package net.minecraft.server;
|
||||||
|
|
||||||
// CraftBukkit
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
|
||||||
|
|
||||||
public class TileEntityMobSpawner extends TileEntity {
|
public class TileEntityMobSpawner extends TileEntity {
|
||||||
|
|
||||||
@ -19,15 +18,15 @@ public class TileEntityMobSpawner extends TileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean a() {
|
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_() {
|
public void g_() {
|
||||||
this.c = this.b;
|
this.c = this.b;
|
||||||
if (this.a()) {
|
if (this.a()) {
|
||||||
double d0 = (double) ((float) this.e + this.world.random.nextFloat());
|
double d0 = (double) ((float) this.x + this.world.random.nextFloat());
|
||||||
double d1 = (double) ((float) this.f + this.world.random.nextFloat());
|
double d1 = (double) ((float) this.y + this.world.random.nextFloat());
|
||||||
double d2 = (double) ((float) this.g + 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("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||||
this.world.a("flame", 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
|
// 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) {
|
if (j >= 6) {
|
||||||
this.c();
|
this.c();
|
||||||
@ -67,9 +66,9 @@ public class TileEntityMobSpawner extends TileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (entityliving != null) {
|
if (entityliving != null) {
|
||||||
double d3 = (double) this.e + (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.f + this.world.random.nextInt(3) - 1);
|
double d4 = (double) (this.y + this.world.random.nextInt(3) - 1);
|
||||||
double d5 = (double) this.g + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
|
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);
|
entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
|
||||||
if (entityliving.d()) {
|
if (entityliving.d()) {
|
||||||
@ -77,9 +76,9 @@ public class TileEntityMobSpawner extends TileEntity {
|
|||||||
this.world.addEntity(entityliving, SpawnReason.SPAWNER);
|
this.world.addEntity(entityliving, SpawnReason.SPAWNER);
|
||||||
|
|
||||||
for (int k = 0; k < 20; ++k) {
|
for (int k = 0; k < 20; ++k) {
|
||||||
d0 = (double) this.e + 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.f + 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.g + 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("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||||
this.world.a("flame", 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 String[] lines = new String[] { "", "", "", ""};
|
||||||
public int b = -1;
|
public int b = -1;
|
||||||
private boolean c = true;
|
private boolean isEditable = true;
|
||||||
|
|
||||||
public TileEntitySign() {}
|
public TileEntitySign() {}
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class TileEntitySign extends TileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(NBTTagCompound nbttagcompound) {
|
public void a(NBTTagCompound nbttagcompound) {
|
||||||
this.c = false;
|
this.isEditable = false;
|
||||||
super.a(nbttagcompound);
|
super.a(nbttagcompound);
|
||||||
|
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
@ -41,16 +41,16 @@ public class TileEntitySign extends TileEntity {
|
|||||||
// CraftBukkit end
|
// 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() {
|
public boolean a() {
|
||||||
return this.c;
|
return this.isEditable;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public void setEditable(boolean editable) {
|
public void setEditable(boolean editable) {
|
||||||
this.c = editable;
|
this.isEditable = editable;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import java.util.TreeSet;
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World.Environment;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
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.WeatherChangeEvent;
|
||||||
import org.bukkit.event.weather.ThunderChangeEvent;
|
import org.bukkit.event.weather.ThunderChangeEvent;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class World implements IBlockAccess {
|
public class World implements IBlockAccess {
|
||||||
@ -50,7 +48,7 @@ public class World implements IBlockAccess {
|
|||||||
protected float l;
|
protected float l;
|
||||||
protected int m = 0;
|
protected int m = 0;
|
||||||
public int n = 0;
|
public int n = 0;
|
||||||
public boolean o = false;
|
public boolean suppressPhysics = false;
|
||||||
private long H = System.currentTimeMillis();
|
private long H = System.currentTimeMillis();
|
||||||
protected int p = 40;
|
protected int p = 40;
|
||||||
public int spawnMonsters;
|
public int spawnMonsters;
|
||||||
@ -63,7 +61,7 @@ public class World implements IBlockAccess {
|
|||||||
public WorldData worldData; // CraftBukkit - protected -> public
|
public WorldData worldData; // CraftBukkit - protected -> public
|
||||||
public boolean isLoading;
|
public boolean isLoading;
|
||||||
private boolean I;
|
private boolean I;
|
||||||
public WorldMapCollection z;
|
public WorldMapCollection worldMaps;
|
||||||
private ArrayList J = new ArrayList();
|
private ArrayList J = new ArrayList();
|
||||||
private int K = 0;
|
private int K = 0;
|
||||||
public boolean allowMonsters = true; // CraftBukkit - private -> public
|
public boolean allowMonsters = true; // CraftBukkit - private -> public
|
||||||
@ -88,40 +86,40 @@ public class World implements IBlockAccess {
|
|||||||
final Object chunkLock = new Object();
|
final Object chunkLock = new Object();
|
||||||
|
|
||||||
private boolean canSpawn(int x, int z) {
|
private boolean canSpawn(int x, int z) {
|
||||||
if (generator != null) {
|
if (this.generator != null) {
|
||||||
return this.generator.canSpawn(((WorldServer) this).getWorld(), x, z);
|
return this.generator.canSpawn(this.getWorld(), x, z);
|
||||||
} else {
|
} else {
|
||||||
return this.worldProvider.a(x, z);
|
return this.worldProvider.canSpawn(x, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CraftWorld getWorld() {
|
public CraftWorld getWorld() {
|
||||||
return world;
|
return this.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CraftServer getServer() {
|
public CraftServer getServer() {
|
||||||
return (CraftServer)Bukkit.getServer();
|
return (CraftServer) Bukkit.getServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit - changed signature
|
// 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.generator = gen;
|
||||||
this.world = new CraftWorld((WorldServer)this, gen, env);
|
this.world = new CraftWorld((WorldServer) this, gen, env);
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.O = this.random.nextInt(12000);
|
this.O = this.random.nextInt(12000);
|
||||||
this.P = new ArrayList();
|
this.P = new ArrayList();
|
||||||
this.isStatic = false;
|
this.isStatic = false;
|
||||||
this.w = idatamanager;
|
this.w = idatamanager;
|
||||||
this.z = new WorldMapCollection(idatamanager);
|
this.worldMaps = new WorldMapCollection(idatamanager);
|
||||||
this.worldData = idatamanager.c();
|
this.worldData = idatamanager.c();
|
||||||
this.s = this.worldData == null;
|
this.s = this.worldData == null;
|
||||||
if (worldprovider != null) {
|
if (worldprovider != null) {
|
||||||
this.worldProvider = worldprovider;
|
this.worldProvider = worldprovider;
|
||||||
} else if (this.worldData != null && this.worldData.h() == -1) {
|
} else if (this.worldData != null && this.worldData.h() == -1) {
|
||||||
this.worldProvider = WorldProvider.a(-1);
|
this.worldProvider = WorldProvider.byDimension(-1);
|
||||||
} else {
|
} else {
|
||||||
this.worldProvider = WorldProvider.a(0);
|
this.worldProvider = WorldProvider.byDimension(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
@ -142,13 +140,13 @@ public class World implements IBlockAccess {
|
|||||||
this.g();
|
this.g();
|
||||||
this.x();
|
this.x();
|
||||||
|
|
||||||
getServer().addWorld(world);// Craftbukkit
|
this.getServer().addWorld(this.world); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IChunkProvider b() {
|
protected IChunkProvider b() {
|
||||||
IChunkLoader ichunkloader = this.w.a(this.worldProvider);
|
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() {
|
protected void c() {
|
||||||
@ -159,22 +157,22 @@ public class World implements IBlockAccess {
|
|||||||
int j;
|
int j;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (generator != null) {
|
if (this.generator != null) {
|
||||||
Random rand = new Random(getSeed());
|
Random rand = new Random(this.getSeed());
|
||||||
Location spawn = generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
|
Location spawn = this.generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
|
||||||
|
|
||||||
if (spawn != null) {
|
if (spawn != null) {
|
||||||
if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
|
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 {
|
} else {
|
||||||
worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
|
this.worldData.setSpawn(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
|
||||||
isLoading = false;
|
this.isLoading = false;
|
||||||
return;
|
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);
|
i += this.random.nextInt(64) - this.random.nextInt(64);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -194,7 +192,7 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void save(boolean flag, IProgressUpdate iprogressupdate) {
|
public void save(boolean flag, IProgressUpdate iprogressupdate) {
|
||||||
if (this.chunkProvider.b()) {
|
if (this.chunkProvider.canSave()) {
|
||||||
if (iprogressupdate != null) {
|
if (iprogressupdate != null) {
|
||||||
iprogressupdate.a("Saving level");
|
iprogressupdate.a("Saving level");
|
||||||
}
|
}
|
||||||
@ -211,7 +209,7 @@ public class World implements IBlockAccess {
|
|||||||
private void w() {
|
private void w() {
|
||||||
this.k();
|
this.k();
|
||||||
this.w.a(this.worldData, this.players);
|
this.w.a(this.worldData, this.players);
|
||||||
this.z.a();
|
this.worldMaps.a();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTypeId(int i, int j, int k) {
|
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;
|
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);
|
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);
|
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);
|
return this.getChunkAt(i >> 4, j >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public Chunk getChunkAt(int i, int j) {
|
public Chunk getChunkAt(int i, int j) {
|
||||||
Chunk result = null;
|
Chunk result = null;
|
||||||
synchronized (chunkLock) {
|
synchronized (this.chunkLock) {
|
||||||
if (lastChunkAccessed == null || lastXAccessed != i || lastZAccessed != j) {
|
if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) {
|
||||||
lastXAccessed = i;
|
this.lastXAccessed = i;
|
||||||
lastZAccessed = j;
|
this.lastZAccessed = j;
|
||||||
lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j);
|
this.lastChunkAccessed = this.chunkProvider.getOrCreateChunk(i, j);
|
||||||
}
|
}
|
||||||
result = lastChunkAccessed;
|
result = this.lastChunkAccessed;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -431,7 +429,7 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void k(int i, int j, int k, int l) {
|
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)];
|
Block block = Block.byId[this.getTypeId(i, j, k)];
|
||||||
|
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
@ -439,7 +437,7 @@ public class World implements IBlockAccess {
|
|||||||
CraftWorld world = ((WorldServer) this).getWorld();
|
CraftWorld world = ((WorldServer) this).getWorld();
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
|
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l);
|
||||||
getServer().getPluginManager().callEvent(event);
|
this.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
@ -820,14 +818,14 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean a(Entity entity) {
|
public boolean strikeLightning(Entity entity) {
|
||||||
this.e.add(entity);
|
this.e.add(entity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start - used for entities other than creatures
|
// CraftBukkit start - used for entities other than creatures
|
||||||
public boolean addEntity(Entity entity) {
|
public boolean addEntity(Entity entity) {
|
||||||
return 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) {
|
public int e(int i, int j) {
|
||||||
Chunk chunk = this.b(i, j);
|
Chunk chunk = this.getChunkAtWorldCoords(i, j);
|
||||||
int k = 127;
|
int k = 127;
|
||||||
|
|
||||||
i &= 15;
|
i &= 15;
|
||||||
@ -1007,7 +1005,7 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int f(int i, int j) {
|
public int f(int i, int j) {
|
||||||
Chunk chunk = this.b(i, j);
|
Chunk chunk = this.getChunkAtWorldCoords(i, j);
|
||||||
int k = 127;
|
int k = 127;
|
||||||
|
|
||||||
i &= 15;
|
i &= 15;
|
||||||
@ -1438,7 +1436,7 @@ public class World implements IBlockAccess {
|
|||||||
return (float) i / (float) j;
|
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) {
|
if (l == 0) {
|
||||||
--j;
|
--j;
|
||||||
}
|
}
|
||||||
@ -1553,7 +1551,7 @@ public class World implements IBlockAccess {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.b(k1, l1).g()) {
|
if (this.getChunkAtWorldCoords(k1, l1).isEmpty()) {
|
||||||
return;
|
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
|
// 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);
|
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -1646,9 +1644,9 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void x() {
|
private void x() {
|
||||||
if (this.worldData.l()) {
|
if (this.worldData.hasStorm()) {
|
||||||
this.j = 1.0F;
|
this.j = 1.0F;
|
||||||
if (this.worldData.j()) {
|
if (this.worldData.isThundering()) {
|
||||||
this.l = 1.0F;
|
this.l = 1.0F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1660,56 +1658,53 @@ public class World implements IBlockAccess {
|
|||||||
--this.m;
|
--this.m;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = this.worldData.k();
|
int i = this.worldData.getThunderDuration();
|
||||||
|
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
if (this.worldData.j()) {
|
if (this.worldData.isThundering()) {
|
||||||
this.worldData.b(this.random.nextInt(12000) + 3600);
|
this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600);
|
||||||
} else {
|
} else {
|
||||||
this.worldData.b(this.random.nextInt(168000) + 12000);
|
this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
--i;
|
--i;
|
||||||
this.worldData.b(i);
|
this.worldData.setThunderDuration(i);
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftServer server = getServer();
|
ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering());
|
||||||
|
this.getServer().getPluginManager().callEvent(thunder);
|
||||||
ThunderChangeEvent thunder = new ThunderChangeEvent(((WorldServer) this).getWorld(), !this.worldData.j());
|
|
||||||
server.getPluginManager().callEvent(thunder);
|
|
||||||
if (!thunder.isCancelled()) {
|
if (!thunder.isCancelled()) {
|
||||||
this.worldData.a(!this.worldData.j());
|
this.worldData.setThundering(!this.worldData.isThundering());
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int j = this.worldData.m();
|
int j = this.worldData.getWeatherDuration();
|
||||||
|
|
||||||
if (j <= 0) {
|
if (j <= 0) {
|
||||||
if (this.worldData.l()) {
|
if (this.worldData.hasStorm()) {
|
||||||
this.worldData.c(this.random.nextInt(12000) + 12000);
|
this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000);
|
||||||
} else {
|
} else {
|
||||||
this.worldData.c(this.random.nextInt(168000) + 12000);
|
this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
--j;
|
--j;
|
||||||
this.worldData.c(j);
|
this.worldData.setWeatherDuration(j);
|
||||||
if (j <= 0) {
|
if (j <= 0) {
|
||||||
// CraftBukkit start
|
// 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()) {
|
if (!weather.isCancelled()) {
|
||||||
this.worldData.b(!this.worldData.l());
|
this.worldData.setStorm(!this.worldData.hasStorm());
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.i = this.j;
|
this.i = this.j;
|
||||||
if (this.worldData.l()) {
|
if (this.worldData.hasStorm()) {
|
||||||
this.j = (float) ((double) this.j + 0.01D);
|
this.j = (float) ((double) this.j + 0.01D);
|
||||||
} else {
|
} else {
|
||||||
this.j = (float) ((double) this.j - 0.01D);
|
this.j = (float) ((double) this.j - 0.01D);
|
||||||
@ -1724,7 +1719,7 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.k = this.l;
|
this.k = this.l;
|
||||||
if (this.worldData.j()) {
|
if (this.worldData.isThundering()) {
|
||||||
this.l = (float) ((double) this.l + 0.01D);
|
this.l = (float) ((double) this.l + 0.01D);
|
||||||
} else {
|
} else {
|
||||||
this.l = (float) ((double) this.l - 0.01D);
|
this.l = (float) ((double) this.l - 0.01D);
|
||||||
@ -1742,20 +1737,18 @@ public class World implements IBlockAccess {
|
|||||||
|
|
||||||
private void y() {
|
private void y() {
|
||||||
// CraftBukkit start
|
// 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);
|
ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), false);
|
||||||
server.getPluginManager().callEvent(weather);
|
this.getServer().getPluginManager().callEvent(thunder);
|
||||||
|
|
||||||
ThunderChangeEvent thunder = new ThunderChangeEvent(((WorldServer) this).getWorld(), false);
|
|
||||||
server.getPluginManager().callEvent(thunder);
|
|
||||||
if (!weather.isCancelled()) {
|
if (!weather.isCancelled()) {
|
||||||
this.worldData.c(0);
|
this.worldData.setWeatherDuration(0);
|
||||||
this.worldData.b(false);
|
this.worldData.setStorm(false);
|
||||||
}
|
}
|
||||||
if (!thunder.isCancelled()) {
|
if (!thunder.isCancelled()) {
|
||||||
this.worldData.b(0);
|
this.worldData.setThunderDuration(0);
|
||||||
this.worldData.a(false);
|
this.worldData.setThundering(false);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
@ -1824,7 +1817,7 @@ public class World implements IBlockAccess {
|
|||||||
j1 = j + (k >> 8 & 15);
|
j1 = j + (k >> 8 & 15);
|
||||||
k1 = this.e(l, j1);
|
k1 = this.e(l, j1);
|
||||||
if (this.s(l, k1, 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;
|
this.m = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1844,7 +1837,7 @@ public class World implements IBlockAccess {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
SnowFormEvent snow = new SnowFormEvent(this.getWorld().getBlockAt(l + i, k1, j1 + j));
|
SnowFormEvent snow = new SnowFormEvent(this.getWorld().getBlockAt(l + i, k1, j1 + j));
|
||||||
|
|
||||||
getServer().getPluginManager().callEvent(snow);
|
this.getServer().getPluginManager().callEvent(snow);
|
||||||
if (!snow.isCancelled()) {
|
if (!snow.isCancelled()) {
|
||||||
this.setTypeId(l + i, k1, j1 + j, snow.getMaterial().getId());
|
this.setTypeId(l + i, k1, j1 + j, snow.getMaterial().getId());
|
||||||
this.setData(l + i, k1, j1 + j, snow.getData());
|
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 blockState = this.getWorld().getBlockAt(l + i, k1 - 1, j1 + j).getState();
|
||||||
blockState.setTypeId(Block.ICE.id);
|
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);
|
this.getServer().getPluginManager().callEvent(iceBlockForm);
|
||||||
if (!iceBlockForm.isCancelled()) {
|
if (!iceBlockForm.isCancelled()) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
@ -1953,7 +1946,7 @@ public class World implements IBlockAccess {
|
|||||||
|
|
||||||
public void b(int i, int j, int k, TileEntity tileentity) {
|
public void b(int i, int j, int k, TileEntity tileentity) {
|
||||||
if (this.isLoaded(i, j, k)) {
|
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) {
|
for (int l = 0; l < this.u.size(); ++l) {
|
||||||
@ -2018,8 +2011,8 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
BlockCanBuildEvent event = new BlockCanBuildEvent(((WorldServer) this).getWorld().getBlockAt(j, k, l), i, defaultReturn);
|
BlockCanBuildEvent event = new BlockCanBuildEvent(this.getWorld().getBlockAt(j, k, l), i, defaultReturn);
|
||||||
getServer().getPluginManager().callEvent(event);
|
this.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
return event.isBuildable();
|
return event.isBuildable();
|
||||||
// CraftBukkit end
|
// 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)))));
|
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);
|
return this.a(entity.locX, entity.locY, entity.locZ, d0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2117,7 +2110,7 @@ public class World implements IBlockAccess {
|
|||||||
return null;
|
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];
|
byte[] abyte = new byte[l * i1 * j1 * 5 / 2];
|
||||||
int k1 = i >> 4;
|
int k1 = i >> 4;
|
||||||
int l1 = k >> 4;
|
int l1 = k >> 4;
|
||||||
@ -2159,7 +2152,7 @@ public class World implements IBlockAccess {
|
|||||||
k4 = 16;
|
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() {
|
public long getSeed() {
|
||||||
return this.worldData.b();
|
return this.worldData.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTime() {
|
public long getTime() {
|
||||||
@ -2196,7 +2189,7 @@ public class World implements IBlockAccess {
|
|||||||
return this.chunkProvider;
|
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);
|
int j1 = this.getTypeId(i, j, k);
|
||||||
|
|
||||||
if (j1 > 0) {
|
if (j1 > 0) {
|
||||||
@ -2231,8 +2224,8 @@ public class World implements IBlockAccess {
|
|||||||
// Calls the method that checks to see if players are sleeping
|
// Calls the method that checks to see if players are sleeping
|
||||||
// Called by CraftPlayer.setPermanentSleeping()
|
// Called by CraftPlayer.setPermanentSleeping()
|
||||||
public void checkSleepStatus() {
|
public void checkSleepStatus() {
|
||||||
if (!isStatic) {
|
if (!this.isStatic) {
|
||||||
everyoneSleeping();
|
this.everyoneSleeping();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -2312,15 +2305,15 @@ public class World implements IBlockAccess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void a(String s, WorldMapBase worldmapbase) {
|
public void a(String s, WorldMapBase worldmapbase) {
|
||||||
this.z.a(s, worldmapbase);
|
this.worldMaps.a(s, worldmapbase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldMapBase a(Class oclass, String s) {
|
public WorldMapBase a(Class oclass, String s) {
|
||||||
return this.z.a(oclass, s);
|
return this.worldMaps.a(oclass, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int b(String 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) {
|
public void e(int i, int j, int k, int l, int i1) {
|
||||||
|
@ -21,13 +21,13 @@ public class WorldData {
|
|||||||
private int o;
|
private int o;
|
||||||
|
|
||||||
public WorldData(NBTTagCompound nbttagcompound) {
|
public WorldData(NBTTagCompound nbttagcompound) {
|
||||||
this.a = nbttagcompound.f("RandomSeed");
|
this.a = nbttagcompound.getLong("RandomSeed");
|
||||||
this.b = nbttagcompound.e("SpawnX");
|
this.b = nbttagcompound.e("SpawnX");
|
||||||
this.c = nbttagcompound.e("SpawnY");
|
this.c = nbttagcompound.e("SpawnY");
|
||||||
this.d = nbttagcompound.e("SpawnZ");
|
this.d = nbttagcompound.e("SpawnZ");
|
||||||
this.e = nbttagcompound.f("Time");
|
this.e = nbttagcompound.getLong("Time");
|
||||||
this.f = nbttagcompound.f("LastPlayed");
|
this.f = nbttagcompound.getLong("LastPlayed");
|
||||||
this.g = nbttagcompound.f("SizeOnDisk");
|
this.g = nbttagcompound.getLong("SizeOnDisk");
|
||||||
this.name = nbttagcompound.getString("LevelName");
|
this.name = nbttagcompound.getString("LevelName");
|
||||||
this.k = nbttagcompound.e("version");
|
this.k = nbttagcompound.e("version");
|
||||||
this.m = nbttagcompound.e("rainTime");
|
this.m = nbttagcompound.e("rainTime");
|
||||||
@ -89,13 +89,13 @@ public class WorldData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
|
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
|
||||||
nbttagcompound.a("RandomSeed", this.a);
|
nbttagcompound.setLong("RandomSeed", this.a);
|
||||||
nbttagcompound.a("SpawnX", this.b);
|
nbttagcompound.a("SpawnX", this.b);
|
||||||
nbttagcompound.a("SpawnY", this.c);
|
nbttagcompound.a("SpawnY", this.c);
|
||||||
nbttagcompound.a("SpawnZ", this.d);
|
nbttagcompound.a("SpawnZ", this.d);
|
||||||
nbttagcompound.a("Time", this.e);
|
nbttagcompound.setLong("Time", this.e);
|
||||||
nbttagcompound.a("SizeOnDisk", this.g);
|
nbttagcompound.setLong("SizeOnDisk", this.g);
|
||||||
nbttagcompound.a("LastPlayed", System.currentTimeMillis());
|
nbttagcompound.setLong("LastPlayed", System.currentTimeMillis());
|
||||||
nbttagcompound.setString("LevelName", this.name);
|
nbttagcompound.setString("LevelName", this.name);
|
||||||
nbttagcompound.a("version", this.k);
|
nbttagcompound.a("version", this.k);
|
||||||
nbttagcompound.a("rainTime", this.m);
|
nbttagcompound.a("rainTime", this.m);
|
||||||
@ -107,7 +107,7 @@ public class WorldData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long b() {
|
public long getSeed() {
|
||||||
return this.a;
|
return this.a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,35 +161,35 @@ public class WorldData {
|
|||||||
this.k = i;
|
this.k = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean j() {
|
public boolean isThundering() {
|
||||||
return this.n;
|
return this.n;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void a(boolean flag) {
|
public void setThundering(boolean flag) {
|
||||||
this.n = flag;
|
this.n = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int k() {
|
public int getThunderDuration() {
|
||||||
return this.o;
|
return this.o;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void b(int i) {
|
public void setThunderDuration(int i) {
|
||||||
this.o = i;
|
this.o = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean l() {
|
public boolean hasStorm() {
|
||||||
return this.l;
|
return this.l;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void b(boolean flag) {
|
public void setStorm(boolean flag) {
|
||||||
this.l = flag;
|
this.l = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int m() {
|
public int getWeatherDuration() {
|
||||||
return this.m;
|
return this.m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void c(int i) {
|
public void setWeatherDuration(int i) {
|
||||||
this.m = i;
|
this.m = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
In neuem Issue referenzieren
Einen Benutzer sperren