Update to Minecraft 1.13-pre7

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-07-15 10:00:00 +10:00
parent d1e91a8adb
commit 7e0a66fdd5
608 changed files with 17788 additions and 9378 deletions

View File

@@ -30,7 +30,7 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
public void load(TileEntityBanner banner) {
super.load(banner);
base = DyeColor.getByDyeData((byte) banner.color.getInvColorIndex());
base = DyeColor.getByWoolData((byte) banner.color.getColorIndex());
patterns = new ArrayList<Pattern>();
if (banner.patterns != null) {
@@ -90,7 +90,7 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
public void applyTo(TileEntityBanner banner) {
super.applyTo(banner);
banner.color = EnumColor.fromInvColorIndex(base.getDyeData());
banner.color = EnumColor.fromColorIndex(base.getWoolData());
NBTTagList newPatterns = new NBTTagList();

View File

@@ -10,6 +10,7 @@ import org.bukkit.Material;
import org.bukkit.block.Beacon;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon;
import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.BeaconInventory;
import org.bukkit.potion.PotionEffect;
@@ -87,11 +88,11 @@ public class CraftBeacon extends CraftContainer<TileEntityBeacon> implements Bea
@Override
public String getCustomName() {
TileEntityBeacon beacon = this.getSnapshot();
return beacon.hasCustomName() ? beacon.getName() : null;
return beacon.hasCustomName() ? CraftChatMessage.fromComponent(beacon.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
}

View File

@@ -10,8 +10,6 @@ import org.bukkit.block.Block;
public class CraftBed extends CraftBlockEntityState<TileEntityBed> implements Bed {
private DyeColor color;
public CraftBed(Block block) {
super(block, TileEntityBed.class);
}
@@ -20,29 +18,48 @@ public class CraftBed extends CraftBlockEntityState<TileEntityBed> implements Be
super(material, te);
}
@Override
public void load(TileEntityBed bed) {
super.load(bed);
color = DyeColor.getByWoolData((byte) bed.a().getColorIndex());
}
@Override
public DyeColor getColor() {
return color;
switch (getType()) {
case BLACK_BED:
return DyeColor.BLACK;
case BLUE_BED:
return DyeColor.BLUE;
case BROWN_BED:
return DyeColor.BROWN;
case CYAN_BED:
return DyeColor.CYAN;
case GRAY_BED:
return DyeColor.GRAY;
case GREEN_BED:
return DyeColor.GREEN;
case LIGHT_BLUE_BED:
return DyeColor.LIGHT_BLUE;
case LIGHT_GRAY_BED:
return DyeColor.SILVER;
case LIME_BED:
return DyeColor.LIME;
case MAGENTA_BED:
return DyeColor.MAGENTA;
case ORANGE_BED:
return DyeColor.ORANGE;
case PINK_BED:
return DyeColor.PINK;
case PURPLE_BED:
return DyeColor.PURPLE;
case RED_BED:
return DyeColor.RED;
case WHITE_BED:
return DyeColor.WHITE;
case YELLOW_BED:
return DyeColor.YELLOW;
default:
throw new IllegalArgumentException("Unknown DyeColor for " + getType());
}
}
@Override
public void setColor(DyeColor color) {
Preconditions.checkArgument(color != null, "color");
this.color = color;
}
@Override
public void applyTo(TileEntityBed bed) {
super.applyTo(bed);
bed.a(EnumColor.fromColorIndex(color.getWoolData()));
throw new UnsupportedOperationException("Must set block type to appropriate bed colour");
}
}

View File

@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -16,7 +17,10 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.inventory.ItemStack;
@@ -25,40 +29,44 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.util.BlockVector;
public class CraftBlock implements Block {
private final CraftChunk chunk;
private final int x;
private final int y;
private final int z;
private final net.minecraft.server.GeneratorAccess world;
private final BlockPosition position;
public CraftBlock(CraftChunk chunk, int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
this.chunk = chunk;
public CraftBlock(GeneratorAccess world, BlockPosition position) {
this.world = world;
this.position = position;
}
public static CraftBlock at(GeneratorAccess world, BlockPosition position) {
return new CraftBlock(world, position);
}
private net.minecraft.server.Block getNMSBlock() {
return CraftMagicNumbers.getBlock(this); // TODO: UPDATE THIS
return getNMS().getBlock();
}
private static net.minecraft.server.Block getNMSBlock(int type) {
return CraftMagicNumbers.getBlock(type);
protected net.minecraft.server.IBlockData getNMS() {
return world.getType(position);
}
public World getWorld() {
return chunk.getWorld();
return world.getMinecraftWorld().getWorld();
}
public CraftWorld getCraftWorld() {
return (CraftWorld) getWorld();
}
public Location getLocation() {
return new Location(getWorld(), x, y, z);
return new Location(getWorld(), position.getX(), position.getY(), position.getZ());
}
public Location getLocation(Location loc) {
if (loc != null) {
loc.setWorld(getWorld());
loc.setX(x);
loc.setY(y);
loc.setZ(z);
loc.setX(position.getX());
loc.setY(position.getY());
loc.setZ(position.getZ());
loc.setYaw(0);
loc.setPitch(0);
}
@@ -67,23 +75,23 @@ public class CraftBlock implements Block {
}
public BlockVector getVector() {
return new BlockVector(x, y, z);
return new BlockVector(getX(), getY(), getZ());
}
public int getX() {
return x;
return position.getX();
}
public int getY() {
return y;
return position.getY();
}
public int getZ() {
return z;
return position.getZ();
}
public Chunk getChunk() {
return chunk;
return getWorld().getChunkAt(this);
}
public void setData(final byte data) {
@@ -99,19 +107,21 @@ public class CraftBlock implements Block {
}
private void setData(final byte data, int flag) {
net.minecraft.server.World world = chunk.getHandle().getWorld();
BlockPosition position = new BlockPosition(x, y, z);
IBlockData blockData = world.getType(position);
world.setTypeAndData(position, blockData.getBlock().fromLegacyData(data), flag);
world.setTypeAndData(position, CraftMagicNumbers.getBlock(getType(), data), flag);
}
private IBlockData getData0() {
return chunk.getHandle().getBlockData(new BlockPosition(x, y, z));
return world.getType(position);
}
public byte getData() {
IBlockData blockData = chunk.getHandle().getBlockData(new BlockPosition(x, y, z));
return (byte) blockData.getBlock().toLegacyData(blockData);
IBlockData blockData = world.getType(position);
return CraftMagicNumbers.toLegacyData(blockData);
}
@Override
public BlockData getBlockData() {
return CraftBlockData.fromData(getData0());
}
public void setType(final Material type) {
@@ -120,34 +130,36 @@ public class CraftBlock implements Block {
@Override
public void setType(Material type, boolean applyPhysics) {
setTypeId(type.getId(), applyPhysics);
setTypeAndData(type, (byte) 0, applyPhysics);
}
public boolean setTypeId(final int type) {
return setTypeId(type, true);
@Override
public void setBlockData(BlockData data) {
setBlockData(data, true);
}
public boolean setTypeId(final int type, final boolean applyPhysics) {
net.minecraft.server.Block block = getNMSBlock(type);
return setTypeIdAndData(type, (byte) block.toLegacyData(block.getBlockData()), applyPhysics);
@Override
public void setBlockData(BlockData data, boolean applyPhysics) {
setTypeAndData(((CraftBlockData) data).getState(), applyPhysics);
}
public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
IBlockData blockData = getNMSBlock(type).fromLegacyData(data);
BlockPosition position = new BlockPosition(x, y, z);
public boolean setTypeAndData(final Material type, final byte data, final boolean applyPhysics) {
return setTypeAndData(CraftMagicNumbers.getBlock(type, data), applyPhysics);
}
public boolean setTypeAndData(final IBlockData blockData, final boolean applyPhysics) {
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup
if (type != 0 && blockData.getBlock() instanceof BlockTileEntity && type != getTypeId()) {
chunk.getHandle().getWorld().setTypeAndData(position, Blocks.AIR.getBlockData(), 0);
if (!blockData.isAir() && blockData.getBlock() instanceof BlockTileEntity && blockData.getBlock() != getNMSBlock()) {
world.setTypeAndData(position, Blocks.AIR.getBlockData(), 0);
}
if (applyPhysics) {
return chunk.getHandle().getWorld().setTypeAndData(position, blockData, 3);
return world.setTypeAndData(position, blockData, 3);
} else {
IBlockData old = chunk.getHandle().getBlockData(position);
boolean success = chunk.getHandle().getWorld().setTypeAndData(position, blockData, 18); // NOTIFY | NO_OBSERVER
IBlockData old = world.getType(position);
boolean success = world.setTypeAndData(position, blockData, 18); // NOTIFY | NO_OBSERVER
if (success) {
chunk.getHandle().getWorld().notify(
world.getMinecraftWorld().notify(
position,
old,
blockData,
@@ -159,25 +171,19 @@ public class CraftBlock implements Block {
}
public Material getType() {
return Material.getMaterial(getTypeId());
}
@Deprecated
@Override
public int getTypeId() {
return CraftMagicNumbers.getId(chunk.getHandle().getBlockData(new BlockPosition(this.x, this.y, this.z)).getBlock());
return CraftMagicNumbers.getMaterial(world.getType(position).getBlock());
}
public byte getLightLevel() {
return (byte) chunk.getHandle().getWorld().getLightLevel(new BlockPosition(this.x, this.y, this.z));
return (byte) world.getMinecraftWorld().getLightLevel(position);
}
public byte getLightFromSky() {
return (byte) chunk.getHandle().getWorld().getBrightness(EnumSkyBlock.SKY, new BlockPosition(this.x, this.y, this.z));
return (byte) world.getBrightness(EnumSkyBlock.SKY, position);
}
public byte getLightFromBlocks() {
return (byte) chunk.getHandle().getWorld().getBrightness(EnumSkyBlock.BLOCK, new BlockPosition(this.x, this.y, this.z));
return (byte) world.getBrightness(EnumSkyBlock.BLOCK, position);
}
@@ -218,7 +224,7 @@ public class CraftBlock implements Block {
@Override
public String toString() {
return "CraftBlock{" + "chunk=" + chunk + ",x=" + x + ",y=" + y + ",z=" + z + ",type=" + getType() + ",data=" + getData() + '}';
return "CraftBlock{pos=" + position + ",type=" + getType() + ",data=" + getData() + '}';
}
public static BlockFace notchToBlockFace(EnumDirection notch) {
@@ -265,13 +271,11 @@ public class CraftBlock implements Block {
switch (material) {
case SIGN:
case SIGN_POST:
case WALL_SIGN:
return new CraftSign(this);
case CHEST:
case TRAPPED_CHEST:
return new CraftChest(this);
case BURNING_FURNACE:
case FURNACE:
return new CraftFurnace(this);
case DISPENSER:
@@ -282,28 +286,65 @@ public class CraftBlock implements Block {
return new CraftEndGateway(this);
case HOPPER:
return new CraftHopper(this);
case MOB_SPAWNER:
case SPAWNER:
return new CraftCreatureSpawner(this);
case NOTE_BLOCK:
return new CraftNoteBlock(this);
case JUKEBOX:
return new CraftJukebox(this);
case BREWING_STAND:
return new CraftBrewingStand(this);
case SKULL:
case CREEPER_HEAD:
case CREEPER_WALL_HEAD:
case DRAGON_HEAD:
case DRAGON_WALL_HEAD:
case PISTON_HEAD:
case PLAYER_HEAD:
case PLAYER_WALL_HEAD:
case SKELETON_SKULL:
case SKELETON_WALL_SKULL:
case WITHER_SKELETON_SKULL:
case WITHER_SKELETON_WALL_SKULL:
case ZOMBIE_HEAD:
case ZOMBIE_WALL_HEAD:
return new CraftSkull(this);
case COMMAND:
case COMMAND_CHAIN:
case COMMAND_REPEATING:
case COMMAND_BLOCK:
case CHAIN_COMMAND_BLOCK:
case REPEATING_COMMAND_BLOCK:
return new CraftCommandBlock(this);
case BEACON:
return new CraftBeacon(this);
case BANNER:
case WALL_BANNER:
case STANDING_BANNER:
case BLACK_BANNER:
case BLACK_WALL_BANNER:
case BLUE_BANNER:
case BLUE_WALL_BANNER:
case BROWN_BANNER:
case BROWN_WALL_BANNER:
case CYAN_BANNER:
case CYAN_WALL_BANNER:
case GRAY_BANNER:
case GRAY_WALL_BANNER:
case GREEN_BANNER:
case GREEN_WALL_BANNER:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_WALL_BANNER:
case LIGHT_GRAY_BANNER:
case LIGHT_GRAY_WALL_BANNER:
case LIME_BANNER:
case LIME_WALL_BANNER:
case MAGENTA_BANNER:
case MAGENTA_WALL_BANNER:
case ORANGE_BANNER:
case ORANGE_WALL_BANNER:
case PINK_BANNER:
case PINK_WALL_BANNER:
case PURPLE_BANNER:
case PURPLE_WALL_BANNER:
case RED_BANNER:
case RED_WALL_BANNER:
case WHITE_BANNER:
case WHITE_WALL_BANNER:
case YELLOW_BANNER:
case YELLOW_WALL_BANNER:
return new CraftBanner(this);
case FLOWER_POT:
return new CraftFlowerPot(this);
case STRUCTURE_BLOCK:
return new CraftStructureBlock(this);
case WHITE_SHULKER_BOX:
@@ -314,7 +355,7 @@ public class CraftBlock implements Block {
case LIME_SHULKER_BOX:
case PINK_SHULKER_BOX:
case GRAY_SHULKER_BOX:
case SILVER_SHULKER_BOX:
case LIGHT_GRAY_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case BLUE_SHULKER_BOX:
@@ -323,20 +364,35 @@ public class CraftBlock implements Block {
case RED_SHULKER_BOX:
case BLACK_SHULKER_BOX:
return new CraftShulkerBox(this);
case ENCHANTMENT_TABLE:
case ENCHANTING_TABLE:
return new CraftEnchantingTable(this);
case ENDER_CHEST:
return new CraftEnderChest(this);
case DAYLIGHT_DETECTOR:
case DAYLIGHT_DETECTOR_INVERTED:
return new CraftDaylightDetector(this);
case REDSTONE_COMPARATOR_OFF:
case REDSTONE_COMPARATOR_ON:
case COMPARATOR:
return new CraftComparator(this);
case BED_BLOCK:
case BLACK_BED:
case BLUE_BED:
case BROWN_BED:
case CYAN_BED:
case GRAY_BED:
case GREEN_BED:
case LIGHT_BLUE_BED:
case LIGHT_GRAY_BED:
case LIME_BED:
case MAGENTA_BED:
case ORANGE_BED:
case PINK_BED:
case PURPLE_BED:
case RED_BED:
case WHITE_BED:
case YELLOW_BED:
return new CraftBed(this);
case CONDUIT:
return new CraftConduit(this);
default:
TileEntity tileEntity = chunk.getCraftWorld().getTileEntityAt(x, y, z);
TileEntity tileEntity = world.getTileEntity(position);
if (tileEntity != null) {
// block with unhandled TileEntity:
return new CraftBlockEntityState<TileEntity>(this, (Class<TileEntity>) tileEntity.getClass());
@@ -348,11 +404,11 @@ public class CraftBlock implements Block {
}
public Biome getBiome() {
return getWorld().getBiome(x, z);
return getWorld().getBiome(getX(), getZ());
}
public void setBiome(Biome bio) {
getWorld().setBiome(x, z, bio);
getWorld().setBiome(getX(), getZ(), bio);
}
public static Biome biomeBaseToBiome(BiomeBase base) {
@@ -372,19 +428,19 @@ public class CraftBlock implements Block {
}
public double getTemperature() {
return getWorld().getTemperature(x, z);
return getWorld().getTemperature(getX(), getZ());
}
public double getHumidity() {
return getWorld().getHumidity(x, z);
return getWorld().getHumidity(getX(), getZ());
}
public boolean isBlockPowered() {
return chunk.getHandle().getWorld().getBlockPower(new BlockPosition(x, y, z)) > 0;
return world.getMinecraftWorld().getBlockPower(position) > 0;
}
public boolean isBlockIndirectlyPowered() {
return chunk.getHandle().getWorld().isBlockIndirectlyPowered(new BlockPosition(x, y, z));
return world.getMinecraftWorld().isBlockIndirectlyPowered(position);
}
@Override
@@ -393,20 +449,20 @@ public class CraftBlock implements Block {
if (!(o instanceof CraftBlock)) return false;
CraftBlock other = (CraftBlock) o;
return this.x == other.x && this.y == other.y && this.z == other.z && this.getWorld().equals(other.getWorld());
return this.position.equals(other.position) && this.getWorld().equals(other.getWorld());
}
@Override
public int hashCode() {
return this.y << 24 ^ this.x ^ this.z ^ this.getWorld().hashCode();
return this.position.hashCode() ^ this.getWorld().hashCode();
}
public boolean isBlockFacePowered(BlockFace face) {
return chunk.getHandle().getWorld().isBlockFacePowered(new BlockPosition(x, y, z), blockFaceToNotch(face));
return world.getMinecraftWorld().isBlockFacePowered(position, blockFaceToNotch(face));
}
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
int power = chunk.getHandle().getWorld().getBlockFacePower(new BlockPosition(x, y, z), blockFaceToNotch(face));
int power = world.getMinecraftWorld().getBlockFacePower(position, blockFaceToNotch(face));
Block relative = getRelative(face);
if (relative.getType() == Material.REDSTONE_WIRE) {
@@ -418,8 +474,11 @@ public class CraftBlock implements Block {
public int getBlockPower(BlockFace face) {
int power = 0;
BlockRedstoneWire wire = Blocks.REDSTONE_WIRE;
net.minecraft.server.World world = chunk.getHandle().getWorld();
BlockRedstoneWire wire = (BlockRedstoneWire) Blocks.REDSTONE_WIRE;
net.minecraft.server.World world = this.world.getMinecraftWorld();
int x = getX();
int y = getY();
int z = getZ();
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y - 1, z), EnumDirection.DOWN)) power = wire.getPower(world, new BlockPosition(x, y - 1, z), power);
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y + 1, z), EnumDirection.UP)) power = wire.getPower(world, new BlockPosition(x, y + 1, z), power);
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x + 1, y, z), EnumDirection.EAST)) power = wire.getPower(world, new BlockPosition(x + 1, y, z), power);
@@ -438,31 +497,30 @@ public class CraftBlock implements Block {
}
public boolean isLiquid() {
return (getType() == Material.WATER) || (getType() == Material.STATIONARY_WATER) || (getType() == Material.LAVA) || (getType() == Material.STATIONARY_LAVA);
return (getType() == Material.WATER) || (getType() == Material.LAVA);
}
public PistonMoveReaction getPistonMoveReaction() {
return PistonMoveReaction.getById(getNMSBlock().h(getNMSBlock().fromLegacyData(getData())).ordinal());
return PistonMoveReaction.getById(getNMS().getPushReaction().ordinal());
}
private boolean itemCausesDrops(ItemStack item) {
net.minecraft.server.Block block = this.getNMSBlock();
net.minecraft.server.Item itemType = item != null ? net.minecraft.server.Item.getById(item.getTypeId()) : null;
net.minecraft.server.Item itemType = CraftMagicNumbers.getItem(item.getType());
return block != null && (block.getBlockData().getMaterial().isAlwaysDestroyable() || (itemType != null && itemType.canDestroySpecialBlock(block.getBlockData())));
}
public boolean breakNaturally() {
// Order matters here, need to drop before setting to air so skulls can get their data
net.minecraft.server.Block block = this.getNMSBlock();
byte data = getData();
boolean result = false;
if (block != null && block != Blocks.AIR) {
block.dropNaturally(chunk.getHandle().getWorld(), new BlockPosition(x, y, z), block.fromLegacyData(data), 1.0F, 0);
block.dropNaturally(getNMS(), world.getMinecraftWorld(), position, 1.0F, 0);
result = true;
}
setTypeId(Material.AIR.getId());
setType(Material.AIR);
return result;
}
@@ -470,7 +528,7 @@ public class CraftBlock implements Block {
if (itemCausesDrops(item)) {
return breakNaturally();
} else {
return setTypeId(Material.AIR.getId());
return setTypeAndData(Material.AIR, (byte) 0, true);
}
}
@@ -481,21 +539,20 @@ public class CraftBlock implements Block {
if (block != Blocks.AIR) {
IBlockData data = getData0();
// based on nms.Block.dropNaturally
int count = block.getDropCount(0, chunk.getHandle().getWorld().random);
int count = block.getDropCount(data, 0, world.getMinecraftWorld(), position, world.getMinecraftWorld().random);
for (int i = 0; i < count; ++i) {
Item item = block.getDropType(data, chunk.getHandle().getWorld().random, 0);
if (item != Items.a) {
Item item = block.getDropType(data, world.getMinecraftWorld(), position, 0).getItem();
if (item != Items.AIR) {
// Skulls are special, their data is based on the tile entity
if (Blocks.SKULL == block) {
net.minecraft.server.ItemStack nmsStack = new net.minecraft.server.ItemStack(item, 1, block.getDropData(data));
TileEntitySkull tileentityskull = (TileEntitySkull) chunk.getHandle().getWorld().getTileEntity(new BlockPosition(x, y, z));
if (block instanceof BlockSkullAbstract) {
net.minecraft.server.ItemStack nmsStack = block.a((IBlockAccess) world, position, data);
TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(position);
if (tileentityskull.getSkullType() == 3 && tileentityskull.getGameProfile() != null) {
nmsStack.setTag(new NBTTagCompound());
if ((block == Blocks.PLAYER_HEAD || block == Blocks.PLAYER_WALL_HEAD) && tileentityskull.getGameProfile() != null) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
GameProfileSerializer.serialize(nbttagcompound, tileentityskull.getGameProfile());
nmsStack.getTag().set("SkullOwner", nbttagcompound);
nmsStack.getOrCreateTag().set("SkullOwner", nbttagcompound);
}
drops.add(CraftItemStack.asBukkitCopy(nmsStack));
@@ -504,10 +561,10 @@ public class CraftBlock implements Block {
int age = (Integer) data.get(BlockCocoa.AGE);
int dropAmount = (age >= 2 ? 3 : 1);
for (int j = 0; j < dropAmount; ++j) {
drops.add(new ItemStack(Material.INK_SACK, 1, (short) 3));
drops.add(new ItemStack(Material.COCOA_BEANS, 1));
}
} else {
drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1, (short) block.getDropData(data)));
drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1));
}
}
}
@@ -524,18 +581,18 @@ public class CraftBlock implements Block {
}
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
chunk.getCraftWorld().getBlockMetadata().setMetadata(this, metadataKey, newMetadataValue);
getCraftWorld().getBlockMetadata().setMetadata(this, metadataKey, newMetadataValue);
}
public List<MetadataValue> getMetadata(String metadataKey) {
return chunk.getCraftWorld().getBlockMetadata().getMetadata(this, metadataKey);
return getCraftWorld().getBlockMetadata().getMetadata(this, metadataKey);
}
public boolean hasMetadata(String metadataKey) {
return chunk.getCraftWorld().getBlockMetadata().hasMetadata(this, metadataKey);
return getCraftWorld().getBlockMetadata().hasMetadata(this, metadataKey);
}
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
chunk.getCraftWorld().getBlockMetadata().removeMetadata(this, metadataKey, owningPlugin);
getCraftWorld().getBlockMetadata().removeMetadata(this, metadataKey, owningPlugin);
}
}

View File

@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.TileEntity;
import net.minecraft.server.World;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftWorld;
@@ -23,7 +24,7 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
this.tileEntity = tileEntityClass.cast(world.getTileEntityAt(this.getX(), this.getY(), this.getZ()));
// copy tile entity data:
this.snapshot = this.createSnapshot(tileEntity);
this.snapshot = this.createSnapshot(tileEntity, world.getHandle());
this.load(snapshot);
}
@@ -34,17 +35,17 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
this.tileEntity = tileEntity;
// copy tile entity data:
this.snapshot = this.createSnapshot(tileEntity);
this.snapshot = this.createSnapshot(tileEntity, null);
this.load(snapshot);
}
private T createSnapshot(T tileEntity) {
private T createSnapshot(T tileEntity, World world) {
if (tileEntity == null) {
return null;
}
NBTTagCompound nbtTagCompound = tileEntity.save(new NBTTagCompound());
T snapshot = (T) TileEntity.create(null, nbtTagCompound);
T snapshot = (T) TileEntity.create(nbtTagCompound, world);
return snapshot;
}

View File

@@ -7,8 +7,10 @@ import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.material.Attachable;
import org.bukkit.material.MaterialData;
@@ -16,6 +18,7 @@ import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import java.util.List;
import net.minecraft.server.GeneratorAccess;
import net.minecraft.server.IBlockData;
public class CraftBlockState implements BlockState {
@@ -24,8 +27,7 @@ public class CraftBlockState implements BlockState {
private final int x;
private final int y;
private final int z;
protected int type;
protected MaterialData data;
protected IBlockData data;
protected int flag;
public CraftBlockState(final Block block) {
@@ -33,11 +35,9 @@ public class CraftBlockState implements BlockState {
this.x = block.getX();
this.y = block.getY();
this.z = block.getZ();
this.type = block.getTypeId();
this.data = ((CraftBlock) block).getNMS();
this.chunk = (CraftChunk) block.getChunk();
this.flag = 3;
createData(block.getData());
}
public CraftBlockState(final Block block, int flag) {
@@ -47,17 +47,17 @@ public class CraftBlockState implements BlockState {
public CraftBlockState(Material material) {
world = null;
type = material.getId();
data = CraftMagicNumbers.getBlock(material).getBlockData();
chunk = null;
x = y = z = 0;
}
public static CraftBlockState getBlockState(net.minecraft.server.World world, int x, int y, int z) {
return new CraftBlockState(world.getWorld().getBlockAt(x, y, z));
public static CraftBlockState getBlockState(GeneratorAccess world, net.minecraft.server.BlockPosition pos) {
return new CraftBlockState(CraftBlock.at(world, pos));
}
public static CraftBlockState getBlockState(net.minecraft.server.World world, int x, int y, int z, int flag) {
return new CraftBlockState(world.getWorld().getBlockAt(x, y, z), flag);
public static CraftBlockState getBlockState(net.minecraft.server.World world, net.minecraft.server.BlockPosition pos, int flag) {
return new CraftBlockState(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), flag);
}
public World getWorld() {
@@ -82,14 +82,32 @@ public class CraftBlockState implements BlockState {
return chunk;
}
public void setData(IBlockData data) {
this.data = data;
}
public IBlockData getHandle() {
return this.data;
}
@Override
public BlockData getBlockData() {
return CraftBlockData.fromData(data);
}
@Override
public void setBlockData(BlockData data) {
this.data = ((CraftBlockData) data).getState();
}
public void setData(final MaterialData data) {
Material mat = getType();
if ((mat == null) || (mat.getData() == null)) {
this.data = data;
this.data = CraftMagicNumbers.getBlock(data);
} else {
if ((data.getClass() == mat.getData()) || (data.getClass() == MaterialData.class)) {
this.data = data;
this.data = CraftMagicNumbers.getBlock(data);
} else {
throw new IllegalArgumentException("Provided data is not of type "
+ mat.getData().getName() + ", found " + data.getClass().getName());
@@ -98,24 +116,17 @@ public class CraftBlockState implements BlockState {
}
public MaterialData getData() {
return data;
return CraftMagicNumbers.getMaterial(data);
}
public void setType(final Material type) {
setTypeId(type.getId());
}
public boolean setTypeId(final int type) {
if (this.type != type) {
this.type = type;
createData((byte) 0);
if (this.getType() != type) {
this.data = CraftMagicNumbers.getBlock(type).getBlockData();
}
return true;
}
public Material getType() {
return Material.getMaterial(getTypeId());
return CraftMagicNumbers.getMaterial(data.getBlock());
}
public void setFlag(int flag) {
@@ -126,17 +137,13 @@ public class CraftBlockState implements BlockState {
return flag;
}
public int getTypeId() {
return type;
}
public byte getLightLevel() {
return getBlock().getLightLevel();
}
public Block getBlock() {
public CraftBlock getBlock() {
requirePlaced();
return world.getBlockAt(x, y, z);
return (CraftBlock) world.getBlockAt(x, y, z);
}
public boolean update() {
@@ -151,7 +158,7 @@ public class CraftBlockState implements BlockState {
if (!isPlaced()) {
return true;
}
Block block = getBlock();
CraftBlock block = getBlock();
if (block.getType() != getType()) {
if (!force) {
@@ -160,34 +167,25 @@ public class CraftBlockState implements BlockState {
}
BlockPosition pos = new BlockPosition(x, y, z);
IBlockData newBlock = CraftMagicNumbers.getBlock(getType()).fromLegacyData(getRawData());
block.setTypeIdAndData(getTypeId(), getRawData(), applyPhysics);
IBlockData newBlock = this.data;
block.setTypeAndData(newBlock, applyPhysics);
world.getHandle().notify(
pos,
CraftMagicNumbers.getBlock(block).fromLegacyData(block.getData()),
block.getNMS(),
newBlock,
3
);
// Update levers etc
if (applyPhysics && getData() instanceof Attachable) {
world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock(), false);
world.getHandle().applyPhysics(pos.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock());
}
return true;
}
private void createData(final byte data) {
Material mat = getType();
if (mat == null || mat.getData() == null) {
this.data = new MaterialData(type, data);
} else {
this.data = mat.getNewData(data);
}
}
public byte getRawData() {
return data.getData();
return CraftMagicNumbers.toLegacyData(data);
}
public Location getLocation() {
@@ -208,7 +206,7 @@ public class CraftBlockState implements BlockState {
}
public void setRawData(byte data) {
this.data.setData(data);
this.data = CraftMagicNumbers.getBlock(getType(), data);
}
@Override
@@ -232,9 +230,6 @@ public class CraftBlockState implements BlockState {
if (this.z != other.z) {
return false;
}
if (this.type != other.type) {
return false;
}
if (this.data != other.data && (this.data == null || !this.data.equals(other.data))) {
return false;
}
@@ -248,7 +243,6 @@ public class CraftBlockState implements BlockState {
hash = 73 * hash + this.x;
hash = 73 * hash + this.y;
hash = 73 * hash + this.z;
hash = 73 * hash + this.type;
hash = 73 * hash + (this.data != null ? this.data.hashCode() : 0);
return hash;
}

View File

@@ -5,6 +5,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BrewingStand;
import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.inventory.BrewerInventory;
public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> implements BrewingStand {
@@ -54,12 +55,12 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
@Override
public String getCustomName() {
TileEntityBrewingStand brewingStand = this.getSnapshot();
return brewingStand.hasCustomName() ? brewingStand.getName() : null;
return brewingStand.hasCustomName() ? CraftChatMessage.fromComponent(brewingStand.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override

View File

@@ -1,6 +1,10 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.BlockChest;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.Blocks;
import net.minecraft.server.ITileInventory;
import net.minecraft.server.InventoryLargeChest;
import net.minecraft.server.TileEntityChest;
import org.bukkit.Material;
@@ -48,30 +52,10 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
int z = this.getZ();
CraftWorld world = (CraftWorld) this.getWorld();
int id;
if (world.getBlockTypeIdAt(x, y, z) == Material.CHEST.getId()) {
id = Material.CHEST.getId();
} else if (world.getBlockTypeIdAt(x, y, z) == Material.TRAPPED_CHEST.getId()) {
id = Material.TRAPPED_CHEST.getId();
} else {
throw new IllegalStateException("CraftChest is not a chest but is instead " + world.getBlockAt(x, y, z));
}
ITileInventory nms = ((BlockChest) Blocks.CHEST).getInventory(data, world.getHandle(), new BlockPosition(x, y, z), true);
if (world.getBlockTypeIdAt(x - 1, y, z) == id) {
CraftInventory left = new CraftInventory((TileEntityChest) world.getHandle().getTileEntity(new BlockPosition(x - 1, y, z)));
inventory = new CraftInventoryDoubleChest(left, inventory);
}
if (world.getBlockTypeIdAt(x + 1, y, z) == id) {
CraftInventory right = new CraftInventory((TileEntityChest) world.getHandle().getTileEntity(new BlockPosition(x + 1, y, z)));
inventory = new CraftInventoryDoubleChest(inventory, right);
}
if (world.getBlockTypeIdAt(x, y, z - 1) == id) {
CraftInventory left = new CraftInventory((TileEntityChest) world.getHandle().getTileEntity(new BlockPosition(x, y, z - 1)));
inventory = new CraftInventoryDoubleChest(left, inventory);
}
if (world.getBlockTypeIdAt(x, y, z + 1) == id) {
CraftInventory right = new CraftInventory((TileEntityChest) world.getHandle().getTileEntity(new BlockPosition(x, y, z + 1)));
inventory = new CraftInventoryDoubleChest(inventory, right);
if (nms instanceof InventoryLargeChest) {
inventory = new CraftInventoryDoubleChest((InventoryLargeChest) nms);
}
return inventory;
}

View File

@@ -4,6 +4,7 @@ import net.minecraft.server.TileEntityCommand;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.CommandBlock;
import org.bukkit.craftbukkit.util.CraftChatMessage;
public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand> implements CommandBlock {
@@ -23,7 +24,7 @@ public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand>
super.load(commandBlock);
command = commandBlock.getCommandBlock().getCommand();
name = commandBlock.getCommandBlock().getName();
name = CraftChatMessage.fromComponent(commandBlock.getCommandBlock().getName());
}
@Override
@@ -51,6 +52,6 @@ public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand>
super.applyTo(commandBlock);
commandBlock.getCommandBlock().setCommand(command);
commandBlock.getCommandBlock().setName(name);
commandBlock.getCommandBlock().setName(CraftChatMessage.fromStringOrNull(name));
}
}

View File

@@ -0,0 +1,17 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.TileEntityConduit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Conduit;
public class CraftConduit extends CraftBlockEntityState<TileEntityConduit> implements Conduit {
public CraftConduit(Block block) {
super(block, TileEntityConduit.class);
}
public CraftConduit(Material material, TileEntityConduit te) {
super(material, te);
}
}

View File

@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.server.EntityTypes;
import net.minecraft.server.MinecraftKey;
import net.minecraft.server.TileEntityMobSpawner;
import org.bukkit.Material;
@@ -31,7 +32,7 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
throw new IllegalArgumentException("Can't spawn EntityType " + entityType + " from mobspawners!");
}
this.getSnapshot().getSpawner().setMobName(new MinecraftKey(entityType.getName()));
this.getSnapshot().getSpawner().setMobName(EntityTypes.a(entityType.getName()));
}
@Override

View File

@@ -4,6 +4,7 @@ import net.minecraft.server.TileEntityEnchantTable;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.EnchantingTable;
import org.bukkit.craftbukkit.util.CraftChatMessage;
public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchantTable> implements EnchantingTable {
@@ -18,12 +19,12 @@ public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchan
@Override
public String getCustomName() {
TileEntityEnchantTable enchant = this.getSnapshot();
return enchant.hasCustomName() ? enchant.getName() : null;
return enchant.hasCustomName() ? CraftChatMessage.fromComponent(enchant.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override

View File

@@ -1,46 +0,0 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.ItemStack;
import net.minecraft.server.TileEntityFlowerPot;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.FlowerPot;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.material.MaterialData;
public class CraftFlowerPot extends CraftBlockEntityState<TileEntityFlowerPot> implements FlowerPot {
private MaterialData contents;
public CraftFlowerPot(Block block) {
super(block, TileEntityFlowerPot.class);
}
public CraftFlowerPot(Material material, TileEntityFlowerPot te) {
super(material, te);
}
@Override
public void load(TileEntityFlowerPot pot) {
super.load(pot);
contents = (pot.getItem() == null) ? null : CraftItemStack.asBukkitCopy(pot.getContents()).getData();
}
@Override
public MaterialData getContents() {
return contents;
}
@Override
public void setContents(MaterialData item) {
contents = item;
}
@Override
public void applyTo(TileEntityFlowerPot pot) {
super.applyTo(pot);
pot.setContents(contents == null ? ItemStack.a : CraftItemStack.asNMSCopy(contents.toItemStack(1)));
}
}

View File

@@ -5,6 +5,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Furnace;
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.inventory.FurnaceInventory;
public class CraftFurnace extends CraftContainer<TileEntityFurnace> implements Furnace {
@@ -54,12 +55,12 @@ public class CraftFurnace extends CraftContainer<TileEntityFurnace> implements F
@Override
public String getCustomName() {
TileEntityFurnace furnace = this.getSnapshot();
return furnace.hasCustomName() ? furnace.getName() : null;
return furnace.hasCustomName() ? CraftChatMessage.fromComponent(furnace.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override

View File

@@ -1,11 +1,12 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.BlockJukeBox;
import net.minecraft.server.BlockJukeBox.TileEntityRecordPlayer;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.Blocks;
import net.minecraft.server.Item;
import net.minecraft.server.ItemStack;
import net.minecraft.server.TileEntity;
import net.minecraft.server.TileEntityJukeBox;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -13,13 +14,13 @@ import org.bukkit.block.Jukebox;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
public class CraftJukebox extends CraftBlockEntityState<TileEntityRecordPlayer> implements Jukebox {
public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> implements Jukebox {
public CraftJukebox(final Block block) {
super(block, TileEntityRecordPlayer.class);
super(block, TileEntityJukeBox.class);
}
public CraftJukebox(final Material material, TileEntityRecordPlayer te) {
public CraftJukebox(final Material material, TileEntityJukeBox te) {
super(material, te);
}
@@ -39,7 +40,7 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityRecordPlayer>
Blocks.JUKEBOX.getBlockData()
.set(BlockJukeBox.HAS_RECORD, true), 3);
}
world.playEffect(this.getLocation(), Effect.RECORD_PLAY, record.getId());
world.playEffect(this.getLocation(), Effect.RECORD_PLAY, Item.getId(CraftMagicNumbers.getItem((Material) record)));
}
return result;
@@ -77,12 +78,12 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityRecordPlayer>
public boolean eject() {
requirePlaced();
TileEntity tileEntity = this.getTileEntityFromWorld();
if (!(tileEntity instanceof TileEntityRecordPlayer)) return false;
if (!(tileEntity instanceof TileEntityJukeBox)) return false;
TileEntityRecordPlayer jukebox = (TileEntityRecordPlayer) tileEntity;
TileEntityJukeBox jukebox = (TileEntityJukeBox) tileEntity;
boolean result = !jukebox.getRecord().isEmpty();
CraftWorld world = (CraftWorld) this.getWorld();
((BlockJukeBox) Blocks.JUKEBOX).dropRecord(world.getHandle(), new BlockPosition(getX(), getY(), getZ()), null);
((BlockJukeBox) Blocks.JUKEBOX).dropRecord(world.getHandle(), new BlockPosition(getX(), getY(), getZ()));
return result;
}
}

View File

@@ -4,6 +4,7 @@ import net.minecraft.server.TileEntityLootable;
import org.bukkit.Material;
import org.bukkit.Nameable;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.util.CraftChatMessage;
public abstract class CraftLootable<T extends TileEntityLootable> extends CraftContainer<T> implements Nameable {
@@ -18,12 +19,12 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
@Override
public String getCustomName() {
T lootable = this.getSnapshot();
return lootable.hasCustomName() ? lootable.getName() : null;
return lootable.hasCustomName() ? CraftChatMessage.fromComponent(lootable.getCustomName()) : null;
}
@Override
public void setCustomName(String name) {
this.getSnapshot().setCustomName(name);
this.getSnapshot().setCustomName(CraftChatMessage.fromStringOrNull(name));
}
@Override

View File

@@ -1,83 +0,0 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.TileEntityNote;
import org.bukkit.Instrument;
import org.bukkit.Material;
import org.bukkit.Note;
import org.bukkit.block.Block;
import org.bukkit.block.NoteBlock;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
public class CraftNoteBlock extends CraftBlockEntityState<TileEntityNote> implements NoteBlock {
public CraftNoteBlock(final Block block) {
super(block, TileEntityNote.class);
}
public CraftNoteBlock(final Material material, final TileEntityNote te) {
super(material, te);
}
@Override
public Note getNote() {
return new Note(this.getSnapshot().note);
}
@Override
public byte getRawNote() {
return this.getSnapshot().note;
}
@Override
public void setNote(Note note) {
this.getSnapshot().note = note.getId();
}
@Override
public void setRawNote(byte note) {
this.getSnapshot().note = note;
}
@Override
public boolean play() {
Block block = getBlock();
if (block.getType() == Material.NOTE_BLOCK) {
TileEntityNote note = (TileEntityNote) this.getTileEntityFromWorld();
CraftWorld world = (CraftWorld) this.getWorld();
note.play(world.getHandle(), new BlockPosition(getX(), getY(), getZ()));
return true;
} else {
return false;
}
}
@Override
public boolean play(byte instrument, byte note) {
Block block = getBlock();
if (block.getType() == Material.NOTE_BLOCK) {
CraftWorld world = (CraftWorld) this.getWorld();
world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument, note);
return true;
} else {
return false;
}
}
@Override
public boolean play(Instrument instrument, Note note) {
Block block = getBlock();
if (block.getType() == Material.NOTE_BLOCK) {
CraftWorld world = (CraftWorld) this.getWorld();
world.getHandle().playBlockAction(new BlockPosition(getX(), getY(), getZ()), CraftMagicNumbers.getBlock(block), instrument.getType(), note.getId());
return true;
} else {
return false;
}
}
}

View File

@@ -12,13 +12,12 @@ import org.bukkit.SkullType;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
import org.bukkit.block.data.Rotatable;
public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implements Skull {
private static final int MAX_OWNER_LENGTH = 16;
private GameProfile profile;
private SkullType skullType;
private byte rotation;
public CraftSkull(final Block block) {
super(block, TileEntitySkull.class);
@@ -33,26 +32,6 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
super.load(skull);
profile = skull.getGameProfile();
skullType = getSkullType(skull.getSkullType());
rotation = (byte) skull.rotation;
}
static SkullType getSkullType(int id) {
switch (id) {
default:
case 0:
return SkullType.SKELETON;
case 1:
return SkullType.WITHER;
case 2:
return SkullType.ZOMBIE;
case 3:
return SkullType.PLAYER;
case 4:
return SkullType.CREEPER;
case 5:
return SkullType.DRAGON;
}
}
static int getSkullType(SkullType type) {
@@ -73,84 +52,6 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
}
}
static byte getBlockFace(BlockFace rotation) {
switch (rotation) {
case NORTH:
return 0;
case NORTH_NORTH_EAST:
return 1;
case NORTH_EAST:
return 2;
case EAST_NORTH_EAST:
return 3;
case EAST:
return 4;
case EAST_SOUTH_EAST:
return 5;
case SOUTH_EAST:
return 6;
case SOUTH_SOUTH_EAST:
return 7;
case SOUTH:
return 8;
case SOUTH_SOUTH_WEST:
return 9;
case SOUTH_WEST:
return 10;
case WEST_SOUTH_WEST:
return 11;
case WEST:
return 12;
case WEST_NORTH_WEST:
return 13;
case NORTH_WEST:
return 14;
case NORTH_NORTH_WEST:
return 15;
default:
throw new IllegalArgumentException("Invalid BlockFace rotation: " + rotation);
}
}
static BlockFace getBlockFace(byte rotation) {
switch (rotation) {
case 0:
return BlockFace.NORTH;
case 1:
return BlockFace.NORTH_NORTH_EAST;
case 2:
return BlockFace.NORTH_EAST;
case 3:
return BlockFace.EAST_NORTH_EAST;
case 4:
return BlockFace.EAST;
case 5:
return BlockFace.EAST_SOUTH_EAST;
case 6:
return BlockFace.SOUTH_EAST;
case 7:
return BlockFace.SOUTH_SOUTH_EAST;
case 8:
return BlockFace.SOUTH;
case 9:
return BlockFace.SOUTH_SOUTH_WEST;
case 10:
return BlockFace.SOUTH_WEST;
case 11:
return BlockFace.WEST_SOUTH_WEST;
case 12:
return BlockFace.WEST;
case 13:
return BlockFace.WEST_NORTH_WEST;
case 14:
return BlockFace.NORTH_WEST;
case 15:
return BlockFace.NORTH_NORTH_WEST;
default:
throw new AssertionError(rotation);
}
}
@Override
public boolean hasOwner() {
return profile != null;
@@ -172,10 +73,6 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
return false;
}
if (skullType != SkullType.PLAYER) {
skullType = SkullType.PLAYER;
}
this.profile = profile;
return true;
}
@@ -199,47 +96,58 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
public void setOwningPlayer(OfflinePlayer player) {
Preconditions.checkNotNull(player, "player");
if (skullType != SkullType.PLAYER) {
skullType = SkullType.PLAYER;
}
this.profile = new GameProfile(player.getUniqueId(), player.getName());
}
@Override
public BlockFace getRotation() {
return getBlockFace(rotation);
return ((Rotatable) getBlockData()).getRotation();
}
@Override
public void setRotation(BlockFace rotation) {
this.rotation = getBlockFace(rotation);
Rotatable blockData = (Rotatable) getBlockData();
blockData.setRotation(rotation);
setBlockData(blockData);
}
@Override
public SkullType getSkullType() {
return skullType;
switch (getType()) {
case SKELETON_SKULL:
case SKELETON_WALL_SKULL:
return SkullType.SKELETON;
case WITHER_SKELETON_SKULL:
case WITHER_SKELETON_WALL_SKULL:
return SkullType.WITHER;
case ZOMBIE_HEAD:
case ZOMBIE_WALL_HEAD:
return SkullType.ZOMBIE;
case PLAYER_HEAD:
case PLAYER_WALL_HEAD:
return SkullType.PLAYER;
case CREEPER_HEAD:
case CREEPER_WALL_HEAD:
return SkullType.CREEPER;
case DRAGON_HEAD:
case DRAGON_WALL_HEAD:
return SkullType.DRAGON;
default:
throw new IllegalArgumentException("Unknown SkullType for " + getType());
}
}
@Override
public void setSkullType(SkullType skullType) {
this.skullType = skullType;
if (skullType != SkullType.PLAYER) {
profile = null;
}
throw new UnsupportedOperationException("Must change block type");
}
@Override
public void applyTo(TileEntitySkull skull) {
super.applyTo(skull);
if (skullType == SkullType.PLAYER) {
if (getSkullType() == SkullType.PLAYER) {
skull.setGameProfile(profile);
} else {
skull.setSkullType(getSkullType(skullType));
}
skull.setRotation(rotation);
}
}

View File

@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.server.BlockPosition;
import net.minecraft.server.BlockPropertyStructureMode;
import net.minecraft.server.EnumBlockMirror;
import net.minecraft.server.EnumBlockRotation;
import net.minecraft.server.TileEntityStructure;
@@ -30,35 +31,35 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
@Override
public String getStructureName() {
return getSnapshot().a(); // PAIL: rename getStructureName
return getSnapshot().getStructureName();
}
@Override
public void setStructureName(String name) {
Preconditions.checkArgument(name != null, "Structure Name cannot be null");
getSnapshot().a(name); // PAIL: rename setStructureName
getSnapshot().setStructureName(name);
}
@Override
public String getAuthor() {
return getSnapshot().f;
return getSnapshot().author;
}
@Override
public void setAuthor(String author) {
Preconditions.checkArgument(author != null && !author.isEmpty(), "Author name cannot be null nor empty");
getSnapshot().f = author; // PAIL: rename author
getSnapshot().author = author;
}
@Override
public void setAuthor(LivingEntity entity) {
Preconditions.checkArgument(entity != null, "Structure Block author entity cannot be null");
getSnapshot().a(((CraftLivingEntity) entity).getHandle()); // PAIL: rename setAuthor
getSnapshot().setAuthor(((CraftLivingEntity) entity).getHandle());
}
@Override
public BlockVector getRelativePosition() {
return new BlockVector(getSnapshot().h.getX(), getSnapshot().h.getY(), getSnapshot().h.getZ()); // PAIL: rename relativePosition
return new BlockVector(getSnapshot().relativePosition.getX(), getSnapshot().relativePosition.getY(), getSnapshot().relativePosition.getZ());
}
@Override
@@ -66,12 +67,12 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
Validate.isTrue(isBetween(vector.getBlockX(), -MAX_SIZE, MAX_SIZE), "Structure Size (X) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockY(), -MAX_SIZE, MAX_SIZE), "Structure Size (Y) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockZ(), -MAX_SIZE, MAX_SIZE), "Structure Size (Z) must be between -" + MAX_SIZE + " and " + MAX_SIZE);
getSnapshot().h = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); // PAIL: rename relativePosition
getSnapshot().relativePosition = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}
@Override
public BlockVector getStructureSize() {
return new BlockVector(getSnapshot().i.getX(), getSnapshot().i.getY(), getSnapshot().i.getZ()); // PAIL: rename size
return new BlockVector(getSnapshot().size.getX(), getSnapshot().size.getY(), getSnapshot().size.getZ());
}
@Override
@@ -79,101 +80,101 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
Validate.isTrue(isBetween(vector.getBlockX(), 0, MAX_SIZE), "Structure Size (X) must be between 0 and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockY(), 0, MAX_SIZE), "Structure Size (Y) must be between 0 and " + MAX_SIZE);
Validate.isTrue(isBetween(vector.getBlockZ(), 0, MAX_SIZE), "Structure Size (Z) must be between 0 and " + MAX_SIZE);
getSnapshot().i = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); // PAIL: rename size
getSnapshot().size = new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
}
@Override
public void setMirror(Mirror mirror) {
getSnapshot().j = EnumBlockMirror.valueOf(mirror.name()); // PAIL: rename mirror
getSnapshot().mirror = EnumBlockMirror.valueOf(mirror.name());
}
@Override
public Mirror getMirror() {
return Mirror.valueOf(getSnapshot().j.name()); // PAIL: rename mirror
return Mirror.valueOf(getSnapshot().mirror.name());
}
@Override
public void setRotation(StructureRotation rotation) {
getSnapshot().k = EnumBlockRotation.valueOf(rotation.name()); // PAIL: rename rotation
getSnapshot().rotation = EnumBlockRotation.valueOf(rotation.name());
}
@Override
public StructureRotation getRotation() {
return StructureRotation.valueOf(getSnapshot().k.name()); // PAIL: rename rotation
return StructureRotation.valueOf(getSnapshot().rotation.name());
}
@Override
public void setUsageMode(UsageMode mode) {
getSnapshot().a(TileEntityStructure.UsageMode.valueOf(mode.name())); // PAIL: rename setUsageMode
getSnapshot().setUsageMode(BlockPropertyStructureMode.valueOf(mode.name()));
}
@Override
public UsageMode getUsageMode() {
return UsageMode.valueOf(getSnapshot().k().name()); // PAIL rename getUsageMode
return UsageMode.valueOf(getSnapshot().getUsageMode().name());
}
@Override
public void setIgnoreEntities(boolean flag) {
getSnapshot().m = flag; // PAIL: rename ignoreEntities
getSnapshot().ignoreEntities = flag;
}
@Override
public boolean isIgnoreEntities() {
return getSnapshot().m; // PAIL: rename ignoreEntities
return getSnapshot().ignoreEntities;
}
@Override
public void setShowAir(boolean showAir) {
getSnapshot().o = showAir; // PAIL rename showAir
getSnapshot().showAir = showAir;
}
@Override
public boolean isShowAir() {
return getSnapshot().o; // PAIL: rename showAir
return getSnapshot().showAir;
}
@Override
public void setBoundingBoxVisible(boolean showBoundingBox) {
getSnapshot().p = showBoundingBox; // PAIL: rename boundingBoxVisible
getSnapshot().showBoundingBox = showBoundingBox;
}
@Override
public boolean isBoundingBoxVisible() {
return getSnapshot().p; // PAIL: rename boundingBoxVisible
return getSnapshot().showBoundingBox;
}
@Override
public void setIntegrity(float integrity) {
Validate.isTrue(isBetween(integrity, 0.0f, 1.0f), "Integrity must be between 0.0f and 1.0f");
getSnapshot().q = integrity; // PAIL: rename integrity
getSnapshot().integrity = integrity;
}
@Override
public float getIntegrity() {
return getSnapshot().q; // PAIL: rename integrity
return getSnapshot().integrity;
}
@Override
public void setSeed(long seed) {
getSnapshot().r = seed; // PAIL: rename seed
getSnapshot().seed = seed;
}
@Override
public long getSeed() {
return getSnapshot().r; // PAIL: rename seed
return getSnapshot().seed;
}
@Override
public void setMetadata(String metadata) {
Validate.notNull(metadata, "Structure metadata cannot be null");
if (getUsageMode() == UsageMode.DATA) {
getSnapshot().g = metadata; // PAIL: rename metadata
getSnapshot().metadata = metadata;
}
}
@Override
public String getMetadata() {
return getSnapshot().g; // PAIL: rename metadata
return getSnapshot().metadata;
}
private static boolean isBetween(int num, int min, int max) {

View File

@@ -0,0 +1,23 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Ageable;
public abstract class CraftAgeable extends CraftBlockData implements Ageable {
private static final net.minecraft.server.BlockStateInteger AGE = getInteger("age");
@Override
public int getAge() {
return get(AGE);
}
@Override
public void setAge(int age) {
set(AGE, age);
}
@Override
public int getMaximumAge() {
return getMax(AGE);
}
}

View File

@@ -0,0 +1,23 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.AnaloguePowerable;
public abstract class CraftAnaloguePowerable extends CraftBlockData implements AnaloguePowerable {
private static final net.minecraft.server.BlockStateInteger POWER = getInteger("power");
@Override
public int getPower() {
return get(POWER);
}
@Override
public void setPower(int power) {
set(POWER, power);
}
@Override
public int getMaximumPower() {
return getMax(POWER);
}
}

View File

@@ -0,0 +1,18 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Attachable;
public abstract class CraftAttachable extends CraftBlockData implements Attachable {
private static final net.minecraft.server.BlockStateBoolean ATTACHED = getBoolean("attached");
@Override
public boolean isAttached() {
return get(ATTACHED);
}
@Override
public void setAttached(boolean attached) {
set(ATTACHED, attached);
}
}

View File

@@ -0,0 +1,18 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Bisected;
public class CraftBisected extends CraftBlockData implements Bisected {
private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum("half");
@Override
public Half getHalf() {
return get(HALF, Half.class);
}
@Override
public void setHalf(Half half) {
set(HALF, half);
}
}

View File

@@ -0,0 +1,356 @@
package org.bukkit.craftbukkit.block.data;
import com.google.common.base.Preconditions;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableSet;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import net.minecraft.server.ArgumentBlock;
import net.minecraft.server.Block;
import net.minecraft.server.BlockStateBoolean;
import net.minecraft.server.BlockStateEnum;
import net.minecraft.server.BlockStateInteger;
import net.minecraft.server.EnumDirection;
import net.minecraft.server.IBlockData;
import net.minecraft.server.IBlockState;
import net.minecraft.server.INamable;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
public class CraftBlockData implements BlockData {
private IBlockData state;
protected CraftBlockData() {
throw new AssertionError("Template Constructor");
}
protected CraftBlockData(IBlockData state) {
this.state = state;
}
@Override
public Material getMaterial() {
return CraftMagicNumbers.getMaterial(state.getBlock());
}
public IBlockData getState() {
return state;
}
protected <B extends Enum<B>> B get(BlockStateEnum<?> nms, Class<B> bukkit) {
return toBukkit(state.get(nms), bukkit);
}
@SuppressWarnings("unchecked")
protected <B extends Enum<B>> Set<B> getValues(BlockStateEnum<?> nms, Class<B> bukkit) {
ImmutableSet.Builder<B> values = ImmutableSet.builder();
for (Enum<?> e : nms.d()) {
values.add(toBukkit(e, bukkit));
}
return values.build();
}
protected <B extends Enum<B>, N extends Enum<N> & INamable> void set(BlockStateEnum<N> nms, Enum<B> bukkit) {
this.state = this.state.set(nms, toNMS(bukkit, nms.b()));
}
private static final BiMap<Enum<?>, Enum<?>> nmsToBukkit = HashBiMap.create();
@SuppressWarnings("unchecked")
private static <B extends Enum<B>> B toBukkit(Enum<?> nms, Class<B> bukkit) {
Enum<?> converted = nmsToBukkit.get(nms);
if (converted != null) {
return (B) converted;
}
if (nms instanceof EnumDirection) {
converted = CraftBlock.notchToBlockFace((EnumDirection) nms);
} else {
converted = bukkit.getEnumConstants()[nms.ordinal()];
}
Preconditions.checkState(converted != null, "Could not convert enum %s->%s", nms, bukkit);
nmsToBukkit.put(nms, converted);
return (B) converted;
}
@SuppressWarnings("unchecked")
private static <N extends Enum<N> & INamable> N toNMS(Enum<?> bukkit, Class<N> nms) {
Enum<?> converted = nmsToBukkit.inverse().get(bukkit);
if (converted != null) {
return (N) converted;
}
if (bukkit instanceof BlockFace) {
converted = CraftBlock.blockFaceToNotch((BlockFace) bukkit);
} else {
converted = nms.getEnumConstants()[bukkit.ordinal()];
}
Preconditions.checkState(converted != null, "Could not convert enum %s->%s", nms, bukkit);
nmsToBukkit.put(converted, bukkit);
return (N) converted;
}
protected <T extends Comparable<T>> T get(IBlockState<T> ibs) {
// Straight integer or boolean getter
return this.state.get(ibs);
}
public <T extends Comparable<T>, V extends T> void set(IBlockState<T> ibs, V v) {
// Straight integer or boolean setter
this.state = this.state.set(ibs, v);
}
@Override
public String getAsString() {
return state.toString();
}
@Override
public BlockData clone() {
try {
return (BlockData) super.clone();
} catch (CloneNotSupportedException ex) {
throw new AssertionError("Clone not supported", ex);
}
}
@Override
public String toString() {
return "CraftBlockData{" + state.toString() + "}";
}
@Override
public boolean equals(Object obj) {
return obj instanceof CraftBlockData && state.equals(((CraftBlockData) obj).state);
}
@Override
public int hashCode() {
return state.hashCode();
}
protected static BlockStateBoolean getBoolean(String name) {
throw new AssertionError("Template Method");
}
protected static BlockStateBoolean getBoolean(String name, boolean optional) {
throw new AssertionError("Template Method");
}
protected static BlockStateEnum<?> getEnum(String name) {
throw new AssertionError("Template Method");
}
protected static BlockStateInteger getInteger(String name) {
throw new AssertionError("Template Method");
}
protected static BlockStateBoolean getBoolean(Class<? extends Block> block, String name) {
return (BlockStateBoolean) getState(block, name, false);
}
protected static BlockStateBoolean getBoolean(Class<? extends Block> block, String name, boolean optional) {
return (BlockStateBoolean) getState(block, name, optional);
}
protected static BlockStateEnum<?> getEnum(Class<? extends Block> block, String name) {
return (BlockStateEnum<?>) getState(block, name, false);
}
protected static BlockStateInteger getInteger(Class<? extends Block> block, String name) {
return (BlockStateInteger) getState(block, name, false);
}
private static IBlockState<?> getState(Class<? extends Block> block, String name, boolean optional) {
IBlockState<?> state = null;
for (Block instance : (Iterable<Block>) Block.REGISTRY) { // Eclipse fail
if (instance.getClass() == block) {
if (state == null) {
state = instance.getStates().a(name);
} else {
IBlockState<?> newState = instance.getStates().a(name);
Preconditions.checkState(state == newState, "State mistmatch %s,%s", state, newState);
}
}
}
Preconditions.checkState(optional || state != null, "Null state for %s,%s", block, name);
return state;
}
protected static int getMin(BlockStateInteger state) {
return state.min;
}
protected static int getMax(BlockStateInteger state) {
return state.max;
}
//
private static final Map<Class<? extends Block>, Class<? extends CraftBlockData>> MAP = new HashMap<>();
static {
register(net.minecraft.server.BlockAnvil.class, org.bukkit.craftbukkit.block.impl.CraftAnvil.class);
register(net.minecraft.server.BlockBanner.class, org.bukkit.craftbukkit.block.impl.CraftBanner.class);
register(net.minecraft.server.BlockBannerWall.class, org.bukkit.craftbukkit.block.impl.CraftBannerWall.class);
register(net.minecraft.server.BlockBed.class, org.bukkit.craftbukkit.block.impl.CraftBed.class);
register(net.minecraft.server.BlockBeetroot.class, org.bukkit.craftbukkit.block.impl.CraftBeetroot.class);
register(net.minecraft.server.BlockBrewingStand.class, org.bukkit.craftbukkit.block.impl.CraftBrewingStand.class);
register(net.minecraft.server.BlockBubbleColumn.class, org.bukkit.craftbukkit.block.impl.CraftBubbleColumn.class);
register(net.minecraft.server.BlockCactus.class, org.bukkit.craftbukkit.block.impl.CraftCactus.class);
register(net.minecraft.server.BlockCake.class, org.bukkit.craftbukkit.block.impl.CraftCake.class);
register(net.minecraft.server.BlockCarrots.class, org.bukkit.craftbukkit.block.impl.CraftCarrots.class);
register(net.minecraft.server.BlockCauldron.class, org.bukkit.craftbukkit.block.impl.CraftCauldron.class);
register(net.minecraft.server.BlockChest.class, org.bukkit.craftbukkit.block.impl.CraftChest.class);
register(net.minecraft.server.BlockChestTrapped.class, org.bukkit.craftbukkit.block.impl.CraftChestTrapped.class);
register(net.minecraft.server.BlockChorusFlower.class, org.bukkit.craftbukkit.block.impl.CraftChorusFlower.class);
register(net.minecraft.server.BlockChorusFruit.class, org.bukkit.craftbukkit.block.impl.CraftChorusFruit.class);
register(net.minecraft.server.BlockCobbleWall.class, org.bukkit.craftbukkit.block.impl.CraftCobbleWall.class);
register(net.minecraft.server.BlockCocoa.class, org.bukkit.craftbukkit.block.impl.CraftCocoa.class);
register(net.minecraft.server.BlockCommand.class, org.bukkit.craftbukkit.block.impl.CraftCommand.class);
register(net.minecraft.server.BlockCoralFan.class, org.bukkit.craftbukkit.block.impl.CraftCoralFan.class);
register(net.minecraft.server.BlockCrops.class, org.bukkit.craftbukkit.block.impl.CraftCrops.class);
register(net.minecraft.server.BlockDaylightDetector.class, org.bukkit.craftbukkit.block.impl.CraftDaylightDetector.class);
register(net.minecraft.server.BlockDirtSnow.class, org.bukkit.craftbukkit.block.impl.CraftDirtSnow.class);
register(net.minecraft.server.BlockDispenser.class, org.bukkit.craftbukkit.block.impl.CraftDispenser.class);
register(net.minecraft.server.BlockDoor.class, org.bukkit.craftbukkit.block.impl.CraftDoor.class);
register(net.minecraft.server.BlockDropper.class, org.bukkit.craftbukkit.block.impl.CraftDropper.class);
register(net.minecraft.server.BlockEndRod.class, org.bukkit.craftbukkit.block.impl.CraftEndRod.class);
register(net.minecraft.server.BlockEnderChest.class, org.bukkit.craftbukkit.block.impl.CraftEnderChest.class);
register(net.minecraft.server.BlockEnderPortalFrame.class, org.bukkit.craftbukkit.block.impl.CraftEnderPortalFrame.class);
register(net.minecraft.server.BlockFence.class, org.bukkit.craftbukkit.block.impl.CraftFence.class);
register(net.minecraft.server.BlockFenceGate.class, org.bukkit.craftbukkit.block.impl.CraftFenceGate.class);
register(net.minecraft.server.BlockFire.class, org.bukkit.craftbukkit.block.impl.CraftFire.class);
register(net.minecraft.server.BlockFloorSign.class, org.bukkit.craftbukkit.block.impl.CraftFloorSign.class);
register(net.minecraft.server.BlockFluids.class, org.bukkit.craftbukkit.block.impl.CraftFluids.class);
register(net.minecraft.server.BlockFurnace.class, org.bukkit.craftbukkit.block.impl.CraftFurnace.class);
register(net.minecraft.server.BlockGlassPane.class, org.bukkit.craftbukkit.block.impl.CraftGlassPane.class);
register(net.minecraft.server.BlockGlazedTerracotta.class, org.bukkit.craftbukkit.block.impl.CraftGlazedTerracotta.class);
register(net.minecraft.server.BlockGrass.class, org.bukkit.craftbukkit.block.impl.CraftGrass.class);
register(net.minecraft.server.BlockHay.class, org.bukkit.craftbukkit.block.impl.CraftHay.class);
register(net.minecraft.server.BlockHopper.class, org.bukkit.craftbukkit.block.impl.CraftHopper.class);
register(net.minecraft.server.BlockHugeMushroom.class, org.bukkit.craftbukkit.block.impl.CraftHugeMushroom.class);
register(net.minecraft.server.BlockIceFrost.class, org.bukkit.craftbukkit.block.impl.CraftIceFrost.class);
register(net.minecraft.server.BlockIronBars.class, org.bukkit.craftbukkit.block.impl.CraftIronBars.class);
register(net.minecraft.server.BlockJukeBox.class, org.bukkit.craftbukkit.block.impl.CraftJukeBox.class);
register(net.minecraft.server.BlockKelp.class, org.bukkit.craftbukkit.block.impl.CraftKelp.class);
register(net.minecraft.server.BlockLadder.class, org.bukkit.craftbukkit.block.impl.CraftLadder.class);
register(net.minecraft.server.BlockLeaves.class, org.bukkit.craftbukkit.block.impl.CraftLeaves.class);
register(net.minecraft.server.BlockLever.class, org.bukkit.craftbukkit.block.impl.CraftLever.class);
register(net.minecraft.server.BlockLogAbstract.class, org.bukkit.craftbukkit.block.impl.CraftLogAbstract.class);
register(net.minecraft.server.BlockMinecartDetector.class, org.bukkit.craftbukkit.block.impl.CraftMinecartDetector.class);
register(net.minecraft.server.BlockMinecartTrack.class, org.bukkit.craftbukkit.block.impl.CraftMinecartTrack.class);
register(net.minecraft.server.BlockMycel.class, org.bukkit.craftbukkit.block.impl.CraftMycel.class);
register(net.minecraft.server.BlockNetherWart.class, org.bukkit.craftbukkit.block.impl.CraftNetherWart.class);
register(net.minecraft.server.BlockNote.class, org.bukkit.craftbukkit.block.impl.CraftNote.class);
register(net.minecraft.server.BlockObserver.class, org.bukkit.craftbukkit.block.impl.CraftObserver.class);
register(net.minecraft.server.BlockPiston.class, org.bukkit.craftbukkit.block.impl.CraftPiston.class);
register(net.minecraft.server.BlockPistonExtension.class, org.bukkit.craftbukkit.block.impl.CraftPistonExtension.class);
register(net.minecraft.server.BlockPistonMoving.class, org.bukkit.craftbukkit.block.impl.CraftPistonMoving.class);
register(net.minecraft.server.BlockPortal.class, org.bukkit.craftbukkit.block.impl.CraftPortal.class);
register(net.minecraft.server.BlockPotatoes.class, org.bukkit.craftbukkit.block.impl.CraftPotatoes.class);
register(net.minecraft.server.BlockPoweredRail.class, org.bukkit.craftbukkit.block.impl.CraftPoweredRail.class);
register(net.minecraft.server.BlockPressurePlateBinary.class, org.bukkit.craftbukkit.block.impl.CraftPressurePlateBinary.class);
register(net.minecraft.server.BlockPressurePlateWeighted.class, org.bukkit.craftbukkit.block.impl.CraftPressurePlateWeighted.class);
register(net.minecraft.server.BlockPumpkinCarved.class, org.bukkit.craftbukkit.block.impl.CraftPumpkinCarved.class);
register(net.minecraft.server.BlockRedstoneComparator.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneComparator.class);
register(net.minecraft.server.BlockRedstoneLamp.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneLamp.class);
register(net.minecraft.server.BlockRedstoneOre.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneOre.class);
register(net.minecraft.server.BlockRedstoneTorch.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneTorch.class);
register(net.minecraft.server.BlockRedstoneTorchWall.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneTorchWall.class);
register(net.minecraft.server.BlockRedstoneWire.class, org.bukkit.craftbukkit.block.impl.CraftRedstoneWire.class);
register(net.minecraft.server.BlockReed.class, org.bukkit.craftbukkit.block.impl.CraftReed.class);
register(net.minecraft.server.BlockRepeater.class, org.bukkit.craftbukkit.block.impl.CraftRepeater.class);
register(net.minecraft.server.BlockRotatable.class, org.bukkit.craftbukkit.block.impl.CraftRotatable.class);
register(net.minecraft.server.BlockSapling.class, org.bukkit.craftbukkit.block.impl.CraftSapling.class);
register(net.minecraft.server.BlockSeaPickle.class, org.bukkit.craftbukkit.block.impl.CraftSeaPickle.class);
register(net.minecraft.server.BlockShulkerBox.class, org.bukkit.craftbukkit.block.impl.CraftShulkerBox.class);
register(net.minecraft.server.BlockSkull.class, org.bukkit.craftbukkit.block.impl.CraftSkull.class);
register(net.minecraft.server.BlockSkullPlayer.class, org.bukkit.craftbukkit.block.impl.CraftSkullPlayer.class);
register(net.minecraft.server.BlockSkullPlayerWall.class, org.bukkit.craftbukkit.block.impl.CraftSkullPlayerWall.class);
register(net.minecraft.server.BlockSkullWall.class, org.bukkit.craftbukkit.block.impl.CraftSkullWall.class);
register(net.minecraft.server.BlockSnow.class, org.bukkit.craftbukkit.block.impl.CraftSnow.class);
register(net.minecraft.server.BlockSoil.class, org.bukkit.craftbukkit.block.impl.CraftSoil.class);
register(net.minecraft.server.BlockStainedGlassPane.class, org.bukkit.craftbukkit.block.impl.CraftStainedGlassPane.class);
register(net.minecraft.server.BlockStairs.class, org.bukkit.craftbukkit.block.impl.CraftStairs.class);
register(net.minecraft.server.BlockStem.class, org.bukkit.craftbukkit.block.impl.CraftStem.class);
register(net.minecraft.server.BlockStemAttached.class, org.bukkit.craftbukkit.block.impl.CraftStemAttached.class);
register(net.minecraft.server.BlockStepAbstract.class, org.bukkit.craftbukkit.block.impl.CraftStepAbstract.class);
register(net.minecraft.server.BlockStoneButton.class, org.bukkit.craftbukkit.block.impl.CraftStoneButton.class);
register(net.minecraft.server.BlockStructure.class, org.bukkit.craftbukkit.block.impl.CraftStructure.class);
register(net.minecraft.server.BlockTallPlantFlower.class, org.bukkit.craftbukkit.block.impl.CraftTallPlantFlower.class);
register(net.minecraft.server.BlockTallPlantShearable.class, org.bukkit.craftbukkit.block.impl.CraftTallPlantShearable.class);
register(net.minecraft.server.BlockTallSeaGrass.class, org.bukkit.craftbukkit.block.impl.CraftTallSeaGrass.class);
register(net.minecraft.server.BlockTorchWall.class, org.bukkit.craftbukkit.block.impl.CraftTorchWall.class);
register(net.minecraft.server.BlockTrapdoor.class, org.bukkit.craftbukkit.block.impl.CraftTrapdoor.class);
register(net.minecraft.server.BlockTripwire.class, org.bukkit.craftbukkit.block.impl.CraftTripwire.class);
register(net.minecraft.server.BlockTripwireHook.class, org.bukkit.craftbukkit.block.impl.CraftTripwireHook.class);
register(net.minecraft.server.BlockTurtleEgg.class, org.bukkit.craftbukkit.block.impl.CraftTurtleEgg.class);
register(net.minecraft.server.BlockVine.class, org.bukkit.craftbukkit.block.impl.CraftVine.class);
register(net.minecraft.server.BlockWallSign.class, org.bukkit.craftbukkit.block.impl.CraftWallSign.class);
register(net.minecraft.server.BlockWitherSkull.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkull.class);
register(net.minecraft.server.BlockWitherSkullWall.class, org.bukkit.craftbukkit.block.impl.CraftWitherSkullWall.class);
register(net.minecraft.server.BlockWoodButton.class, org.bukkit.craftbukkit.block.impl.CraftWoodButton.class);
}
private static void register(Class<? extends Block> nms, Class<? extends CraftBlockData> bukkit) {
Preconditions.checkState(MAP.put(nms, bukkit) == null, "Duplicate mapping %s->%s", nms, bukkit);
}
public static CraftBlockData newData(Material material, String data) {
IBlockData blockData;
Block block = CraftMagicNumbers.getBlock(material);
// Data provided, use it
if (data != null) {
try {
// Material provided, force that material in
if (block != null) {
data = Block.REGISTRY.b(block) + data;
}
ArgumentBlock arg = new ArgumentBlock(new StringReader(data), false).a(false);
blockData = arg.b();
} catch (CommandSyntaxException ex) {
throw new IllegalArgumentException("Could not parse data: " + data, ex);
}
} else {
blockData = block.getBlockData();
}
return fromData(blockData);
}
public static CraftBlockData fromData(IBlockData data) {
Class<? extends CraftBlockData> craft = MAP.get(data.getBlock().getClass());
if (craft == null) {
craft = CraftBlockData.class;
}
CraftBlockData ret;
try {
ret = craft.getDeclaredConstructor(IBlockData.class).newInstance(data);
} catch (ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
return ret;
}
}

View File

@@ -0,0 +1,23 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Directional;
public abstract class CraftDirectional extends CraftBlockData implements Directional {
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum("facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,23 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Levelled;
public abstract class CraftLevelled extends CraftBlockData implements Levelled {
private static final net.minecraft.server.BlockStateInteger LEVEL = getInteger("level");
@Override
public int getLevel() {
return get(LEVEL);
}
@Override
public void setLevel(int level) {
set(LEVEL, level);
}
@Override
public int getMaximumLevel() {
return getMax(LEVEL);
}
}

View File

@@ -0,0 +1,18 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Lightable;
public abstract class CraftLightable extends CraftBlockData implements Lightable {
private static final net.minecraft.server.BlockStateBoolean LIT = getBoolean("lit");
@Override
public boolean isLit() {
return get(LIT);
}
@Override
public void setLit(boolean lit) {
set(LIT, lit);
}
}

View File

@@ -0,0 +1,46 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.MultipleFacing;
public abstract class CraftMultipleFacing extends CraftBlockData implements MultipleFacing {
private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
getBoolean("north", true), getBoolean("east", true), getBoolean("south", true), getBoolean("west", true), getBoolean("up", true), getBoolean("down", true)
};
@Override
public boolean hasFace(org.bukkit.block.BlockFace face) {
return get(FACES[face.ordinal()]);
}
@Override
public void setFace(org.bukkit.block.BlockFace face, boolean has) {
set(FACES[face.ordinal()], has);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null && get(FACES[i])) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
}

View File

@@ -0,0 +1,18 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Openable;
public abstract class CraftOpenable extends CraftBlockData implements Openable {
private static final net.minecraft.server.BlockStateBoolean OPEN = getBoolean("open");
@Override
public boolean isOpen() {
return get(OPEN);
}
@Override
public void setOpen(boolean open) {
set(OPEN, open);
}
}

View File

@@ -0,0 +1,23 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Orientable;
public class CraftOrientable extends CraftBlockData implements Orientable {
private static final net.minecraft.server.BlockStateEnum<?> AXIS = getEnum("axis");
@Override
public org.bukkit.Axis getAxis() {
return get(AXIS, org.bukkit.Axis.class);
}
@Override
public void setAxis(org.bukkit.Axis axis) {
set(AXIS, axis);
}
@Override
public java.util.Set<org.bukkit.Axis> getAxes() {
return getValues(AXIS, org.bukkit.Axis.class);
}
}

View File

@@ -0,0 +1,18 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Powerable;
public abstract class CraftPowerable extends CraftBlockData implements Powerable {
private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean("powered");
@Override
public boolean isPowered() {
return get(POWERED);
}
@Override
public void setPowered(boolean powered) {
set(POWERED, powered);
}
}

View File

@@ -0,0 +1,23 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Rail;
public abstract class CraftRail extends CraftBlockData implements Rail {
private static final net.minecraft.server.BlockStateEnum<?> SHAPE = getEnum("shape");
@Override
public Shape getShape() {
return get(SHAPE, Shape.class);
}
@Override
public void setShape(Shape shape) {
set(SHAPE, shape);
}
@Override
public java.util.Set<Shape> getShapes() {
return getValues(SHAPE, Shape.class);
}
}

View File

@@ -0,0 +1,107 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Rotatable;
public abstract class CraftRotatable extends CraftBlockData implements Rotatable {
private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger("rotation");
@Override
public org.bukkit.block.BlockFace getRotation() {
int data = get(ROTATION);
switch (data) {
case 0x0:
return org.bukkit.block.BlockFace.SOUTH;
case 0x1:
return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
case 0x2:
return org.bukkit.block.BlockFace.SOUTH_WEST;
case 0x3:
return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
case 0x4:
return org.bukkit.block.BlockFace.WEST;
case 0x5:
return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
case 0x6:
return org.bukkit.block.BlockFace.NORTH_WEST;
case 0x7:
return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
case 0x8:
return org.bukkit.block.BlockFace.NORTH;
case 0x9:
return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
case 0xA:
return org.bukkit.block.BlockFace.NORTH_EAST;
case 0xB:
return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
case 0xC:
return org.bukkit.block.BlockFace.EAST;
case 0xD:
return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
case 0xE:
return org.bukkit.block.BlockFace.SOUTH_EAST;
case 0xF:
return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
default:
throw new IllegalArgumentException("Unknown rotation " + data);
}
}
@Override
public void setRotation(org.bukkit.block.BlockFace rotation) {
int val;
switch (rotation) {
case SOUTH:
val = 0x0;
break;
case SOUTH_SOUTH_WEST:
val = 0x1;
break;
case SOUTH_WEST:
val = 0x2;
break;
case WEST_SOUTH_WEST:
val = 0x3;
break;
case WEST:
val = 0x4;
break;
case WEST_NORTH_WEST:
val = 0x5;
break;
case NORTH_WEST:
val = 0x6;
break;
case NORTH_NORTH_WEST:
val = 0x7;
break;
case NORTH:
val = 0x8;
break;
case NORTH_NORTH_EAST:
val = 0x9;
break;
case NORTH_EAST:
val = 0xA;
break;
case EAST_NORTH_EAST:
val = 0xB;
break;
case EAST:
val = 0xC;
break;
case EAST_SOUTH_EAST:
val = 0xD;
break;
case SOUTH_EAST:
val = 0xE;
break;
case SOUTH_SOUTH_EAST:
val = 0xF;
break;
default:
throw new IllegalArgumentException("Illegal rotation " + rotation);
}
set(ROTATION, val);
}
}

View File

@@ -0,0 +1,18 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Snowable;
public abstract class CraftSnowable extends CraftBlockData implements Snowable {
private static final net.minecraft.server.BlockStateBoolean SNOWY = getBoolean("snowy");
@Override
public boolean isSnowy() {
return get(SNOWY);
}
@Override
public void setSnowy(boolean snowy) {
set(SNOWY, snowy);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftWaterlogged extends CraftBlockData implements Waterlogged {
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean("waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,25 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Bed;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftBed extends CraftBlockData implements Bed {
private static final net.minecraft.server.BlockStateEnum<?> PART = getEnum("part");
private static final net.minecraft.server.BlockStateBoolean OCCUPIED = getBoolean("occupied");
@Override
public Part getPart() {
return get(PART, Part.class);
}
@Override
public void setPart(Part part) {
set(PART, part);
}
@Override
public boolean isOccupied() {
return get(OCCUPIED);
}
}

View File

@@ -0,0 +1,39 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.BrewingStand;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftBrewingStand extends CraftBlockData implements BrewingStand {
private static final net.minecraft.server.BlockStateBoolean[] HAS_BOTTLE = new net.minecraft.server.BlockStateBoolean[]{
getBoolean("has_bottle_0"), getBoolean("has_bottle_1"), getBoolean("has_bottle_2")
};
@Override
public boolean hasBottle(int bottle) {
return get(HAS_BOTTLE[bottle]);
}
@Override
public void setBottle(int bottle, boolean has) {
set(HAS_BOTTLE[bottle], has);
}
@Override
public java.util.Set<Integer> getBottles() {
com.google.common.collect.ImmutableSet.Builder<Integer> bottles = com.google.common.collect.ImmutableSet.builder();
for (int index = 0; index < getMaximumBottles(); index++) {
if (hasBottle(index)) {
bottles.add(index);
}
}
return bottles.build();
}
@Override
public int getMaximumBottles() {
return HAS_BOTTLE.length;
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.BubbleColumn;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftBubbleColumn extends CraftBlockData implements BubbleColumn {
private static final net.minecraft.server.BlockStateBoolean DRAG = getBoolean("drag");
@Override
public boolean isDrag() {
return get(DRAG);
}
@Override
public void setDrag(boolean drag) {
set(DRAG, drag);
}
}

View File

@@ -0,0 +1,24 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Cake;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftCake extends CraftBlockData implements Cake {
private static final net.minecraft.server.BlockStateInteger BITES = getInteger("bites");
@Override
public int getBites() {
return get(BITES);
}
@Override
public void setBites(int bites) {
set(BITES, bites);
}
@Override
public int getMaximumBites() {
return getMax(BITES);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Chest;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftChest extends CraftBlockData implements Chest {
private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum("type");
@Override
public Type getType() {
return get(TYPE, Type.class);
}
@Override
public void setType(Type type) {
set(TYPE, type);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.CommandBlock;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftCommandBlock extends CraftBlockData implements CommandBlock {
private static final net.minecraft.server.BlockStateBoolean CONDITIONAL = getBoolean("conditional");
@Override
public boolean isConditional() {
return get(CONDITIONAL);
}
@Override
public void setConditional(boolean conditional) {
set(CONDITIONAL, conditional);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Comparator;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftComparator extends CraftBlockData implements Comparator {
private static final net.minecraft.server.BlockStateEnum<?> MODE = getEnum("mode");
@Override
public Mode getMode() {
return get(MODE, Mode.class);
}
@Override
public void setMode(Mode mode) {
set(MODE, mode);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.DaylightDetector;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftDaylightDetector extends CraftBlockData implements DaylightDetector {
private static final net.minecraft.server.BlockStateBoolean INVERTED = getBoolean("inverted");
@Override
public boolean isInverted() {
return get(INVERTED);
}
@Override
public void setInverted(boolean inverted) {
set(INVERTED, inverted);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Dispenser;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftDispenser extends CraftBlockData implements Dispenser {
private static final net.minecraft.server.BlockStateBoolean TRIGGERED = getBoolean("triggered");
@Override
public boolean isTriggered() {
return get(TRIGGERED);
}
@Override
public void setTriggered(boolean triggered) {
set(TRIGGERED, triggered);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Door;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftDoor extends CraftBlockData implements Door {
private static final net.minecraft.server.BlockStateEnum<?> HINGE = getEnum("hinge");
@Override
public Hinge getHinge() {
return get(HINGE, Hinge.class);
}
@Override
public void setHinge(Hinge hinge) {
set(HINGE, hinge);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.EndPortalFrame;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftEndPortalFrame extends CraftBlockData implements EndPortalFrame {
private static final net.minecraft.server.BlockStateBoolean EYE = getBoolean("eye");
@Override
public boolean hasEye() {
return get(EYE);
}
@Override
public void setEye(boolean eye) {
set(EYE, eye);
}
}

View File

@@ -0,0 +1,24 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Farmland;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftFarmland extends CraftBlockData implements Farmland {
private static final net.minecraft.server.BlockStateInteger MOISTURE = getInteger("moisture");
@Override
public int getMoisture() {
return get(MOISTURE);
}
@Override
public void setMoisture(int moisture) {
set(MOISTURE, moisture);
}
@Override
public int getMaximumMoisture() {
return getMax(MOISTURE);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Gate;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftGate extends CraftBlockData implements Gate {
private static final net.minecraft.server.BlockStateBoolean IN_WALL = getBoolean("in_wall");
@Override
public boolean isInWall() {
return get(IN_WALL);
}
@Override
public void setInWall(boolean inWall) {
set(IN_WALL, inWall);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Hopper;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftHopper extends CraftBlockData implements Hopper {
private static final net.minecraft.server.BlockStateBoolean ENABLED = getBoolean("enabled");
@Override
public boolean isEnabled() {
return get(ENABLED);
}
@Override
public void setEnabled(boolean enabled) {
set(ENABLED, enabled);
}
}

View File

@@ -0,0 +1,14 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.block.data.type.Jukebox;
public abstract class CraftJukebox extends CraftBlockData implements Jukebox {
private static final net.minecraft.server.BlockStateBoolean HAS_RECORD = getBoolean("has_record");
@Override
public boolean hasRecord() {
return get(HAS_RECORD);
}
}

View File

@@ -0,0 +1,30 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Leaves;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public class CraftLeaves extends CraftBlockData implements Leaves {
private static final net.minecraft.server.BlockStateInteger DISTANCE = getInteger("distance");
private static final net.minecraft.server.BlockStateBoolean PERSISTENT = getBoolean("persistent");
@Override
public boolean isPersistent() {
return get(PERSISTENT);
}
@Override
public void setPersistent(boolean persistent) {
set(PERSISTENT, persistent);
}
@Override
public int getDistance() {
return get(DISTANCE);
}
@Override
public void setDistance(int distance) {
set(DISTANCE, distance);
}
}

View File

@@ -0,0 +1,30 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.NoteBlock;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftNoteBlock extends CraftBlockData implements NoteBlock {
private static final net.minecraft.server.BlockStateEnum<?> INSTRUMENT = getEnum("instrument");
private static final net.minecraft.server.BlockStateInteger NOTE = getInteger("note");
@Override
public org.bukkit.Instrument getInstrument() {
return get(INSTRUMENT, org.bukkit.Instrument.class);
}
@Override
public void setInstrument(org.bukkit.Instrument instrument) {
set(INSTRUMENT, instrument);
}
@Override
public org.bukkit.Note getNote() {
return new org.bukkit.Note(get(NOTE));
}
@Override
public void setNote(org.bukkit.Note note) {
set(NOTE, (int) note.getId());
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Piston;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftPiston extends CraftBlockData implements Piston {
private static final net.minecraft.server.BlockStateBoolean EXTENDED = getBoolean("extended");
@Override
public boolean isExtended() {
return get(EXTENDED);
}
@Override
public void setExtended(boolean extended) {
set(EXTENDED, extended);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.PistonHead;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftPistonHead extends CraftBlockData implements PistonHead {
private static final net.minecraft.server.BlockStateBoolean SHORT = getBoolean("short");
@Override
public boolean isShort() {
return get(SHORT);
}
@Override
public void setShort(boolean _short) {
set(SHORT, _short);
}
}

View File

@@ -0,0 +1,49 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.RedstoneWire;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftRedstoneWire extends CraftBlockData implements RedstoneWire {
private static final net.minecraft.server.BlockStateEnum<?> NORTH = getEnum("north");
private static final net.minecraft.server.BlockStateEnum<?> EAST = getEnum("east");
private static final net.minecraft.server.BlockStateEnum<?> SOUTH = getEnum("south");
private static final net.minecraft.server.BlockStateEnum<?> WEST = getEnum("west");
@Override
public Connection getFace(org.bukkit.block.BlockFace face) {
switch (face) {
case NORTH:
return get(NORTH, Connection.class);
case EAST:
return get(EAST, Connection.class);
case SOUTH:
return get(SOUTH, Connection.class);
case WEST:
return get(WEST, Connection.class);
default:
throw new IllegalArgumentException("Cannot have face " + face);
}
}
@Override
public void setFace(org.bukkit.block.BlockFace face, Connection connection) {
switch (face) {
case NORTH:
set(NORTH, connection);
case EAST:
set(EAST, connection);
case SOUTH:
set(SOUTH, connection);
case WEST:
set(WEST, connection);
default:
throw new IllegalArgumentException("Cannot have face " + face);
}
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
return com.google.common.collect.ImmutableSet.of(org.bukkit.block.BlockFace.NORTH, org.bukkit.block.BlockFace.EAST, org.bukkit.block.BlockFace.SOUTH, org.bukkit.block.BlockFace.WEST);
}
}

View File

@@ -0,0 +1,40 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Repeater;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftRepeater extends CraftBlockData implements Repeater {
private static final net.minecraft.server.BlockStateInteger DELAY = getInteger("delay");
private static final net.minecraft.server.BlockStateBoolean LOCKED = getBoolean("locked");
@Override
public int getDelay() {
return get(DELAY);
}
@Override
public void setDelay(int delay) {
set(DELAY, delay);
}
@Override
public int getMinimumDelay() {
return getMin(DELAY);
}
@Override
public int getMaximumDelay() {
return getMax(DELAY);
}
@Override
public boolean isLocked() {
return get(LOCKED);
}
@Override
public void setLocked(boolean locked) {
set(LOCKED, locked);
}
}

View File

@@ -0,0 +1,24 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Sapling;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftSapling extends CraftBlockData implements Sapling {
private static final net.minecraft.server.BlockStateInteger STAGE = getInteger("stage");
@Override
public int getStage() {
return get(STAGE);
}
@Override
public void setStage(int stage) {
set(STAGE, stage);
}
@Override
public int getMaximumStage() {
return getMax(STAGE);
}
}

View File

@@ -0,0 +1,29 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.SeaPickle;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftSeaPickle extends CraftBlockData implements SeaPickle {
private static final net.minecraft.server.BlockStateInteger PICKLES = getInteger("pickles");
@Override
public int getPickles() {
return get(PICKLES);
}
@Override
public void setPickles(int pickles) {
set(PICKLES, pickles);
}
@Override
public int getMinimumPickles() {
return getMin(PICKLES);
}
@Override
public int getMaximumPickles() {
return getMax(PICKLES);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Slab;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftSlab extends CraftBlockData implements Slab {
private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum("type");
@Override
public Type getType() {
return get(TYPE, Type.class);
}
@Override
public void setType(Type type) {
set(TYPE, type);
}
}

View File

@@ -0,0 +1,29 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Snow;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public class CraftSnow extends CraftBlockData implements Snow {
private static final net.minecraft.server.BlockStateInteger LAYERS = getInteger("layers");
@Override
public int getLayers() {
return get(LAYERS);
}
@Override
public void setLayers(int layers) {
set(LAYERS, layers);
}
@Override
public int getMinimumLayers() {
return getMin(LAYERS);
}
@Override
public int getMaximumLayers() {
return getMax(LAYERS);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Stairs;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftStairs extends CraftBlockData implements Stairs {
private static final net.minecraft.server.BlockStateEnum<?> SHAPE = getEnum("shape");
@Override
public Shape getShape() {
return get(SHAPE, Shape.class);
}
@Override
public void setShape(Shape shape) {
set(SHAPE, shape);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.StructureBlock;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftStructureBlock extends CraftBlockData implements StructureBlock {
private static final net.minecraft.server.BlockStateEnum<?> MODE = getEnum("mode");
@Override
public Mode getMode() {
return get(MODE, Mode.class);
}
@Override
public void setMode(Mode mode) {
set(MODE, mode);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Switch;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftSwitch extends CraftBlockData implements Switch {
private static final net.minecraft.server.BlockStateEnum<?> FACE = getEnum("face");
@Override
public Face getFace() {
return get(FACE, Face.class);
}
@Override
public void setFace(Face face) {
set(FACE, face);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.TechnicalPiston;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftTechnicalPiston extends CraftBlockData implements TechnicalPiston {
private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum("type");
@Override
public Type getType() {
return get(TYPE, Type.class);
}
@Override
public void setType(Type type) {
set(TYPE, type);
}
}

View File

@@ -0,0 +1,19 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.Tripwire;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftTripwire extends CraftBlockData implements Tripwire {
private static final net.minecraft.server.BlockStateBoolean DISARMED = getBoolean("disarmed");
@Override
public boolean isDisarmed() {
return get(DISARMED);
}
@Override
public void setDisarmed(boolean disarmed) {
set(DISARMED, disarmed);
}
}

View File

@@ -0,0 +1,45 @@
package org.bukkit.craftbukkit.block.data.type;
import org.bukkit.block.data.type.TurtleEgg;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
public abstract class CraftTurtleEgg extends CraftBlockData implements TurtleEgg {
private static final net.minecraft.server.BlockStateInteger EGGS = getInteger("eggs");
private static final net.minecraft.server.BlockStateInteger HATCH = getInteger("hatch");
@Override
public int getEggs() {
return get(EGGS);
}
@Override
public void setEggs(int eggs) {
set(EGGS, eggs);
}
@Override
public int getMinimumEggs() {
return getMin(EGGS);
}
@Override
public int getMaximumEggs() {
return getMax(EGGS);
}
@Override
public int getHatch() {
return get(HATCH);
}
@Override
public void setHatch(int hatch) {
set(HATCH, hatch);
}
@Override
public int getMaximumHatch() {
return getMax(HATCH);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftAnvil extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
public CraftAnvil() {
super();
}
public CraftAnvil(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockAnvil.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,118 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBanner extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Rotatable {
public CraftBanner() {
super();
}
public CraftBanner(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftRotatable
private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger(net.minecraft.server.BlockBanner.class, "rotation");
@Override
public org.bukkit.block.BlockFace getRotation() {
int data = get(ROTATION);
switch (data) {
case 0x0:
return org.bukkit.block.BlockFace.SOUTH;
case 0x1:
return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
case 0x2:
return org.bukkit.block.BlockFace.SOUTH_WEST;
case 0x3:
return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
case 0x4:
return org.bukkit.block.BlockFace.WEST;
case 0x5:
return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
case 0x6:
return org.bukkit.block.BlockFace.NORTH_WEST;
case 0x7:
return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
case 0x8:
return org.bukkit.block.BlockFace.NORTH;
case 0x9:
return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
case 0xA:
return org.bukkit.block.BlockFace.NORTH_EAST;
case 0xB:
return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
case 0xC:
return org.bukkit.block.BlockFace.EAST;
case 0xD:
return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
case 0xE:
return org.bukkit.block.BlockFace.SOUTH_EAST;
case 0xF:
return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
default:
throw new IllegalArgumentException("Unknown rotation " + data);
}
}
@Override
public void setRotation(org.bukkit.block.BlockFace rotation) {
int val;
switch (rotation) {
case SOUTH:
val = 0x0;
break;
case SOUTH_SOUTH_WEST:
val = 0x1;
break;
case SOUTH_WEST:
val = 0x2;
break;
case WEST_SOUTH_WEST:
val = 0x3;
break;
case WEST:
val = 0x4;
break;
case WEST_NORTH_WEST:
val = 0x5;
break;
case NORTH_WEST:
val = 0x6;
break;
case NORTH_NORTH_WEST:
val = 0x7;
break;
case NORTH:
val = 0x8;
break;
case NORTH_NORTH_EAST:
val = 0x9;
break;
case NORTH_EAST:
val = 0xA;
break;
case EAST_NORTH_EAST:
val = 0xB;
break;
case EAST:
val = 0xC;
break;
case EAST_SOUTH_EAST:
val = 0xD;
break;
case SOUTH_EAST:
val = 0xE;
break;
case SOUTH_SOUTH_EAST:
val = 0xF;
break;
default:
throw new IllegalArgumentException("Illegal rotation " + rotation);
}
set(ROTATION, val);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBannerWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
public CraftBannerWall() {
super();
}
public CraftBannerWall(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockBannerWall.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,54 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBed extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Bed, org.bukkit.block.data.Directional {
public CraftBed() {
super();
}
public CraftBed(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftBed
private static final net.minecraft.server.BlockStateEnum<?> PART = getEnum(net.minecraft.server.BlockBed.class, "part");
private static final net.minecraft.server.BlockStateBoolean OCCUPIED = getBoolean(net.minecraft.server.BlockBed.class, "occupied");
@Override
public Part getPart() {
return get(PART, Part.class);
}
@Override
public void setPart(Part part) {
set(PART, part);
}
@Override
public boolean isOccupied() {
return get(OCCUPIED);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockBed.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBeetroot extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
public CraftBeetroot() {
super();
}
public CraftBeetroot(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftAgeable
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockBeetroot.class, "age");
@Override
public int getAge() {
return get(AGE);
}
@Override
public void setAge(int age) {
set(AGE, age);
}
@Override
public int getMaximumAge() {
return getMax(AGE);
}
}

View File

@@ -0,0 +1,49 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBrewingStand extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.BrewingStand {
public CraftBrewingStand() {
super();
}
public CraftBrewingStand(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftBrewingStand
private static final net.minecraft.server.BlockStateBoolean[] HAS_BOTTLE = new net.minecraft.server.BlockStateBoolean[]{
getBoolean(net.minecraft.server.BlockBrewingStand.class, "has_bottle_0"), getBoolean(net.minecraft.server.BlockBrewingStand.class, "has_bottle_1"), getBoolean(net.minecraft.server.BlockBrewingStand.class, "has_bottle_2")
};
@Override
public boolean hasBottle(int bottle) {
return get(HAS_BOTTLE[bottle]);
}
@Override
public void setBottle(int bottle, boolean has) {
set(HAS_BOTTLE[bottle], has);
}
@Override
public java.util.Set<Integer> getBottles() {
com.google.common.collect.ImmutableSet.Builder<Integer> bottles = com.google.common.collect.ImmutableSet.builder();
for (int index = 0; index < getMaximumBottles(); index++) {
if (hasBottle(index)) {
bottles.add(index);
}
}
return bottles.build();
}
@Override
public int getMaximumBottles() {
return HAS_BOTTLE.length;
}
}

View File

@@ -0,0 +1,29 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftBubbleColumn extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.BubbleColumn {
public CraftBubbleColumn() {
super();
}
public CraftBubbleColumn(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftBubbleColumn
private static final net.minecraft.server.BlockStateBoolean DRAG = getBoolean(net.minecraft.server.BlockBubbleColumn.class, "drag");
@Override
public boolean isDrag() {
return get(DRAG);
}
@Override
public void setDrag(boolean drag) {
set(DRAG, drag);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCactus extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
public CraftCactus() {
super();
}
public CraftCactus(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftAgeable
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockCactus.class, "age");
@Override
public int getAge() {
return get(AGE);
}
@Override
public void setAge(int age) {
set(AGE, age);
}
@Override
public int getMaximumAge() {
return getMax(AGE);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCake extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Cake {
public CraftCake() {
super();
}
public CraftCake(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftCake
private static final net.minecraft.server.BlockStateInteger BITES = getInteger(net.minecraft.server.BlockCake.class, "bites");
@Override
public int getBites() {
return get(BITES);
}
@Override
public void setBites(int bites) {
set(BITES, bites);
}
@Override
public int getMaximumBites() {
return getMax(BITES);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCarrots extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
public CraftCarrots() {
super();
}
public CraftCarrots(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftAgeable
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockCarrots.class, "age");
@Override
public int getAge() {
return get(AGE);
}
@Override
public void setAge(int age) {
set(AGE, age);
}
@Override
public int getMaximumAge() {
return getMax(AGE);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCauldron extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Levelled {
public CraftCauldron() {
super();
}
public CraftCauldron(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftLevelled
private static final net.minecraft.server.BlockStateInteger LEVEL = getInteger(net.minecraft.server.BlockCauldron.class, "level");
@Override
public int getLevel() {
return get(LEVEL);
}
@Override
public void setLevel(int level) {
set(LEVEL, level);
}
@Override
public int getMaximumLevel() {
return getMax(LEVEL);
}
}

View File

@@ -0,0 +1,62 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftChest extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Chest, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
public CraftChest() {
super();
}
public CraftChest(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftChest
private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum(net.minecraft.server.BlockChest.class, "type");
@Override
public Type getType() {
return get(TYPE, Type.class);
}
@Override
public void setType(Type type) {
set(TYPE, type);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockChest.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockChest.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,62 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftChestTrapped extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Chest, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
public CraftChestTrapped() {
super();
}
public CraftChestTrapped(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftChest
private static final net.minecraft.server.BlockStateEnum<?> TYPE = getEnum(net.minecraft.server.BlockChestTrapped.class, "type");
@Override
public Type getType() {
return get(TYPE, Type.class);
}
@Override
public void setType(Type type) {
set(TYPE, type);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockChestTrapped.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockChestTrapped.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftChorusFlower extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
public CraftChorusFlower() {
super();
}
public CraftChorusFlower(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftAgeable
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockChorusFlower.class, "age");
@Override
public int getAge() {
return get(AGE);
}
@Override
public void setAge(int age) {
set(AGE, age);
}
@Override
public int getMaximumAge() {
return getMax(AGE);
}
}

View File

@@ -0,0 +1,57 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftChorusFruit extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.MultipleFacing {
public CraftChorusFruit() {
super();
}
public CraftChorusFruit(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftMultipleFacing
private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
getBoolean(net.minecraft.server.BlockChorusFruit.class, "north", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "east", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "south", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "west", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "up", true), getBoolean(net.minecraft.server.BlockChorusFruit.class, "down", true)
};
@Override
public boolean hasFace(org.bukkit.block.BlockFace face) {
return get(FACES[face.ordinal()]);
}
@Override
public void setFace(org.bukkit.block.BlockFace face, boolean has) {
set(FACES[face.ordinal()], has);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null && get(FACES[i])) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
}

View File

@@ -0,0 +1,71 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCobbleWall extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Fence, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
public CraftCobbleWall() {
super();
}
public CraftCobbleWall(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftMultipleFacing
private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
getBoolean(net.minecraft.server.BlockCobbleWall.class, "north", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "east", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "south", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "west", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "up", true), getBoolean(net.minecraft.server.BlockCobbleWall.class, "down", true)
};
@Override
public boolean hasFace(org.bukkit.block.BlockFace face) {
return get(FACES[face.ordinal()]);
}
@Override
public void setFace(org.bukkit.block.BlockFace face, boolean has) {
set(FACES[face.ordinal()], has);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null && get(FACES[i])) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockCobbleWall.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,53 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCocoa extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Cocoa, org.bukkit.block.data.Ageable, org.bukkit.block.data.Directional {
public CraftCocoa() {
super();
}
public CraftCocoa(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftAgeable
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockCocoa.class, "age");
@Override
public int getAge() {
return get(AGE);
}
@Override
public void setAge(int age) {
set(AGE, age);
}
@Override
public int getMaximumAge() {
return getMax(AGE);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockCocoa.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCommand extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.CommandBlock, org.bukkit.block.data.Directional {
public CraftCommand() {
super();
}
public CraftCommand(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftCommandBlock
private static final net.minecraft.server.BlockStateBoolean CONDITIONAL = getBoolean(net.minecraft.server.BlockCommand.class, "conditional");
@Override
public boolean isConditional() {
return get(CONDITIONAL);
}
@Override
public void setConditional(boolean conditional) {
set(CONDITIONAL, conditional);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockCommand.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCoralFan extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
public CraftCoralFan() {
super();
}
public CraftCoralFan(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockCoralFan.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftCrops extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Ageable {
public CraftCrops() {
super();
}
public CraftCrops(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftAgeable
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockCrops.class, "age");
@Override
public int getAge() {
return get(AGE);
}
@Override
public void setAge(int age) {
set(AGE, age);
}
@Override
public int getMaximumAge() {
return getMax(AGE);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftDaylightDetector extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.DaylightDetector, org.bukkit.block.data.AnaloguePowerable {
public CraftDaylightDetector() {
super();
}
public CraftDaylightDetector(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftDaylightDetector
private static final net.minecraft.server.BlockStateBoolean INVERTED = getBoolean(net.minecraft.server.BlockDaylightDetector.class, "inverted");
@Override
public boolean isInverted() {
return get(INVERTED);
}
@Override
public void setInverted(boolean inverted) {
set(INVERTED, inverted);
}
// org.bukkit.craftbukkit.block.data.CraftAnaloguePowerable
private static final net.minecraft.server.BlockStateInteger POWER = getInteger(net.minecraft.server.BlockDaylightDetector.class, "power");
@Override
public int getPower() {
return get(POWER);
}
@Override
public void setPower(int power) {
set(POWER, power);
}
@Override
public int getMaximumPower() {
return getMax(POWER);
}
}

View File

@@ -0,0 +1,29 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftDirtSnow extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Snowable {
public CraftDirtSnow() {
super();
}
public CraftDirtSnow(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftSnowable
private static final net.minecraft.server.BlockStateBoolean SNOWY = getBoolean(net.minecraft.server.BlockDirtSnow.class, "snowy");
@Override
public boolean isSnowy() {
return get(SNOWY);
}
@Override
public void setSnowy(boolean snowy) {
set(SNOWY, snowy);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftDispenser extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Dispenser, org.bukkit.block.data.Directional {
public CraftDispenser() {
super();
}
public CraftDispenser(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftDispenser
private static final net.minecraft.server.BlockStateBoolean TRIGGERED = getBoolean(net.minecraft.server.BlockDispenser.class, "triggered");
@Override
public boolean isTriggered() {
return get(TRIGGERED);
}
@Override
public void setTriggered(boolean triggered) {
set(TRIGGERED, triggered);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockDispenser.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,90 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftDoor extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Door, org.bukkit.block.data.Bisected, org.bukkit.block.data.Directional, org.bukkit.block.data.Openable, org.bukkit.block.data.Powerable {
public CraftDoor() {
super();
}
public CraftDoor(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftDoor
private static final net.minecraft.server.BlockStateEnum<?> HINGE = getEnum(net.minecraft.server.BlockDoor.class, "hinge");
@Override
public Hinge getHinge() {
return get(HINGE, Hinge.class);
}
@Override
public void setHinge(Hinge hinge) {
set(HINGE, hinge);
}
// org.bukkit.craftbukkit.block.data.CraftBisected
private static final net.minecraft.server.BlockStateEnum<?> HALF = getEnum(net.minecraft.server.BlockDoor.class, "half");
@Override
public Half getHalf() {
return get(HALF, Half.class);
}
@Override
public void setHalf(Half half) {
set(HALF, half);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockDoor.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
// org.bukkit.craftbukkit.block.data.CraftOpenable
private static final net.minecraft.server.BlockStateBoolean OPEN = getBoolean(net.minecraft.server.BlockDoor.class, "open");
@Override
public boolean isOpen() {
return get(OPEN);
}
@Override
public void setOpen(boolean open) {
set(OPEN, open);
}
// org.bukkit.craftbukkit.block.data.CraftPowerable
private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockDoor.class, "powered");
@Override
public boolean isPowered() {
return get(POWERED);
}
@Override
public void setPowered(boolean powered) {
set(POWERED, powered);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftDropper extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Dispenser, org.bukkit.block.data.Directional {
public CraftDropper() {
super();
}
public CraftDropper(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftDispenser
private static final net.minecraft.server.BlockStateBoolean TRIGGERED = getBoolean(net.minecraft.server.BlockDropper.class, "triggered");
@Override
public boolean isTriggered() {
return get(TRIGGERED);
}
@Override
public void setTriggered(boolean triggered) {
set(TRIGGERED, triggered);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockDropper.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftEndRod extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Directional {
public CraftEndRod() {
super();
}
public CraftEndRod(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockEndRod.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftEnderChest extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.EnderChest, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
public CraftEnderChest() {
super();
}
public CraftEnderChest(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockEnderChest.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockEnderChest.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftEnderPortalFrame extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.EndPortalFrame, org.bukkit.block.data.Directional {
public CraftEnderPortalFrame() {
super();
}
public CraftEnderPortalFrame(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftEndPortalFrame
private static final net.minecraft.server.BlockStateBoolean EYE = getBoolean(net.minecraft.server.BlockEnderPortalFrame.class, "eye");
@Override
public boolean hasEye() {
return get(EYE);
}
@Override
public void setEye(boolean eye) {
set(EYE, eye);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockEnderPortalFrame.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
}

View File

@@ -0,0 +1,71 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftFence extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Fence, org.bukkit.block.data.MultipleFacing, org.bukkit.block.data.Waterlogged {
public CraftFence() {
super();
}
public CraftFence(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftMultipleFacing
private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
getBoolean(net.minecraft.server.BlockFence.class, "north", true), getBoolean(net.minecraft.server.BlockFence.class, "east", true), getBoolean(net.minecraft.server.BlockFence.class, "south", true), getBoolean(net.minecraft.server.BlockFence.class, "west", true), getBoolean(net.minecraft.server.BlockFence.class, "up", true), getBoolean(net.minecraft.server.BlockFence.class, "down", true)
};
@Override
public boolean hasFace(org.bukkit.block.BlockFace face) {
return get(FACES[face.ordinal()]);
}
@Override
public void setFace(org.bukkit.block.BlockFace face, boolean has) {
set(FACES[face.ordinal()], has);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null && get(FACES[i])) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockFence.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,76 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftFenceGate extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Gate, org.bukkit.block.data.Directional, org.bukkit.block.data.Openable, org.bukkit.block.data.Powerable {
public CraftFenceGate() {
super();
}
public CraftFenceGate(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.type.CraftGate
private static final net.minecraft.server.BlockStateBoolean IN_WALL = getBoolean(net.minecraft.server.BlockFenceGate.class, "in_wall");
@Override
public boolean isInWall() {
return get(IN_WALL);
}
@Override
public void setInWall(boolean inWall) {
set(IN_WALL, inWall);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockFenceGate.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
// org.bukkit.craftbukkit.block.data.CraftOpenable
private static final net.minecraft.server.BlockStateBoolean OPEN = getBoolean(net.minecraft.server.BlockFenceGate.class, "open");
@Override
public boolean isOpen() {
return get(OPEN);
}
@Override
public void setOpen(boolean open) {
set(OPEN, open);
}
// org.bukkit.craftbukkit.block.data.CraftPowerable
private static final net.minecraft.server.BlockStateBoolean POWERED = getBoolean(net.minecraft.server.BlockFenceGate.class, "powered");
@Override
public boolean isPowered() {
return get(POWERED);
}
@Override
public void setPowered(boolean powered) {
set(POWERED, powered);
}
}

View File

@@ -0,0 +1,76 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftFire extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Fire, org.bukkit.block.data.Ageable, org.bukkit.block.data.MultipleFacing {
public CraftFire() {
super();
}
public CraftFire(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftAgeable
private static final net.minecraft.server.BlockStateInteger AGE = getInteger(net.minecraft.server.BlockFire.class, "age");
@Override
public int getAge() {
return get(AGE);
}
@Override
public void setAge(int age) {
set(AGE, age);
}
@Override
public int getMaximumAge() {
return getMax(AGE);
}
// org.bukkit.craftbukkit.block.data.CraftMultipleFacing
private static final net.minecraft.server.BlockStateBoolean[] FACES = new net.minecraft.server.BlockStateBoolean[]{
getBoolean(net.minecraft.server.BlockFire.class, "north", true), getBoolean(net.minecraft.server.BlockFire.class, "east", true), getBoolean(net.minecraft.server.BlockFire.class, "south", true), getBoolean(net.minecraft.server.BlockFire.class, "west", true), getBoolean(net.minecraft.server.BlockFire.class, "up", true), getBoolean(net.minecraft.server.BlockFire.class, "down", true)
};
@Override
public boolean hasFace(org.bukkit.block.BlockFace face) {
return get(FACES[face.ordinal()]);
}
@Override
public void setFace(org.bukkit.block.BlockFace face, boolean has) {
set(FACES[face.ordinal()], has);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null && get(FACES[i])) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getAllowedFaces() {
com.google.common.collect.ImmutableSet.Builder<org.bukkit.block.BlockFace> faces = com.google.common.collect.ImmutableSet.builder();
for (int i = 0; i < FACES.length; i++) {
if (FACES[i] != null) {
faces.add(org.bukkit.block.BlockFace.values()[i]);
}
}
return faces.build();
}
}

View File

@@ -0,0 +1,132 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftFloorSign extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Sign, org.bukkit.block.data.Rotatable, org.bukkit.block.data.Waterlogged {
public CraftFloorSign() {
super();
}
public CraftFloorSign(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftRotatable
private static final net.minecraft.server.BlockStateInteger ROTATION = getInteger(net.minecraft.server.BlockFloorSign.class, "rotation");
@Override
public org.bukkit.block.BlockFace getRotation() {
int data = get(ROTATION);
switch (data) {
case 0x0:
return org.bukkit.block.BlockFace.SOUTH;
case 0x1:
return org.bukkit.block.BlockFace.SOUTH_SOUTH_WEST;
case 0x2:
return org.bukkit.block.BlockFace.SOUTH_WEST;
case 0x3:
return org.bukkit.block.BlockFace.WEST_SOUTH_WEST;
case 0x4:
return org.bukkit.block.BlockFace.WEST;
case 0x5:
return org.bukkit.block.BlockFace.WEST_NORTH_WEST;
case 0x6:
return org.bukkit.block.BlockFace.NORTH_WEST;
case 0x7:
return org.bukkit.block.BlockFace.NORTH_NORTH_WEST;
case 0x8:
return org.bukkit.block.BlockFace.NORTH;
case 0x9:
return org.bukkit.block.BlockFace.NORTH_NORTH_EAST;
case 0xA:
return org.bukkit.block.BlockFace.NORTH_EAST;
case 0xB:
return org.bukkit.block.BlockFace.EAST_NORTH_EAST;
case 0xC:
return org.bukkit.block.BlockFace.EAST;
case 0xD:
return org.bukkit.block.BlockFace.EAST_SOUTH_EAST;
case 0xE:
return org.bukkit.block.BlockFace.SOUTH_EAST;
case 0xF:
return org.bukkit.block.BlockFace.SOUTH_SOUTH_EAST;
default:
throw new IllegalArgumentException("Unknown rotation " + data);
}
}
@Override
public void setRotation(org.bukkit.block.BlockFace rotation) {
int val;
switch (rotation) {
case SOUTH:
val = 0x0;
break;
case SOUTH_SOUTH_WEST:
val = 0x1;
break;
case SOUTH_WEST:
val = 0x2;
break;
case WEST_SOUTH_WEST:
val = 0x3;
break;
case WEST:
val = 0x4;
break;
case WEST_NORTH_WEST:
val = 0x5;
break;
case NORTH_WEST:
val = 0x6;
break;
case NORTH_NORTH_WEST:
val = 0x7;
break;
case NORTH:
val = 0x8;
break;
case NORTH_NORTH_EAST:
val = 0x9;
break;
case NORTH_EAST:
val = 0xA;
break;
case EAST_NORTH_EAST:
val = 0xB;
break;
case EAST:
val = 0xC;
break;
case EAST_SOUTH_EAST:
val = 0xD;
break;
case SOUTH_EAST:
val = 0xE;
break;
case SOUTH_SOUTH_EAST:
val = 0xF;
break;
default:
throw new IllegalArgumentException("Illegal rotation " + rotation);
}
set(ROTATION, val);
}
// org.bukkit.craftbukkit.block.data.CraftWaterlogged
private static final net.minecraft.server.BlockStateBoolean WATERLOGGED = getBoolean(net.minecraft.server.BlockFloorSign.class, "waterlogged");
@Override
public boolean isWaterlogged() {
return get(WATERLOGGED);
}
@Override
public void setWaterlogged(boolean waterlogged) {
set(WATERLOGGED, waterlogged);
}
}

View File

@@ -0,0 +1,34 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftFluids extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.Levelled {
public CraftFluids() {
super();
}
public CraftFluids(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftLevelled
private static final net.minecraft.server.BlockStateInteger LEVEL = getInteger(net.minecraft.server.BlockFluids.class, "level");
@Override
public int getLevel() {
return get(LEVEL);
}
@Override
public void setLevel(int level) {
set(LEVEL, level);
}
@Override
public int getMaximumLevel() {
return getMax(LEVEL);
}
}

View File

@@ -0,0 +1,48 @@
/**
* Automatically generated file, changes will be lost.
*/
package org.bukkit.craftbukkit.block.impl;
public final class CraftFurnace extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.Furnace, org.bukkit.block.data.Directional, org.bukkit.block.data.Lightable {
public CraftFurnace() {
super();
}
public CraftFurnace(net.minecraft.server.IBlockData state) {
super(state);
}
// org.bukkit.craftbukkit.block.data.CraftDirectional
private static final net.minecraft.server.BlockStateEnum<?> FACING = getEnum(net.minecraft.server.BlockFurnace.class, "facing");
@Override
public org.bukkit.block.BlockFace getFacing() {
return get(FACING, org.bukkit.block.BlockFace.class);
}
@Override
public void setFacing(org.bukkit.block.BlockFace facing) {
set(FACING, facing);
}
@Override
public java.util.Set<org.bukkit.block.BlockFace> getFaces() {
return getValues(FACING, org.bukkit.block.BlockFace.class);
}
// org.bukkit.craftbukkit.block.data.CraftLightable
private static final net.minecraft.server.BlockStateBoolean LIT = getBoolean(net.minecraft.server.BlockFurnace.class, "lit");
@Override
public boolean isLit() {
return get(LIT);
}
@Override
public void setLit(boolean lit) {
set(LIT, lit);
}
}

Some files were not shown because too many files have changed in this diff Show More