geforkt von Mirrors/Paper
Removed some old deprecated code and clean up javadocs + warnings
Dieser Commit ist enthalten in:
Ursprung
fd260b0f4d
Commit
cc9ccc8976
@ -109,21 +109,10 @@ public class CraftChunk implements Chunk {
|
||||
return entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture thread-safe read-only snapshot of chunk data
|
||||
* @return ChunkSnapshot
|
||||
*/
|
||||
public ChunkSnapshot getChunkSnapshot() {
|
||||
return getChunkSnapshot(true, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture thread-safe read-only snapshot of chunk data
|
||||
* @param includeMaxblocky - if true, snapshot includes per-coordinate maximum Y values
|
||||
* @param includeBiome - if true, snapshot includes per-coordinate biome type
|
||||
* @param includeBiomeTempRain - if true, snapshot includes per-coordinate raw biome temperature and rainfall
|
||||
* @return ChunkSnapshot
|
||||
*/
|
||||
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
|
||||
net.minecraft.server.Chunk chunk = getHandle();
|
||||
byte[] buf = new byte[32768 + 16384 + 16384 + 16384]; // Get big enough buffer for whole chunk
|
||||
@ -158,6 +147,7 @@ public class CraftChunk implements Chunk {
|
||||
World world = getWorld();
|
||||
return new CraftChunkSnapshot(getX(), getZ(), world.getName(), world.getFullTime(), buf, hmap, biome, biomeTemp, biomeRain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty chunk snapshot - nothing but air blocks, but can include valid biome data
|
||||
*/
|
||||
|
@ -19,7 +19,6 @@ import org.bukkit.inventory.ShapelessRecipe;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -163,6 +162,7 @@ public final class CraftServer implements Server {
|
||||
return serverVersion + " (MC: " + protocolVersion + ")";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Player[] getOnlinePlayers() {
|
||||
List<EntityPlayer> online = server.players;
|
||||
Player[] players = new Player[online.size()];
|
||||
|
@ -241,6 +241,7 @@ public class CraftWorld implements World {
|
||||
return chunk != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
|
||||
if (chunk != null) {
|
||||
world.chunkProviderServer.chunks.put(x, z, chunk);
|
||||
@ -313,38 +314,6 @@ public class CraftWorld implements World {
|
||||
return (Arrow) arrow.getBukkitEntity();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #spawn(Location, Class)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Minecart spawnMinecart(Location loc) {
|
||||
return spawn(loc, Minecart.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #spawn(Location, Class)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public StorageMinecart spawnStorageMinecart(Location loc) {
|
||||
return spawn(loc, StorageMinecart.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #spawn(Location, Class)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public PoweredMinecart spawnPoweredMinecart(Location loc) {
|
||||
return spawn(loc, PoweredMinecart.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #spawn(Location, Class)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Boat spawnBoat(Location loc) {
|
||||
return spawn(loc, Boat.class);
|
||||
}
|
||||
|
||||
public LivingEntity spawnCreature(Location loc, CreatureType creatureType) {
|
||||
LivingEntity creature;
|
||||
try {
|
||||
@ -540,42 +509,6 @@ public class CraftWorld implements World {
|
||||
return getHandle().getWorldChunkManager().getHumidity(x, z);
|
||||
}
|
||||
|
||||
private final class ChunkCoordinate {
|
||||
public final int x;
|
||||
public final int z;
|
||||
|
||||
public ChunkCoordinate(final int x, final int z) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ChunkCoordinate other = (ChunkCoordinate) obj;
|
||||
if (this.x != other.x) {
|
||||
return false;
|
||||
}
|
||||
if (this.z != other.z) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 53 * hash + this.x;
|
||||
hash = 53 * hash + this.z;
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Entity> getEntities() {
|
||||
List<Entity> list = new ArrayList<Entity>();
|
||||
|
||||
|
@ -25,20 +25,10 @@ public class CraftBlock implements Block {
|
||||
this.chunk = chunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the world which contains this Block
|
||||
*
|
||||
* @return World containing this block
|
||||
*/
|
||||
public World getWorld() {
|
||||
return chunk.getWorld();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Location of the block
|
||||
*
|
||||
* @return Location of the block
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return new Location(getWorld(), x, y, z);
|
||||
}
|
||||
@ -47,47 +37,22 @@ public class CraftBlock implements Block {
|
||||
return new BlockVector(x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the x-coordinate of this block
|
||||
*
|
||||
* @return x-coordinate
|
||||
*/
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the y-coordinate of this block
|
||||
*
|
||||
* @return y-coordinate
|
||||
*/
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the z-coordinate of this block
|
||||
*
|
||||
* @return z-coordinate
|
||||
*/
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the chunk which contains this block
|
||||
*
|
||||
* @return Containing Chunk
|
||||
*/
|
||||
public Chunk getChunk() {
|
||||
return chunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the metadata for this block
|
||||
*
|
||||
* @param data New block specific metadata
|
||||
*/
|
||||
public void setData(final byte data) {
|
||||
chunk.getHandle().world.setData(x, y, z, data);
|
||||
}
|
||||
@ -100,30 +65,14 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metadata for this block
|
||||
*
|
||||
* @return block specific metadata
|
||||
*/
|
||||
public byte getData() {
|
||||
return (byte) chunk.getHandle().getData(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of this block
|
||||
*
|
||||
* @param type Material to change this block to
|
||||
*/
|
||||
public void setType(final Material type) {
|
||||
setTypeId(type.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type-id of this block
|
||||
*
|
||||
* @param type Type-Id to change this block to
|
||||
* @return whether the block was changed
|
||||
*/
|
||||
public boolean setTypeId(final int type) {
|
||||
return chunk.getHandle().world.setTypeId(x, y, z, type);
|
||||
}
|
||||
@ -148,80 +97,30 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type of this block
|
||||
*
|
||||
* @return block type
|
||||
*/
|
||||
public Material getType() {
|
||||
return Material.getMaterial(getTypeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type-id of this block
|
||||
*
|
||||
* @return block type-id
|
||||
*/
|
||||
public int getTypeId() {
|
||||
return chunk.getHandle().getTypeId(this.x & 0xF, this.y & 0x7F, this.z & 0xF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the light level between 0-15
|
||||
*
|
||||
* @return light level
|
||||
*/
|
||||
public byte getLightLevel() {
|
||||
return (byte) chunk.getHandle().world.getLightLevel(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block at the given face
|
||||
*
|
||||
* @param face Face of this block to return
|
||||
* @return Block at the given face
|
||||
*/
|
||||
public Block getFace(final BlockFace face) {
|
||||
return getRelative(face, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block at the given distance of the given face<br />
|
||||
* <br />
|
||||
* For example, the following method places water at 100,102,100; two blocks
|
||||
* above 100,100,100.
|
||||
* <pre>
|
||||
* Block block = world.getBlockAt(100,100,100);
|
||||
* Block shower = block.getFace(BlockFace.UP, 2);
|
||||
* shower.setType(Material.WATER);
|
||||
* </pre>
|
||||
*
|
||||
* @param face Face of this block to return
|
||||
* @param distance Distance to get the block at
|
||||
* @return Block at the given face
|
||||
*/
|
||||
public Block getFace(final BlockFace face, final int distance) {
|
||||
return getRelative(face, distance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block at the given offsets
|
||||
*
|
||||
* @param modX X-coordinate offset
|
||||
* @param modY Y-coordinate offset
|
||||
* @param modZ Z-coordinate offset
|
||||
* @return Block at the given offsets
|
||||
*/
|
||||
public Block getRelative(final int modX, final int modY, final int modZ) {
|
||||
return getWorld().getBlockAt(getX() + modX, getY() + modY, getZ() + modZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block at the given offsets
|
||||
*
|
||||
* @param face face
|
||||
* @return Block at the given offsets
|
||||
*/
|
||||
public Block getRelative(BlockFace face) {
|
||||
return getRelative(face, 1);
|
||||
}
|
||||
@ -230,22 +129,6 @@ public class CraftBlock implements Block {
|
||||
return getRelative(face.getModX() * distance, face.getModY() * distance, face.getModZ() * distance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the face relation of this block compared to the given block<br />
|
||||
* <br />
|
||||
* For example:
|
||||
* <pre>
|
||||
* Block current = world.getBlockAt(100, 100, 100);
|
||||
* Block target = world.getBlockAt(100, 101, 100);
|
||||
*
|
||||
* current.getFace(target) == BlockFace.UP;
|
||||
* </pre>
|
||||
* <br />
|
||||
* If the given block is not connected to this block, null may be returned
|
||||
*
|
||||
* @param block Block to compare against this block
|
||||
* @return BlockFace of this block which has the requested block, or null
|
||||
*/
|
||||
public BlockFace getFace(final Block block) {
|
||||
BlockFace[] values = BlockFace.values();
|
||||
|
||||
|
@ -10,7 +10,6 @@ import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.CraftChunk;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import net.minecraft.server.WorldServer;
|
||||
|
||||
public class CraftBlockState implements BlockState {
|
||||
private final CraftWorld world;
|
||||
|
@ -7,11 +7,6 @@ import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a chest.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftChest extends CraftBlockState implements Chest {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityChest chest;
|
||||
|
@ -10,11 +10,6 @@ import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a dispenser.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftDispenser extends CraftBlockState implements Dispenser {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityDispenser dispenser;
|
||||
|
@ -7,11 +7,6 @@ import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
/**
|
||||
* Represents a furnace.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftFurnace extends CraftBlockState implements Furnace {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityFurnace furnace;
|
||||
|
@ -9,9 +9,6 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.NoteBlock;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
|
||||
/**
|
||||
* Represents a note block.
|
||||
*/
|
||||
public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||
private final CraftWorld world;
|
||||
private final TileEntityNote note;
|
||||
|
@ -7,9 +7,6 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* Represents an arrow.
|
||||
*/
|
||||
public class CraftArrow extends CraftEntity implements Arrow {
|
||||
public CraftArrow(CraftServer server, EntityArrow entity) {
|
||||
super(server, entity);
|
||||
|
@ -4,11 +4,6 @@ import net.minecraft.server.EntityBoat;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Boat;
|
||||
|
||||
/**
|
||||
* A minecart.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftBoat extends CraftVehicle implements Boat {
|
||||
protected EntityBoat boat;
|
||||
|
||||
|
@ -4,7 +4,6 @@ import net.minecraft.server.EntityChicken;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Chicken;
|
||||
|
||||
|
||||
public class CraftChicken extends CraftAnimals implements Chicken {
|
||||
|
||||
public CraftChicken(CraftServer server, EntityChicken entity) {
|
||||
@ -15,5 +14,4 @@ public class CraftChicken extends CraftAnimals implements Chicken {
|
||||
public String toString() {
|
||||
return "CraftChicken";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,5 +14,4 @@ public class CraftCow extends CraftAnimals implements Cow {
|
||||
public String toString() {
|
||||
return "CraftCow";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,9 +7,6 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* An egg.
|
||||
*/
|
||||
public class CraftEgg extends CraftEntity implements Egg {
|
||||
public CraftEgg(CraftServer server, EntityEgg entity) {
|
||||
super(server, entity);
|
||||
|
@ -141,6 +141,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Entity> notchEntityList = entity.world.b(entity, entity.boundingBox.b(x, y, z));
|
||||
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());
|
||||
|
||||
|
@ -16,5 +16,4 @@ public class CraftFallingSand extends CraftEntity implements FallingSand {
|
||||
public String toString() {
|
||||
return "CraftFallingSand";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,9 +8,6 @@ import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A Fireball.
|
||||
*/
|
||||
public class CraftFireball extends CraftEntity implements Fireball {
|
||||
public CraftFireball(CraftServer server, EntityFireball entity) {
|
||||
super(server, entity);
|
||||
|
@ -7,9 +7,6 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
/**
|
||||
* A Fish.
|
||||
*/
|
||||
public class CraftFish extends CraftEntity implements Fish {
|
||||
public CraftFish(CraftServer server, EntityFish entity) {
|
||||
super(server, entity);
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityWeatherStorm;
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.Entity;
|
||||
@ -89,7 +88,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
if (maxDistance > 120) {
|
||||
maxDistance = 120;
|
||||
}
|
||||
ArrayList<Block> blocks = new ArrayList();
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
Iterator<Block> itr = new BlockIterator(this, maxDistance);
|
||||
while (itr.hasNext()) {
|
||||
Block block = itr.next();
|
||||
|
@ -5,11 +5,6 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
/**
|
||||
* A minecart.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftMinecart extends CraftVehicle implements Minecart {
|
||||
/**
|
||||
* Stores the minecart type id, which is used by Minecraft to differentiate
|
||||
|
@ -11,7 +11,6 @@ import net.minecraft.server.Packet53BlockChange;
|
||||
import net.minecraft.server.Packet54PlayNoteBlock;
|
||||
import net.minecraft.server.Packet61;
|
||||
import net.minecraft.server.Packet6SpawnPosition;
|
||||
import net.minecraft.server.ServerConfigurationManager;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.Effect;
|
||||
|
@ -5,11 +5,6 @@ import net.minecraft.server.EntityMinecart;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.PoweredMinecart;
|
||||
|
||||
/**
|
||||
* A powered minecart.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftPoweredMinecart extends CraftMinecart implements PoweredMinecart {
|
||||
public CraftPoweredMinecart(CraftServer server, EntityMinecart entity) {
|
||||
super(server, entity);
|
||||
|
@ -7,9 +7,6 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Snowball;
|
||||
|
||||
/**
|
||||
* A snowball.
|
||||
*/
|
||||
public class CraftSnowball extends CraftEntity implements Snowball {
|
||||
public CraftSnowball(CraftServer server, EntitySnowball entity) {
|
||||
super(server, entity);
|
||||
|
@ -7,11 +7,6 @@ import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.StorageMinecart;
|
||||
|
||||
/**
|
||||
* A storage minecart.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftStorageMinecart extends CraftMinecart implements StorageMinecart {
|
||||
private CraftInventory inventory;
|
||||
|
||||
|
@ -3,11 +3,6 @@ package org.bukkit.craftbukkit.entity;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
|
||||
/**
|
||||
* A vehicle.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public abstract class CraftVehicle extends CraftEntity implements Vehicle {
|
||||
public CraftVehicle(CraftServer server, net.minecraft.server.Entity entity) {
|
||||
super(server, entity);
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityWolf;
|
||||
|
@ -5,7 +5,6 @@ import net.minecraft.server.EntityZombie;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Zombie;
|
||||
|
||||
|
||||
public class CraftZombie extends CraftMonster implements Zombie {
|
||||
|
||||
public CraftZombie(CraftServer server, EntityZombie entity) {
|
||||
@ -16,5 +15,4 @@ public class CraftZombie extends CraftMonster implements Zombie {
|
||||
public String toString() {
|
||||
return "CraftZombie";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,12 +13,10 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
public class CustomChunkGenerator extends InternalChunkGenerator {
|
||||
private final ChunkGenerator generator;
|
||||
private final WorldServer world;
|
||||
private final long seed;
|
||||
private final Random random;
|
||||
|
||||
public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) {
|
||||
this.world = (WorldServer) world;
|
||||
this.seed = seed;
|
||||
this.generator = generator;
|
||||
|
||||
this.random = new Random(seed);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren