geforkt von Mirrors/Paper
Generic cleanup/reformat.
Dieser Commit ist enthalten in:
Ursprung
001a45804e
Commit
04be2b9b31
@ -69,14 +69,14 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
|
||||||
LivingEntity who = (entityhuman == null)?null:(LivingEntity)entityhuman.getBukkitEntity();
|
LivingEntity who = (entityhuman == null)?null:(LivingEntity)entityhuman.getBukkitEntity();
|
||||||
|
|
||||||
BlockInteractEvent bie = new BlockInteractEvent(eventType, block, who);
|
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
|
||||||
server.getPluginManager().callEvent(bie);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (bie.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
|
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
|
||||||
|
|
||||||
entityhuman.a(tileentitydispenser);
|
entityhuman.a(tileentitydispenser);
|
||||||
@ -196,4 +196,4 @@ public class BlockDispenser extends BlockContainer {
|
|||||||
world.c(i, j, k, 4);
|
world.c(i, j, k, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public class BlockFire extends Block {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Craftbukkit start - won't be needed next port hopefully
|
// Craftbukkit start - won't be needed next port hopefully
|
||||||
if(l == 15) {
|
if(l == 15) {
|
||||||
this.a(world, i + 1, j, k, 1, random);
|
this.a(world, i + 1, j, k, 1, random);
|
||||||
@ -131,13 +131,13 @@ public class BlockFire extends Block {
|
|||||||
|
|
||||||
if (random.nextInt(l) < i1) {
|
if (random.nextInt(l) < i1) {
|
||||||
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
|
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
|
||||||
// CraftBukkit start: BlockBurnEvent
|
// CraftBukkit start
|
||||||
Server server = ((WorldServer)world).getServer();
|
Server server = ((WorldServer)world).getServer();
|
||||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||||
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k));
|
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k));
|
||||||
BlockBurnEvent burnEvent = new BlockBurnEvent(theBlock);
|
BlockBurnEvent event = new BlockBurnEvent(theBlock);
|
||||||
server.getPluginManager().callEvent(burnEvent);
|
server.getPluginManager().callEvent(event);
|
||||||
if(!burnEvent.isCancelled()) {
|
if(!event.isCancelled()) {
|
||||||
if (random.nextInt(2) == 0) {
|
if (random.nextInt(2) == 0) {
|
||||||
world.e(i, j, k, this.id);
|
world.e(i, j, k, this.id);
|
||||||
} else {
|
} else {
|
||||||
@ -148,7 +148,7 @@ public class BlockFire extends Block {
|
|||||||
Block.TNT.a(world, i, j, k, 0);
|
Block.TNT.a(world, i, j, k, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end: BlockBurnEvent
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
public void f(Entity entity) {
|
public void f(Entity entity) {
|
||||||
// Craftbukkit start
|
// Craftbukkit start
|
||||||
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||||
|
|
||||||
for (int i = 0; i < inventory.a.length; ++i) {
|
for (int i = 0; i < inventory.a.length; ++i) {
|
||||||
if (inventory.a[i] != null) {
|
if (inventory.a[i] != null) {
|
||||||
loot.add(new CraftItemStack(inventory.a[i]));
|
loot.add(new CraftItemStack(inventory.a[i]));
|
||||||
|
@ -65,7 +65,7 @@ public class ItemBlock extends Item {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
/* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself,
|
/* We store the old data so we can undo it. Snow(78) and half-steps(44) are special in that they replace the block itself,
|
||||||
* rather than the block touching the face we clicked on.
|
* rather than the block touching the face we clicked on.
|
||||||
*/
|
*/
|
||||||
org.bukkit.block.Block replacedBlock = (blockClicked.getTypeId() == Block.SNOW.id || blockClicked.getTypeId() == Block.STEP.id) ? blockClicked:blockClicked.getFace(faceClicked);
|
org.bukkit.block.Block replacedBlock = (blockClicked.getTypeId() == Block.SNOW.id || blockClicked.getTypeId() == Block.STEP.id) ? blockClicked:blockClicked.getFace(faceClicked);
|
||||||
|
@ -29,7 +29,7 @@ public class ItemSign extends Item {
|
|||||||
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
CraftWorld craftWorld = ((WorldServer) world).getWorld();
|
||||||
CraftServer craftServer = ((WorldServer) world).getServer();
|
CraftServer craftServer = ((WorldServer) world).getServer();
|
||||||
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
org.bukkit.block.Block blockClicked = craftWorld.getBlockAt(i, j, k);
|
||||||
//CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (l == 1) {
|
if (l == 1) {
|
||||||
++j;
|
++j;
|
||||||
|
@ -167,7 +167,7 @@ public class MinecraftServer implements ICommandListener, Runnable {
|
|||||||
if(server != null) {
|
if(server != null) {
|
||||||
server.disablePlugins();
|
server.disablePlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.f != null) {
|
if (this.f != null) {
|
||||||
this.f.d();
|
this.f.d();
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
Player who = (this.e == null) ? null : (Player) this.e.getBukkitEntity();
|
Player who = (this.e == null) ? null : (Player) this.e.getBukkitEntity();
|
||||||
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
org.bukkit.inventory.ItemStack itemInHand = new CraftItemStack(itemstack);
|
||||||
|
|
||||||
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
PlayerItemEvent event = new PlayerItemEvent(eventType, who, itemInHand, blockClicked, blockFace);
|
||||||
|
|
||||||
// CraftBukkit We still call this event even in spawn protection.
|
// CraftBukkit We still call this event even in spawn protection.
|
||||||
// Don't call this event if using Buckets / signs
|
// Don't call this event if using Buckets / signs
|
||||||
|
@ -2,9 +2,9 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
//CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.BlockChangeDelegate;
|
import org.bukkit.BlockChangeDelegate;
|
||||||
//CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class WorldGenBigTree extends WorldGenerator {
|
public class WorldGenBigTree extends WorldGenerator {
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ public class WorldGenBigTree extends WorldGenerator {
|
|||||||
// then allows plugins to catch manually-invoked generation events
|
// then allows plugins to catch manually-invoked generation events
|
||||||
return generate((BlockChangeDelegate)world, random, i, j, k);
|
return generate((BlockChangeDelegate)world, random, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.c = world;
|
this.c = world;
|
||||||
|
@ -2,9 +2,9 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
//CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.BlockChangeDelegate;
|
import org.bukkit.BlockChangeDelegate;
|
||||||
//CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class WorldGenForest extends WorldGenerator {
|
public class WorldGenForest extends WorldGenerator {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class WorldGenForest extends WorldGenerator {
|
|||||||
// then allows plugins to catch manually-invoked generation events
|
// then allows plugins to catch manually-invoked generation events
|
||||||
return generate((BlockChangeDelegate)world, random, i, j, k);
|
return generate((BlockChangeDelegate)world, random, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
int l = random.nextInt(3) + 5;
|
int l = random.nextInt(3) + 5;
|
||||||
|
@ -2,9 +2,9 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
//CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.BlockChangeDelegate;
|
import org.bukkit.BlockChangeDelegate;
|
||||||
//CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class WorldGenTaiga1 extends WorldGenerator {
|
public class WorldGenTaiga1 extends WorldGenerator {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class WorldGenTaiga1 extends WorldGenerator {
|
|||||||
// then allows plugins to catch manually-invoked generation events
|
// then allows plugins to catch manually-invoked generation events
|
||||||
return generate((BlockChangeDelegate)world, random, i, j, k);
|
return generate((BlockChangeDelegate)world, random, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
int l = random.nextInt(5) + 7;
|
int l = random.nextInt(5) + 7;
|
||||||
|
@ -2,9 +2,9 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
//CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.BlockChangeDelegate;
|
import org.bukkit.BlockChangeDelegate;
|
||||||
//CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class WorldGenTaiga2 extends WorldGenerator {
|
public class WorldGenTaiga2 extends WorldGenerator {
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class WorldGenTaiga2 extends WorldGenerator {
|
|||||||
// then allows plugins to catch manually-invoked generation events
|
// then allows plugins to catch manually-invoked generation events
|
||||||
return generate((BlockChangeDelegate)world, random, i, j, k);
|
return generate((BlockChangeDelegate)world, random, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
int l = random.nextInt(4) + 6;
|
int l = random.nextInt(4) + 6;
|
||||||
|
@ -24,7 +24,7 @@ import org.bukkit.World;
|
|||||||
|
|
||||||
public class CraftWorld implements World {
|
public class CraftWorld implements World {
|
||||||
private final WorldServer world;
|
private final WorldServer world;
|
||||||
|
|
||||||
private static final Random rand = new Random();
|
private static final Random rand = new Random();
|
||||||
|
|
||||||
public CraftWorld(WorldServer world) {
|
public CraftWorld(WorldServer world) {
|
||||||
@ -42,7 +42,7 @@ public class CraftWorld implements World {
|
|||||||
public int getHighestBlockYAt(int x, int z) {
|
public int getHighestBlockYAt(int x, int z) {
|
||||||
return world.d(x, z);
|
return world.d(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getSpawnLocation() {
|
public Location getSpawnLocation() {
|
||||||
return new Location(this, world.spawnX, world.e(world.spawnX, world.spawnZ), world.spawnZ);
|
return new Location(this, world.spawnX, world.e(world.spawnX, world.spawnZ), world.spawnZ);
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ public class CraftWorld implements World {
|
|||||||
// However, this entity is not at the moment backed by a server entity class so it may be left.
|
// However, this entity is not at the moment backed by a server entity class so it may be left.
|
||||||
return new CraftItemDrop(world.getServer(), entity);
|
return new CraftItemDrop(world.getServer(), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemDrop dropItemNaturally(Location loc, ItemStack item) {
|
public ItemDrop dropItemNaturally(Location loc, ItemStack item) {
|
||||||
double xs = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
double xs = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
||||||
double ys = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
double ys = world.l.nextFloat() * 0.7F + (1.0F - 0.7F) * 0.5D;
|
||||||
@ -108,7 +108,7 @@ public class CraftWorld implements World {
|
|||||||
arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
|
arrow.a(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
|
||||||
return (Arrow) arrow.getBukkitEntity();
|
return (Arrow) arrow.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Minecart spawnMinecart(Location loc) {
|
public Minecart spawnMinecart(Location loc) {
|
||||||
EntityMinecart minecart = new EntityMinecart(
|
EntityMinecart minecart = new EntityMinecart(
|
||||||
world,
|
world,
|
||||||
@ -120,7 +120,7 @@ public class CraftWorld implements World {
|
|||||||
world.a(minecart);
|
world.a(minecart);
|
||||||
return (Minecart) minecart.getBukkitEntity();
|
return (Minecart) minecart.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public StorageMinecart spawnStorageMinecart(Location loc) {
|
public StorageMinecart spawnStorageMinecart(Location loc) {
|
||||||
EntityMinecart minecart = new EntityMinecart(
|
EntityMinecart minecart = new EntityMinecart(
|
||||||
world,
|
world,
|
||||||
@ -132,7 +132,7 @@ public class CraftWorld implements World {
|
|||||||
world.a(minecart);
|
world.a(minecart);
|
||||||
return (StorageMinecart) minecart.getBukkitEntity();
|
return (StorageMinecart) minecart.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PoweredMinecart spawnPoweredMinecart(Location loc) {
|
public PoweredMinecart spawnPoweredMinecart(Location loc) {
|
||||||
EntityMinecart minecart = new EntityMinecart(
|
EntityMinecart minecart = new EntityMinecart(
|
||||||
world,
|
world,
|
||||||
@ -144,13 +144,13 @@ public class CraftWorld implements World {
|
|||||||
world.a(minecart);
|
world.a(minecart);
|
||||||
return (PoweredMinecart) minecart.getBukkitEntity();
|
return (PoweredMinecart) minecart.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boat spawnBoat(Location loc) {
|
public Boat spawnBoat(Location loc) {
|
||||||
EntityBoat boat = new EntityBoat(world, loc.getX(), loc.getY(), loc.getZ());
|
EntityBoat boat = new EntityBoat(world, loc.getX(), loc.getY(), loc.getZ());
|
||||||
world.a(boat);
|
world.a(boat);
|
||||||
return (Boat) boat.getBukkitEntity();
|
return (Boat) boat.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean generateTree(Location loc, TreeType type) {
|
public boolean generateTree(Location loc, TreeType type) {
|
||||||
return generateTree(loc, type, world);
|
return generateTree(loc, type, world);
|
||||||
}
|
}
|
||||||
@ -158,29 +158,19 @@ public class CraftWorld implements World {
|
|||||||
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
|
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case BIG_TREE:
|
case BIG_TREE:
|
||||||
return (new WorldGenBigTree())
|
return new WorldGenBigTree().generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
.generate(delegate, rand,
|
|
||||||
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
|
||||||
case BIRCH:
|
case BIRCH:
|
||||||
return (new WorldGenForest())
|
return new WorldGenForest().generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
.generate(delegate, rand,
|
|
||||||
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
|
||||||
case REDWOOD:
|
case REDWOOD:
|
||||||
return (new WorldGenTaiga2())
|
return new WorldGenTaiga2().generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
.generate(delegate, rand,
|
|
||||||
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
|
||||||
case TALL_REDWOOD:
|
case TALL_REDWOOD:
|
||||||
return (new WorldGenTaiga1())
|
return new WorldGenTaiga1().generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
.generate(delegate, rand,
|
|
||||||
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
|
||||||
case TREE:
|
case TREE:
|
||||||
default:
|
default:
|
||||||
return (new WorldGenTrees())
|
return new WorldGenTrees().generate(delegate, rand, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
.generate(delegate, rand,
|
|
||||||
loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntity getTileEntityAt(final int x, final int y, final int z) {
|
public TileEntity getTileEntityAt(final int x, final int y, final int z) {
|
||||||
return world.getTileEntity(x, y, z);
|
return world.getTileEntity(x, y, z);
|
||||||
}
|
}
|
||||||
@ -256,12 +246,10 @@ public class CraftWorld implements World {
|
|||||||
|
|
||||||
public List<Entity> getEntities() {
|
public List<Entity> getEntities() {
|
||||||
List<Entity> list = new ArrayList<Entity>();
|
List<Entity> list = new ArrayList<Entity>();
|
||||||
|
|
||||||
for (Object o : world.b) {
|
for (Object o: world.b) {
|
||||||
if (o instanceof net.minecraft.server.Entity) {
|
if (o instanceof net.minecraft.server.Entity) {
|
||||||
net.minecraft.server.Entity mcEnt
|
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o;
|
||||||
= (net.minecraft.server.Entity)o;
|
|
||||||
|
|
||||||
Entity bukkitEntity = mcEnt.getBukkitEntity();
|
Entity bukkitEntity = mcEnt.getBukkitEntity();
|
||||||
|
|
||||||
// Assuming that bukkitEntity isn't null
|
// Assuming that bukkitEntity isn't null
|
||||||
@ -270,27 +258,25 @@ public class CraftWorld implements World {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LivingEntity> getLivingEntities() {
|
public List<LivingEntity> getLivingEntities() {
|
||||||
List<LivingEntity> list = new ArrayList<LivingEntity>();
|
List<LivingEntity> list = new ArrayList<LivingEntity>();
|
||||||
|
|
||||||
for (Object o : world.b) {
|
for (Object o: world.b) {
|
||||||
if (o instanceof net.minecraft.server.Entity) {
|
if (o instanceof net.minecraft.server.Entity) {
|
||||||
net.minecraft.server.Entity mcEnt
|
net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o;
|
||||||
= (net.minecraft.server.Entity)o;
|
|
||||||
|
|
||||||
Entity bukkitEntity = mcEnt.getBukkitEntity();
|
Entity bukkitEntity = mcEnt.getBukkitEntity();
|
||||||
|
|
||||||
// Assuming that bukkitEntity isn't null
|
// Assuming that bukkitEntity isn't null
|
||||||
if (bukkitEntity != null && bukkitEntity instanceof LivingEntity) {
|
if (bukkitEntity != null && bukkitEntity instanceof LivingEntity) {
|
||||||
list.add((LivingEntity)bukkitEntity);
|
list.add((LivingEntity)bukkitEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,10 +134,10 @@ public class CraftBlock implements Block {
|
|||||||
public int getTypeId() {
|
public int getTypeId() {
|
||||||
return chunk.getHandle().a(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
|
return chunk.getHandle().a(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the light level between 0-15
|
* Gets the light level between 0-15
|
||||||
*
|
*
|
||||||
* @return light level
|
* @return light level
|
||||||
*/
|
*/
|
||||||
public byte getLightLevel() {
|
public byte getLightLevel() {
|
||||||
@ -170,8 +170,7 @@ public class CraftBlock implements Block {
|
|||||||
* @return Block at the given face
|
* @return Block at the given face
|
||||||
*/
|
*/
|
||||||
public Block getFace(final BlockFace face, final int distance) {
|
public Block getFace(final BlockFace face, final int distance) {
|
||||||
return getRelative(face.getModX() * distance, face.getModY() * distance,
|
return getRelative(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
|
||||||
face.getModZ() * distance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -232,11 +231,11 @@ public class CraftBlock implements Block {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftBlock{" + "chunk=" + chunk + "x=" + x + "y=" + y + "z=" + z + '}';
|
return "CraftBlock{" + "chunk=" + chunk + "x=" + x + "y=" + y + "z=" + z + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notch uses a 0-5 to mean DOWN, UP, EAST, WEST, NORTH, SOUTH
|
* Notch uses a 0-5 to mean DOWN, UP, EAST, WEST, NORTH, SOUTH
|
||||||
* in that order all over. This method is convenience to convert for us.
|
* in that order all over. This method is convenience to convert for us.
|
||||||
*
|
*
|
||||||
* @return BlockFace the BlockFace represented by this number
|
* @return BlockFace the BlockFace represented by this number
|
||||||
*/
|
*/
|
||||||
public static BlockFace notchToBlockFace(int notch) {
|
public static BlockFace notchToBlockFace(int notch) {
|
||||||
|
@ -125,7 +125,7 @@ public class CraftBlockState implements BlockState {
|
|||||||
public void setTypeId(final int type) {
|
public void setTypeId(final int type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
world.getHandle().e(x, y, z, type);
|
world.getHandle().e(x, y, z, type);
|
||||||
|
|
||||||
createData((byte)0);
|
createData((byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a dispenser.
|
* Represents a dispenser.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftDispenser extends CraftBlockState implements Dispenser {
|
public class CraftDispenser extends CraftBlockState implements Dispenser {
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.CraftWorld;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a note block.
|
* Represents a note block.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an arrow.
|
* Represents an arrow.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftArrow extends CraftEntity implements Arrow {
|
public class CraftArrow extends CraftEntity implements Arrow {
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Boat;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A minecart.
|
* A minecart.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftBoat extends CraftVehicle implements Boat {
|
public class CraftBoat extends CraftVehicle implements Boat {
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Egg;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* An egg.
|
* An egg.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftEgg extends CraftEntity implements Egg {
|
public class CraftEgg extends CraftEntity implements Egg {
|
||||||
|
@ -37,7 +37,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|||||||
}
|
}
|
||||||
// Monsters
|
// Monsters
|
||||||
else if (entity instanceof EntityMonster) {
|
else if (entity instanceof EntityMonster) {
|
||||||
if (entity instanceof EntityZombie) {
|
if (entity instanceof EntityZombie) {
|
||||||
if (entity instanceof EntityPigZombie) { return new CraftPigZombie( server, (EntityPigZombie) entity); }
|
if (entity instanceof EntityPigZombie) { return new CraftPigZombie( server, (EntityPigZombie) entity); }
|
||||||
else { return new CraftZombie( server, (EntityZombie) entity); }
|
else { return new CraftZombie( server, (EntityZombie) entity); }
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.entity.Fireball;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A Fireball.
|
* A Fireball.
|
||||||
*
|
*
|
||||||
* @author Cogito
|
* @author Cogito
|
||||||
*/
|
*/
|
||||||
public class CraftFireball extends CraftEntity implements Fireball {
|
public class CraftFireball extends CraftEntity implements Fireball {
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.entity.Fish;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A Fish.
|
* A Fish.
|
||||||
*
|
*
|
||||||
* @author Cogito
|
* @author Cogito
|
||||||
*/
|
*/
|
||||||
public class CraftFish extends CraftEntity implements Fish {
|
public class CraftFish extends CraftEntity implements Fish {
|
||||||
|
@ -4,7 +4,6 @@ package org.bukkit.craftbukkit.entity;
|
|||||||
import net.minecraft.server.EntityHuman;
|
import net.minecraft.server.EntityHuman;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
@ -8,12 +8,12 @@ import org.bukkit.craftbukkit.CraftServer;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an item drop.
|
* Represents an item drop.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftItemDrop extends CraftEntity implements ItemDrop {
|
public class CraftItemDrop extends CraftEntity implements ItemDrop {
|
||||||
private EntityItem item;
|
private EntityItem item;
|
||||||
|
|
||||||
public CraftItemDrop(CraftServer server, EntityItem entity) {
|
public CraftItemDrop(CraftServer server, EntityItem entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
this.item = entity;
|
this.item = entity;
|
||||||
|
@ -79,7 +79,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
if (entity.vehicle == null) {
|
if (entity.vehicle == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.setPassengerOf(null);
|
entity.setPassengerOf(null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -88,12 +88,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
if (entity.vehicle == null) {
|
if (entity.vehicle == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
org.bukkit.entity.Entity vehicle = (entity.vehicle.getBukkitEntity());
|
org.bukkit.entity.Entity vehicle = (entity.vehicle.getBukkitEntity());
|
||||||
if (vehicle instanceof Vehicle) {
|
if (vehicle instanceof Vehicle) {
|
||||||
return (Vehicle) vehicle;
|
return (Vehicle) vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.entity.PoweredMinecart;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A powered minecart.
|
* A powered minecart.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftPoweredMinecart extends CraftMinecart
|
public class CraftPoweredMinecart extends CraftMinecart
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Snowball;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A snowball.
|
* A snowball.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftSnowball extends CraftEntity implements Snowball {
|
public class CraftSnowball extends CraftEntity implements Snowball {
|
||||||
|
@ -9,12 +9,12 @@ import org.bukkit.entity.StorageMinecart;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A storage minecart.
|
* A storage minecart.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class CraftStorageMinecart extends CraftMinecart implements StorageMinecart {
|
public class CraftStorageMinecart extends CraftMinecart implements StorageMinecart {
|
||||||
private CraftInventory inventory;
|
private CraftInventory inventory;
|
||||||
|
|
||||||
public CraftStorageMinecart(CraftServer server, EntityMinecart entity) {
|
public CraftStorageMinecart(CraftServer server, EntityMinecart entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
inventory = new CraftInventory( entity );
|
inventory = new CraftInventory( entity );
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Vehicle;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A vehicle.
|
* A vehicle.
|
||||||
*
|
*
|
||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
||||||
@ -17,7 +17,7 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
|||||||
public Entity getPassenger() {
|
public Entity getPassenger() {
|
||||||
return isEmpty() ? null : (getHandle().passenger.getBukkitEntity());
|
return isEmpty() ? null : (getHandle().passenger.getBukkitEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setPassenger(Entity passenger) {
|
public boolean setPassenger(Entity passenger) {
|
||||||
if(passenger instanceof CraftEntity){
|
if(passenger instanceof CraftEntity){
|
||||||
((CraftEntity)passenger).getHandle().setPassengerOf(getHandle());
|
((CraftEntity)passenger).getHandle().setPassengerOf(getHandle());
|
||||||
@ -30,12 +30,12 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
|||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return getHandle().passenger == null;
|
return getHandle().passenger == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean eject() {
|
public boolean eject() {
|
||||||
if (getHandle().passenger == null) {
|
if (getHandle().passenger == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getHandle().passenger.setPassengerOf(null);
|
getHandle().passenger.setPassengerOf(null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
public int firstPartial(ItemStack item) {
|
public int firstPartial(ItemStack item) {
|
||||||
return firstPartial(item.getTypeId());
|
return firstPartial(item.getTypeId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
|
public HashMap<Integer, ItemStack> addItem(ItemStack... items) {
|
||||||
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
HashMap<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
|
||||||
|
|
||||||
@ -202,13 +202,13 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
|
|||||||
int amount = item.getAmount();
|
int amount = item.getAmount();
|
||||||
int partialAmount = partialItem.getAmount();
|
int partialAmount = partialItem.getAmount();
|
||||||
int maxAmount = partialItem.getMaxStackSize();
|
int maxAmount = partialItem.getMaxStackSize();
|
||||||
|
|
||||||
// Check if it fully fits
|
// Check if it fully fits
|
||||||
if (amount + partialAmount <= maxAmount) {
|
if (amount + partialAmount <= maxAmount) {
|
||||||
partialItem.setAmount( amount + partialAmount );
|
partialItem.setAmount( amount + partialAmount );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It fits partially
|
// It fits partially
|
||||||
partialItem.setAmount( maxAmount );
|
partialItem.setAmount( maxAmount );
|
||||||
item.setAmount( amount + partialAmount - maxAmount );
|
item.setAmount( amount + partialAmount - maxAmount );
|
||||||
|
@ -9,7 +9,7 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent
|
|||||||
public CraftInventoryPlayer(net.minecraft.server.InventoryPlayer inventory) {
|
public CraftInventoryPlayer(net.minecraft.server.InventoryPlayer inventory) {
|
||||||
super(inventory);
|
super(inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryPlayer getInventory() {
|
public InventoryPlayer getInventory() {
|
||||||
return (InventoryPlayer) inventory;
|
return (InventoryPlayer) inventory;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ public class CraftItemStack extends ItemStack {
|
|||||||
if (item != null) {
|
if (item != null) {
|
||||||
super.setDurability(durability);
|
super.setDurability(durability);
|
||||||
item.damage = durability;
|
item.damage = durability;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren