@@ -32,7 +32,7 @@ public final class CapturedBlockState extends CraftBlockState {
|
||||
Random random = generatoraccessseed.getRandom();
|
||||
|
||||
// Begin copied block from WorldGenFeatureTreeBeehive
|
||||
TileEntity tileentity = generatoraccessseed.getTileEntity(blockposition1);
|
||||
TileEntity tileentity = generatoraccessseed.getBlockEntity(blockposition1);
|
||||
|
||||
if (tileentity instanceof TileEntityBeehive) {
|
||||
TileEntityBeehive tileentitybeehive = (TileEntityBeehive) tileentity;
|
||||
@@ -41,7 +41,7 @@ public final class CapturedBlockState extends CraftBlockState {
|
||||
for (int k = 0; k < j; ++k) {
|
||||
EntityBee entitybee = new EntityBee(EntityTypes.BEE, generatoraccessseed.getMinecraftWorld());
|
||||
|
||||
tileentitybeehive.a(entitybee, false, random.nextInt(599));
|
||||
tileentitybeehive.addOccupantWithPresetTicks(entitybee, false, random.nextInt(599));
|
||||
}
|
||||
}
|
||||
// End copied block
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
|
||||
public void load(TileEntityBanner banner) {
|
||||
super.load(banner);
|
||||
|
||||
base = DyeColor.getByWoolData((byte) ((BlockBannerAbstract) this.data.getBlock()).getColor().getColorIndex());
|
||||
base = DyeColor.getByWoolData((byte) ((BlockBannerAbstract) this.data.getBlock()).getColor().getId());
|
||||
patterns = new ArrayList<Pattern>();
|
||||
|
||||
if (banner.itemPatterns != null) {
|
||||
@@ -88,14 +88,14 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
|
||||
public void applyTo(TileEntityBanner banner) {
|
||||
super.applyTo(banner);
|
||||
|
||||
banner.baseColor = EnumColor.fromColorIndex(base.getWoolData());
|
||||
banner.baseColor = EnumColor.byId(base.getWoolData());
|
||||
|
||||
NBTTagList newPatterns = new NBTTagList();
|
||||
|
||||
for (Pattern p : patterns) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInt("Color", p.getColor().getWoolData());
|
||||
compound.setString("Pattern", p.getPattern().getIdentifier());
|
||||
compound.putInt("Color", p.getColor().getWoolData());
|
||||
compound.putString("Pattern", p.getPattern().getIdentifier());
|
||||
newPatterns.add(compound);
|
||||
}
|
||||
banner.itemPatterns = newPatterns;
|
||||
|
||||
@@ -33,13 +33,13 @@ public class CraftBarrel extends CraftLootable<TileEntityBarrel> implements Barr
|
||||
public void open() {
|
||||
requirePlaced();
|
||||
if (!getTileEntity().openersCounter.opened) {
|
||||
IBlockData blockData = getTileEntity().getBlock();
|
||||
boolean open = blockData.get(BlockBarrel.OPEN);
|
||||
IBlockData blockData = getTileEntity().getBlockState();
|
||||
boolean open = blockData.getValue(BlockBarrel.OPEN);
|
||||
|
||||
if (!open) {
|
||||
getTileEntity().setOpenFlag(blockData, true);
|
||||
getTileEntity().updateBlockState(blockData, true);
|
||||
if (getWorldHandle() instanceof net.minecraft.world.level.World) {
|
||||
getTileEntity().playOpenSound(blockData, SoundEffects.BARREL_OPEN);
|
||||
getTileEntity().playSound(blockData, SoundEffects.BARREL_OPEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,10 +50,10 @@ public class CraftBarrel extends CraftLootable<TileEntityBarrel> implements Barr
|
||||
public void close() {
|
||||
requirePlaced();
|
||||
if (getTileEntity().openersCounter.opened) {
|
||||
IBlockData blockData = getTileEntity().getBlock();
|
||||
getTileEntity().setOpenFlag(blockData, false);
|
||||
IBlockData blockData = getTileEntity().getBlockState();
|
||||
getTileEntity().updateBlockState(blockData, false);
|
||||
if (getWorldHandle() instanceof net.minecraft.world.level.World) {
|
||||
getTileEntity().playOpenSound(blockData, SoundEffects.BARREL_CLOSE);
|
||||
getTileEntity().playSound(blockData, SoundEffects.BARREL_CLOSE);
|
||||
}
|
||||
}
|
||||
getTileEntity().openersCounter.opened = false;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
|
||||
if (tileEntity instanceof TileEntityBeacon) {
|
||||
TileEntityBeacon beacon = (TileEntityBeacon) tileEntity;
|
||||
|
||||
Collection<EntityHuman> nms = TileEntityBeacon.getHumansInRange(beacon.getWorld(), beacon.getPosition(), beacon.levels);
|
||||
Collection<EntityHuman> nms = TileEntityBeacon.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels);
|
||||
Collection<LivingEntity> bukkit = new ArrayList<LivingEntity>(nms.size());
|
||||
|
||||
for (EntityHuman human : nms) {
|
||||
@@ -55,7 +55,7 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
|
||||
|
||||
@Override
|
||||
public void setPrimaryEffect(PotionEffectType effect) {
|
||||
this.getSnapshot().primaryPower = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
|
||||
this.getSnapshot().primaryPower = (effect != null) ? MobEffectList.byId(effect.getId()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,7 +65,7 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
|
||||
|
||||
@Override
|
||||
public void setSecondaryEffect(PotionEffectType effect) {
|
||||
this.getSnapshot().secondaryPower = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
|
||||
this.getSnapshot().secondaryPower = (effect != null) ? MobEffectList.byId(effect.getId()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
|
||||
|
||||
@Override
|
||||
public int getEntityCount() {
|
||||
return getSnapshot().getBeeCount();
|
||||
return getSnapshot().getOccupantCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,6 +78,6 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
|
||||
public void addEntity(Bee entity) {
|
||||
Preconditions.checkArgument(entity != null, "Entity must not be null");
|
||||
|
||||
getSnapshot().addBee(((CraftBee) entity).getHandle(), false);
|
||||
getSnapshot().addOccupant(((CraftBee) entity).getHandle(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CraftBlock implements Block {
|
||||
|
||||
public CraftBlock(GeneratorAccess world, BlockPosition position) {
|
||||
this.world = world;
|
||||
this.position = position.immutableCopy();
|
||||
this.position = position.immutable();
|
||||
}
|
||||
|
||||
public static CraftBlock at(GeneratorAccess world, BlockPosition position) {
|
||||
@@ -73,7 +73,7 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
public net.minecraft.world.level.block.state.IBlockData getNMS() {
|
||||
return world.getType(position);
|
||||
return world.getBlockState(position);
|
||||
}
|
||||
|
||||
public BlockPosition getPosition() {
|
||||
@@ -149,12 +149,12 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
private void setData(final byte data, int flag) {
|
||||
world.setTypeAndData(position, CraftMagicNumbers.getBlock(getType(), data), flag);
|
||||
world.setBlock(position, CraftMagicNumbers.getBlock(getType(), data), flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getData() {
|
||||
IBlockData blockData = world.getType(position);
|
||||
IBlockData blockData = world.getBlockState(position);
|
||||
return CraftMagicNumbers.toLegacyData(blockData);
|
||||
}
|
||||
|
||||
@@ -188,21 +188,21 @@ public class CraftBlock implements Block {
|
||||
public boolean setTypeAndData(final IBlockData blockData, final boolean applyPhysics) {
|
||||
IBlockData old = getNMS();
|
||||
// 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 (old.isTileEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes
|
||||
if (old.hasBlockEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes
|
||||
// SPIGOT-4612: faster - just clear tile
|
||||
if (world instanceof net.minecraft.world.level.World) {
|
||||
((net.minecraft.world.level.World) world).removeTileEntity(position);
|
||||
((net.minecraft.world.level.World) world).removeBlockEntity(position);
|
||||
} else {
|
||||
world.setTypeAndData(position, Blocks.AIR.getBlockData(), 0);
|
||||
world.setBlock(position, Blocks.AIR.defaultBlockState(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (applyPhysics) {
|
||||
return world.setTypeAndData(position, blockData, 3);
|
||||
return world.setBlock(position, blockData, 3);
|
||||
} else {
|
||||
boolean success = world.setTypeAndData(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
boolean success = world.setBlock(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
if (success && world instanceof net.minecraft.world.level.World) {
|
||||
world.getMinecraftWorld().notify(
|
||||
world.getMinecraftWorld().sendBlockUpdated(
|
||||
position,
|
||||
old,
|
||||
blockData,
|
||||
@@ -215,12 +215,12 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public Material getType() {
|
||||
return CraftMagicNumbers.getMaterial(world.getType(position).getBlock());
|
||||
return CraftMagicNumbers.getMaterial(world.getBlockState(position).getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getLightLevel() {
|
||||
return (byte) world.getMinecraftWorld().getLightLevel(position);
|
||||
return (byte) world.getMinecraftWorld().getMaxLocalRawBrightness(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -271,7 +271,7 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftBlock{pos=" + position + ",type=" + getType() + ",data=" + getNMS() + ",fluid=" + world.getFluid(position) + '}';
|
||||
return "CraftBlock{pos=" + position + ",type=" + getType() + ",data=" + getNMS() + ",fluid=" + world.getFluidState(position) + '}';
|
||||
}
|
||||
|
||||
public static BlockFace notchToBlockFace(EnumDirection notch) {
|
||||
@@ -349,7 +349,7 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public double getTemperature() {
|
||||
return world.getBiome(position).getAdjustedTemperature(position);
|
||||
return world.getBiome(position).getTemperature(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,12 +359,12 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public boolean isBlockPowered() {
|
||||
return world.getMinecraftWorld().getBlockPower(position) > 0;
|
||||
return world.getMinecraftWorld().getDirectSignalTo(position) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockIndirectlyPowered() {
|
||||
return world.getMinecraftWorld().isBlockIndirectlyPowered(position);
|
||||
return world.getMinecraftWorld().hasNeighborSignal(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -387,12 +387,12 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public boolean isBlockFacePowered(BlockFace face) {
|
||||
return world.getMinecraftWorld().isBlockFacePowered(position, blockFaceToNotch(face));
|
||||
return world.getMinecraftWorld().hasSignal(position, blockFaceToNotch(face));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
|
||||
int power = world.getMinecraftWorld().getBlockFacePower(position, blockFaceToNotch(face));
|
||||
int power = world.getMinecraftWorld().getSignal(position, blockFaceToNotch(face));
|
||||
|
||||
Block relative = getRelative(face);
|
||||
if (relative.getType() == Material.REDSTONE_WIRE) {
|
||||
@@ -409,20 +409,20 @@ public class CraftBlock implements Block {
|
||||
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 = getPower(power, world.getType(new BlockPosition(x, y - 1, z)));
|
||||
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y + 1, z), EnumDirection.UP)) power = getPower(power, world.getType(new BlockPosition(x, y + 1, z)));
|
||||
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x + 1, y, z), EnumDirection.EAST)) power = getPower(power, world.getType(new BlockPosition(x + 1, y, z)));
|
||||
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x - 1, y, z), EnumDirection.WEST)) power = getPower(power, world.getType(new BlockPosition(x - 1, y, z)));
|
||||
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y, z - 1), EnumDirection.NORTH)) power = getPower(power, world.getType(new BlockPosition(x, y, z - 1)));
|
||||
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.isBlockFacePowered(new BlockPosition(x, y, z + 1), EnumDirection.SOUTH)) power = getPower(power, world.getType(new BlockPosition(x, y, z + 1)));
|
||||
if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.hasSignal(new BlockPosition(x, y - 1, z), EnumDirection.DOWN)) power = getPower(power, world.getBlockState(new BlockPosition(x, y - 1, z)));
|
||||
if ((face == BlockFace.UP || face == BlockFace.SELF) && world.hasSignal(new BlockPosition(x, y + 1, z), EnumDirection.UP)) power = getPower(power, world.getBlockState(new BlockPosition(x, y + 1, z)));
|
||||
if ((face == BlockFace.EAST || face == BlockFace.SELF) && world.hasSignal(new BlockPosition(x + 1, y, z), EnumDirection.EAST)) power = getPower(power, world.getBlockState(new BlockPosition(x + 1, y, z)));
|
||||
if ((face == BlockFace.WEST || face == BlockFace.SELF) && world.hasSignal(new BlockPosition(x - 1, y, z), EnumDirection.WEST)) power = getPower(power, world.getBlockState(new BlockPosition(x - 1, y, z)));
|
||||
if ((face == BlockFace.NORTH || face == BlockFace.SELF) && world.hasSignal(new BlockPosition(x, y, z - 1), EnumDirection.NORTH)) power = getPower(power, world.getBlockState(new BlockPosition(x, y, z - 1)));
|
||||
if ((face == BlockFace.SOUTH || face == BlockFace.SELF) && world.hasSignal(new BlockPosition(x, y, z + 1), EnumDirection.SOUTH)) power = getPower(power, world.getBlockState(new BlockPosition(x, y, z + 1)));
|
||||
return power > 0 ? power : (face == BlockFace.SELF ? isBlockIndirectlyPowered() : isBlockFaceIndirectlyPowered(face)) ? 15 : 0;
|
||||
}
|
||||
|
||||
private static int getPower(int i, IBlockData iblockdata) {
|
||||
if (!iblockdata.a(Blocks.REDSTONE_WIRE)) {
|
||||
if (!iblockdata.is(Blocks.REDSTONE_WIRE)) {
|
||||
return i;
|
||||
} else {
|
||||
int j = iblockdata.get(BlockRedstoneWire.POWER);
|
||||
int j = iblockdata.getValue(BlockRedstoneWire.POWER);
|
||||
|
||||
return j > i ? j : i;
|
||||
}
|
||||
@@ -445,7 +445,7 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public PistonMoveReaction getPistonMoveReaction() {
|
||||
return PistonMoveReaction.getById(getNMS().getPushReaction().ordinal());
|
||||
return PistonMoveReaction.getById(getNMS().getPistonPushReaction().ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -462,18 +462,18 @@ public class CraftBlock implements Block {
|
||||
boolean result = false;
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
if (block != Blocks.AIR && (item == null || !iblockdata.isRequiresSpecialTool() || nmsItem.canDestroySpecialBlock(iblockdata))) {
|
||||
net.minecraft.world.level.block.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem);
|
||||
if (block != Blocks.AIR && (item == null || !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata))) {
|
||||
net.minecraft.world.level.block.Block.dropResources(iblockdata, world.getMinecraftWorld(), position, world.getBlockEntity(position), null, nmsItem);
|
||||
result = true;
|
||||
}
|
||||
|
||||
return setTypeAndData(Blocks.AIR.getBlockData(), true) && result;
|
||||
return setTypeAndData(Blocks.AIR.defaultBlockState(), true) && result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyBoneMeal(BlockFace face) {
|
||||
EnumDirection direction = blockFaceToNotch(face);
|
||||
ItemActionContext context = new ItemActionContext(getCraftWorld().getHandle(), null, EnumHand.MAIN_HAND, Items.BONE_MEAL.createItemStack(), new MovingObjectPositionBlock(Vec3D.ZERO, direction, getPosition(), false));
|
||||
ItemActionContext context = new ItemActionContext(getCraftWorld().getHandle(), null, EnumHand.MAIN_HAND, Items.BONE_MEAL.getDefaultInstance(), new MovingObjectPositionBlock(Vec3D.ZERO, direction, getPosition(), false));
|
||||
|
||||
return ItemBoneMeal.applyBonemeal(context) == EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
@@ -495,7 +495,7 @@ public class CraftBlock implements Block {
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
if (item == null || isPreferredTool(iblockdata, nms)) {
|
||||
return net.minecraft.world.level.block.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getTileEntity(position), entity == null ? null : ((CraftEntity) entity).getHandle(), nms)
|
||||
return net.minecraft.world.level.block.Block.getDrops(iblockdata, (WorldServer) world.getMinecraftWorld(), position, world.getBlockEntity(position), entity == null ? null : ((CraftEntity) entity).getHandle(), nms)
|
||||
.stream().map(CraftItemStack::asBukkitCopy).collect(Collectors.toList());
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
@@ -512,11 +512,11 @@ public class CraftBlock implements Block {
|
||||
@Override
|
||||
public float getBreakSpeed(Player player) {
|
||||
Preconditions.checkArgument(player != null, "player cannot be null");
|
||||
return getNMS().getDamage(((CraftPlayer) player).getHandle(), world, position);
|
||||
return getNMS().getDestroyProgress(((CraftPlayer) player).getHandle(), world, position);
|
||||
}
|
||||
|
||||
private boolean isPreferredTool(IBlockData iblockdata, net.minecraft.world.item.ItemStack nmsItem) {
|
||||
return !iblockdata.isRequiresSpecialTool() || nmsItem.canDestroySpecialBlock(iblockdata);
|
||||
return !iblockdata.requiresCorrectToolForDrops() || nmsItem.isCorrectToolForDrops(iblockdata);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -563,7 +563,7 @@ public class CraftBlock implements Block {
|
||||
Vec3D startPos = new Vec3D(start.getX(), start.getY(), start.getZ());
|
||||
Vec3D endPos = new Vec3D(start.getX() + dir.getX(), start.getY() + dir.getY(), start.getZ() + dir.getZ());
|
||||
|
||||
MovingObjectPosition nmsHitResult = world.rayTraceBlock(new RayTrace(startPos, endPos, RayTrace.BlockCollisionOption.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), null), position);
|
||||
MovingObjectPosition nmsHitResult = world.clip(new RayTrace(startPos, endPos, RayTrace.BlockCollisionOption.OUTLINE, CraftFluidCollisionMode.toNMS(fluidCollisionMode), null), position);
|
||||
return CraftRayTraceResult.fromNMS(this.getWorld(), nmsHitResult);
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ public class CraftBlock implements Block {
|
||||
return new BoundingBox(); // Return an empty bounding box if the block has no dimension
|
||||
}
|
||||
|
||||
AxisAlignedBB aabb = shape.getBoundingBox();
|
||||
AxisAlignedBB aabb = shape.bounds();
|
||||
return new BoundingBox(getX() + aabb.minX, getY() + aabb.minY, getZ() + aabb.minZ, getX() + aabb.maxX, getY() + aabb.maxY, getZ() + aabb.maxZ);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public abstract class CraftBlockEntityState<T extends TileEntity> extends CraftB
|
||||
private final T snapshot;
|
||||
|
||||
public CraftBlockEntityState(World world, T tileEntity) {
|
||||
super(world, tileEntity.getPosition(), tileEntity.getBlock());
|
||||
super(world, tileEntity.getBlockPos(), tileEntity.getBlockState());
|
||||
|
||||
this.tileEntity = tileEntity;
|
||||
|
||||
@@ -30,15 +30,15 @@ public abstract class CraftBlockEntityState<T extends TileEntity> extends CraftB
|
||||
return null;
|
||||
}
|
||||
|
||||
NBTTagCompound nbtTagCompound = tileEntity.save(new NBTTagCompound());
|
||||
T snapshot = (T) TileEntity.create(getPosition(), getHandle(), nbtTagCompound);
|
||||
NBTTagCompound nbtTagCompound = tileEntity.saveWithFullMetadata();
|
||||
T snapshot = (T) TileEntity.loadStatic(getPosition(), getHandle(), nbtTagCompound);
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
// copies the TileEntity-specific data, retains the position
|
||||
private void copyData(T from, T to) {
|
||||
NBTTagCompound nbtTagCompound = from.save(new NBTTagCompound());
|
||||
NBTTagCompound nbtTagCompound = from.saveWithFullMetadata();
|
||||
to.load(nbtTagCompound);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public abstract class CraftBlockEntityState<T extends TileEntity> extends CraftB
|
||||
protected TileEntity getTileEntityFromWorld() {
|
||||
requirePlaced();
|
||||
|
||||
return getWorldHandle().getTileEntity(this.getPosition());
|
||||
return getWorldHandle().getBlockEntity(this.getPosition());
|
||||
}
|
||||
|
||||
// gets the NBT data of the TileEntity represented by this block state
|
||||
@@ -64,7 +64,7 @@ public abstract class CraftBlockEntityState<T extends TileEntity> extends CraftB
|
||||
// update snapshot
|
||||
applyTo(snapshot);
|
||||
|
||||
return snapshot.save(new NBTTagCompound());
|
||||
return snapshot.saveWithFullMetadata();
|
||||
}
|
||||
|
||||
// copies the data of the given tile entity to this block state
|
||||
@@ -94,7 +94,7 @@ public abstract class CraftBlockEntityState<T extends TileEntity> extends CraftB
|
||||
|
||||
if (isApplicable(tile)) {
|
||||
applyTo((T) tile);
|
||||
tile.update();
|
||||
tile.setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class CraftBlockState implements BlockState {
|
||||
Preconditions.checkArgument(type.isBlock(), "Material must be a block!");
|
||||
|
||||
if (this.getType() != type) {
|
||||
this.data = CraftMagicNumbers.getBlock(type).getBlockData();
|
||||
this.data = CraftMagicNumbers.getBlock(type).defaultBlockState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public class CraftBlockState implements BlockState {
|
||||
IBlockData newBlock = this.data;
|
||||
block.setTypeAndData(newBlock, applyPhysics);
|
||||
if (access instanceof net.minecraft.world.level.World) {
|
||||
world.getHandle().notify(
|
||||
world.getHandle().sendBlockUpdated(
|
||||
position,
|
||||
block.getNMS(),
|
||||
newBlock,
|
||||
@@ -226,7 +226,7 @@ public class CraftBlockState implements BlockState {
|
||||
|
||||
// Update levers etc
|
||||
if (false && applyPhysics && getData() instanceof Attachable) { // Call does not map to new API
|
||||
world.getHandle().applyPhysics(position.shift(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock());
|
||||
world.getHandle().updateNeighborsAt(position.relative(CraftBlock.blockFaceToNotch(((Attachable) getData()).getAttachedFace())), newBlock.getBlock());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -326,7 +326,7 @@ public final class CraftBlockStates {
|
||||
CraftWorld world = (CraftWorld) block.getWorld();
|
||||
BlockPosition blockPosition = craftBlock.getPosition();
|
||||
IBlockData blockData = craftBlock.getNMS();
|
||||
TileEntity tileEntity = craftBlock.getHandle().getTileEntity(blockPosition);
|
||||
TileEntity tileEntity = craftBlock.getHandle().getBlockEntity(blockPosition);
|
||||
CraftBlockState blockState = getBlockState(world, blockPosition, blockData, tileEntity);
|
||||
blockState.setWorldHandle(craftBlock.getHandle()); // Inject the block's generator access
|
||||
return blockState;
|
||||
@@ -338,7 +338,7 @@ public final class CraftBlockStates {
|
||||
|
||||
public static BlockState getBlockState(BlockPosition blockPosition, Material material, @Nullable NBTTagCompound blockEntityTag) {
|
||||
Preconditions.checkNotNull(material, "material is null");
|
||||
IBlockData blockData = CraftMagicNumbers.getBlock(material).getBlockData();
|
||||
IBlockData blockData = CraftMagicNumbers.getBlock(material).defaultBlockState();
|
||||
return getBlockState(blockPosition, blockData, blockEntityTag);
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ public final class CraftBlockStates {
|
||||
public static BlockState getBlockState(BlockPosition blockPosition, IBlockData blockData, @Nullable NBTTagCompound blockEntityTag) {
|
||||
Preconditions.checkNotNull(blockPosition, "blockPosition is null");
|
||||
Preconditions.checkNotNull(blockData, "blockData is null");
|
||||
TileEntity tileEntity = (blockEntityTag == null) ? null : TileEntity.create(blockPosition, blockData, blockEntityTag);
|
||||
TileEntity tileEntity = (blockEntityTag == null) ? null : TileEntity.loadStatic(blockPosition, blockData, blockEntityTag);
|
||||
return getBlockState(null, blockPosition, blockData, tileEntity);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
|
||||
CraftWorld world = (CraftWorld) this.getWorld();
|
||||
|
||||
BlockChest blockChest = (BlockChest) (this.getType() == Material.CHEST ? Blocks.CHEST : Blocks.TRAPPED_CHEST);
|
||||
ITileInventory nms = blockChest.getInventory(data, world.getHandle(), this.getPosition(), true);
|
||||
ITileInventory nms = blockChest.getMenuProvider(data, world.getHandle(), this.getPosition(), true);
|
||||
|
||||
if (nms instanceof BlockChest.DoubleInventory) {
|
||||
inventory = new CraftInventoryDoubleChest((BlockChest.DoubleInventory) nms);
|
||||
@@ -57,9 +57,9 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
|
||||
public void open() {
|
||||
requirePlaced();
|
||||
if (!getTileEntity().openersCounter.opened && getWorldHandle() instanceof net.minecraft.world.level.World) {
|
||||
IBlockData block = getTileEntity().getBlock();
|
||||
getTileEntity().getWorld().playBlockAction(getPosition(), block.getBlock(), 1, getTileEntity().openersCounter.getOpenerCount() + 1);
|
||||
TileEntityChest.playOpenSound(getTileEntity().getWorld(), getPosition(), block, SoundEffects.CHEST_OPEN);
|
||||
IBlockData block = getTileEntity().getBlockState();
|
||||
getTileEntity().getLevel().blockEvent(getPosition(), block.getBlock(), 1, getTileEntity().openersCounter.getOpenerCount() + 1);
|
||||
TileEntityChest.playSound(getTileEntity().getLevel(), getPosition(), block, SoundEffects.CHEST_OPEN);
|
||||
}
|
||||
getTileEntity().openersCounter.opened = true;
|
||||
}
|
||||
@@ -68,9 +68,9 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
|
||||
public void close() {
|
||||
requirePlaced();
|
||||
if (getTileEntity().openersCounter.opened && getWorldHandle() instanceof net.minecraft.world.level.World) {
|
||||
IBlockData block = getTileEntity().getBlock();
|
||||
getTileEntity().getWorld().playBlockAction(getPosition(), block.getBlock(), 1, 0);
|
||||
TileEntityChest.playOpenSound(getTileEntity().getWorld(), getPosition(), block, SoundEffects.CHEST_CLOSE);
|
||||
IBlockData block = getTileEntity().getBlockState();
|
||||
getTileEntity().getLevel().blockEvent(getPosition(), block.getBlock(), 1, 0);
|
||||
TileEntityChest.playSound(getTileEntity().getLevel(), getPosition(), block, SoundEffects.CHEST_CLOSE);
|
||||
}
|
||||
getTileEntity().openersCounter.opened = false;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import java.util.Optional;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.level.block.entity.TileEntityMobSpawner;
|
||||
import org.bukkit.World;
|
||||
@@ -17,8 +16,8 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
|
||||
|
||||
@Override
|
||||
public EntityType getSpawnedType() {
|
||||
MinecraftKey key = this.getSnapshot().getSpawner().getMobName(null, BlockPosition.ZERO);
|
||||
return (key == null) ? EntityType.PIG : EntityType.fromName(key.getKey());
|
||||
Optional<EntityTypes<?>> type = EntityTypes.by(this.getSnapshot().getSpawner().nextSpawnData.getEntityToSpawn());
|
||||
return (type.isEmpty()) ? EntityType.PIG : EntityType.fromName(EntityTypes.getKey(type.get()).getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -27,12 +26,13 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
|
||||
throw new IllegalArgumentException("Can't spawn EntityType " + entityType + " from mobspawners!");
|
||||
}
|
||||
|
||||
this.getSnapshot().getSpawner().setMobName(EntityTypes.a(entityType.getName()).get());
|
||||
this.getSnapshot().getSpawner().setEntityId(EntityTypes.byString(entityType.getName()).get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCreatureTypeName() {
|
||||
return this.getSnapshot().getSpawner().getMobName(null, BlockPosition.ZERO).getKey();
|
||||
Optional<EntityTypes<?>> type = EntityTypes.by(this.getSnapshot().getSpawner().nextSpawnData.getEntityToSpawn());
|
||||
return (type.isEmpty()) ? "" : EntityTypes.getKey(type.get()).getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CraftDispenser extends CraftLootable<TileEntityDispenser> implement
|
||||
CraftWorld world = (CraftWorld) this.getWorld();
|
||||
BlockDispenser dispense = (BlockDispenser) Blocks.DISPENSER;
|
||||
|
||||
dispense.dispense(world.getHandle(), this.getPosition());
|
||||
dispense.dispenseFrom(world.getHandle(), this.getPosition());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CraftDropper extends CraftLootable<TileEntityDropper> implements Dr
|
||||
CraftWorld world = (CraftWorld) this.getWorld();
|
||||
BlockDropper drop = (BlockDropper) Blocks.DROPPER;
|
||||
|
||||
drop.dispense(world.getHandle(), this.getPosition());
|
||||
drop.dispenseFrom(world.getHandle(), this.getPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftCon
|
||||
public void setBurnTime(short burnTime) {
|
||||
this.getSnapshot().litTime = burnTime;
|
||||
// SPIGOT-844: Allow lighting and relighting using this API
|
||||
this.data = this.data.set(BlockFurnace.LIT, burnTime > 0);
|
||||
this.data = this.data.setValue(BlockFurnace.LIT, burnTime > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,9 +28,9 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> imple
|
||||
CraftWorld world = (CraftWorld) this.getWorld();
|
||||
Material record = this.getPlaying();
|
||||
if (record == Material.AIR) {
|
||||
getWorldHandle().setTypeAndData(this.getPosition(), Blocks.JUKEBOX.getBlockData().set(BlockJukeBox.HAS_RECORD, false), 3);
|
||||
getWorldHandle().setBlock(this.getPosition(), Blocks.JUKEBOX.defaultBlockState().setValue(BlockJukeBox.HAS_RECORD, false), 3);
|
||||
} else {
|
||||
getWorldHandle().setTypeAndData(this.getPosition(), Blocks.JUKEBOX.getBlockData().set(BlockJukeBox.HAS_RECORD, true), 3);
|
||||
getWorldHandle().setBlock(this.getPosition(), Blocks.JUKEBOX.defaultBlockState().setValue(BlockJukeBox.HAS_RECORD, true), 3);
|
||||
}
|
||||
world.playEffect(this.getLocation(), Effect.RECORD_PLAY, record);
|
||||
}
|
||||
@@ -63,15 +63,15 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> imple
|
||||
ItemStack nms = CraftItemStack.asNMSCopy(record);
|
||||
this.getSnapshot().setRecord(nms);
|
||||
if (nms.isEmpty()) {
|
||||
this.data = this.data.set(BlockJukeBox.HAS_RECORD, false);
|
||||
this.data = this.data.setValue(BlockJukeBox.HAS_RECORD, false);
|
||||
} else {
|
||||
this.data = this.data.set(BlockJukeBox.HAS_RECORD, true);
|
||||
this.data = this.data.setValue(BlockJukeBox.HAS_RECORD, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlaying() {
|
||||
return getHandle().get(BlockJukeBox.HAS_RECORD);
|
||||
return getHandle().getValue(BlockJukeBox.HAS_RECORD);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,7 +89,7 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> imple
|
||||
TileEntityJukeBox jukebox = (TileEntityJukeBox) tileEntity;
|
||||
boolean result = !jukebox.getRecord().isEmpty();
|
||||
CraftWorld world = (CraftWorld) this.getWorld();
|
||||
((BlockJukeBox) Blocks.JUKEBOX).dropRecord(world.getHandle(), getPosition());
|
||||
((BlockJukeBox) Blocks.JUKEBOX).dropRecording(world.getHandle(), getPosition());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CraftLectern extends CraftBlockEntityState<TileEntityLectern> imple
|
||||
boolean result = super.update(force, applyPhysics);
|
||||
|
||||
if (result && this.getType() == Material.LECTERN && getWorldHandle() instanceof net.minecraft.world.level.World) {
|
||||
BlockLectern.a(this.world.getHandle(), this.getPosition(), this.getHandle());
|
||||
BlockLectern.signalPageChange(this.world.getHandle(), this.getPosition(), this.getHandle());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -36,15 +36,15 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> impleme
|
||||
public DyeColor getColor() {
|
||||
EnumColor color = ((BlockShulkerBox) CraftMagicNumbers.getBlock(this.getType())).color;
|
||||
|
||||
return (color == null) ? null : DyeColor.getByWoolData((byte) color.getColorIndex());
|
||||
return (color == null) ? null : DyeColor.getByWoolData((byte) color.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
requirePlaced();
|
||||
if (!getTileEntity().opened && getWorldHandle() instanceof net.minecraft.world.level.World) {
|
||||
net.minecraft.world.level.World world = getTileEntity().getWorld();
|
||||
world.playBlockAction(getPosition(), getTileEntity().getBlock().getBlock(), 1, 1);
|
||||
net.minecraft.world.level.World world = getTileEntity().getLevel();
|
||||
world.blockEvent(getPosition(), getTileEntity().getBlockState().getBlock(), 1, 1);
|
||||
world.playSound(null, getPosition(), SoundEffects.SHULKER_BOX_OPEN, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
getTileEntity().opened = true;
|
||||
@@ -54,8 +54,8 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> impleme
|
||||
public void close() {
|
||||
requirePlaced();
|
||||
if (getTileEntity().opened && getWorldHandle() instanceof net.minecraft.world.level.World) {
|
||||
net.minecraft.world.level.World world = getTileEntity().getWorld();
|
||||
world.playBlockAction(getPosition(), getTileEntity().getBlock().getBlock(), 1, 0);
|
||||
net.minecraft.world.level.World world = getTileEntity().getLevel();
|
||||
world.blockEvent(getPosition(), getTileEntity().getBlockState().getBlock(), 1, 0);
|
||||
world.playSound(null, getPosition(), SoundEffects.SHULKER_BOX_OPEN, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
getTileEntity().opened = false;
|
||||
|
||||
@@ -64,12 +64,12 @@ public class CraftSign extends CraftBlockEntityState<TileEntitySign> implements
|
||||
|
||||
@Override
|
||||
public DyeColor getColor() {
|
||||
return DyeColor.getByWoolData((byte) getSnapshot().getColor().getColorIndex());
|
||||
return DyeColor.getByWoolData((byte) getSnapshot().getColor().getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor(DyeColor color) {
|
||||
getSnapshot().setColor(EnumColor.fromColorIndex(color.getWoolData()));
|
||||
getSnapshot().setColor(EnumColor.byId(color.getWoolData()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +82,7 @@ public class CraftSign extends CraftBlockEntityState<TileEntitySign> implements
|
||||
if (line.equals(originalLines[i])) {
|
||||
continue; // The line contents are still the same, skip.
|
||||
}
|
||||
sign.a(i, CraftChatMessage.fromString(line)[0]);
|
||||
sign.setMessage(i, CraftChatMessage.fromString(line)[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
|
||||
return false;
|
||||
}
|
||||
|
||||
GameProfile profile = MinecraftServer.getServer().getUserCache().getProfile(name).orElse(null);
|
||||
GameProfile profile = MinecraftServer.getServer().getProfileCache().get(name).orElse(null);
|
||||
if (profile == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
|
||||
super.applyTo(skull);
|
||||
|
||||
if (getSkullType() == SkullType.PLAYER) {
|
||||
skull.setGameProfile(profile);
|
||||
skull.setOwner(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
|
||||
@Override
|
||||
public void setAuthor(LivingEntity entity) {
|
||||
Preconditions.checkArgument(entity != null, "Structure Block author entity cannot be null");
|
||||
getSnapshot().setAuthor(((CraftLivingEntity) entity).getHandle());
|
||||
getSnapshot().createdBy(((CraftLivingEntity) entity).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +105,7 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
|
||||
|
||||
@Override
|
||||
public UsageMode getUsageMode() {
|
||||
return UsageMode.valueOf(getSnapshot().getUsageMode().name());
|
||||
return UsageMode.valueOf(getSnapshot().getMode().name());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,13 +179,13 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
|
||||
|
||||
// Ensure block type is correct
|
||||
if (access instanceof net.minecraft.world.level.World) {
|
||||
tileEntity.setUsageMode(tileEntity.getUsageMode());
|
||||
tileEntity.setMode(tileEntity.getMode());
|
||||
} else if (access != null) {
|
||||
// Custom handle during world generation
|
||||
// From TileEntityStructure#setUsageMode(BlockPropertyStructureMode)
|
||||
net.minecraft.world.level.block.state.IBlockData data = access.getType(this.getPosition());
|
||||
if (data.a(net.minecraft.world.level.block.Blocks.STRUCTURE_BLOCK)) {
|
||||
access.setTypeAndData(this.getPosition(), data.set(net.minecraft.world.level.block.BlockStructure.MODE, tileEntity.getUsageMode()), 2);
|
||||
net.minecraft.world.level.block.state.IBlockData data = access.getBlockState(this.getPosition());
|
||||
if (data.is(net.minecraft.world.level.block.Blocks.STRUCTURE_BLOCK)) {
|
||||
access.setBlock(this.getPosition(), data.setValue(net.minecraft.world.level.block.BlockStructure.MODE, tileEntity.getMode()), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class CraftBlockData implements BlockData {
|
||||
* @return the matching Bukkit type
|
||||
*/
|
||||
protected <B extends Enum<B>> B get(BlockStateEnum<?> nms, Class<B> bukkit) {
|
||||
return toBukkit(state.get(nms), bukkit);
|
||||
return toBukkit(state.getValue(nms), bukkit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class CraftBlockData implements BlockData {
|
||||
protected <B extends Enum<B>> Set<B> getValues(BlockStateEnum<?> nms, Class<B> bukkit) {
|
||||
ImmutableSet.Builder<B> values = ImmutableSet.builder();
|
||||
|
||||
for (Enum<?> e : nms.getValues()) {
|
||||
for (Enum<?> e : nms.getPossibleValues()) {
|
||||
values.add(toBukkit(e, bukkit));
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class CraftBlockData implements BlockData {
|
||||
*/
|
||||
protected <B extends Enum<B>, N extends Enum<N> & INamable> void set(BlockStateEnum<N> nms, Enum<B> bukkit) {
|
||||
this.parsedStates = null;
|
||||
this.state = this.state.set(nms, toNMS(bukkit, nms.getType()));
|
||||
this.state = this.state.setValue(nms, toNMS(bukkit, nms.getValueClass()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,7 +106,7 @@ public class CraftBlockData implements BlockData {
|
||||
clone.parsedStates = null;
|
||||
|
||||
for (IBlockState parsed : craft.parsedStates.keySet()) {
|
||||
clone.state = clone.state.set(parsed, craft.state.get(parsed));
|
||||
clone.state = clone.state.setValue(parsed, craft.state.getValue(parsed));
|
||||
}
|
||||
|
||||
return clone;
|
||||
@@ -178,7 +178,7 @@ public class CraftBlockData implements BlockData {
|
||||
*/
|
||||
protected <T extends Comparable<T>> T get(IBlockState<T> ibs) {
|
||||
// Straight integer or boolean getter
|
||||
return this.state.get(ibs);
|
||||
return this.state.getValue(ibs);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,12 +192,12 @@ public class CraftBlockData implements BlockData {
|
||||
public <T extends Comparable<T>, V extends T> void set(IBlockState<T> ibs, V v) {
|
||||
// Straight integer or boolean setter
|
||||
this.parsedStates = null;
|
||||
this.state = this.state.set(ibs, v);
|
||||
this.state = this.state.setValue(ibs, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsString() {
|
||||
return toString(state.getStateMap());
|
||||
return toString(state.getValues());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,10 +235,10 @@ public class CraftBlockData implements BlockData {
|
||||
public NBTTagCompound toStates() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : state.getStateMap().entrySet()) {
|
||||
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : state.getValues().entrySet()) {
|
||||
IBlockState iblockstate = (IBlockState) entry.getKey();
|
||||
|
||||
compound.setString(iblockstate.getName(), iblockstate.a(entry.getValue()));
|
||||
compound.putString(iblockstate.getName(), iblockstate.getName(entry.getValue()));
|
||||
}
|
||||
|
||||
return compound;
|
||||
@@ -303,9 +303,9 @@ public class CraftBlockData implements BlockData {
|
||||
for (Block instance : IRegistry.BLOCK) {
|
||||
if (instance.getClass() == block) {
|
||||
if (state == null) {
|
||||
state = instance.getStates().a(name);
|
||||
state = instance.getStateDefinition().getProperty(name);
|
||||
} else {
|
||||
IBlockState<?> newState = instance.getStates().a(name);
|
||||
IBlockState<?> newState = instance.getStateDefinition().getProperty(name);
|
||||
|
||||
Preconditions.checkState(state == newState, "State mistmatch %s,%s", state, newState);
|
||||
}
|
||||
@@ -510,16 +510,16 @@ public class CraftBlockData implements BlockData {
|
||||
}
|
||||
|
||||
StringReader reader = new StringReader(data);
|
||||
ArgumentBlock arg = new ArgumentBlock(reader, false).a(false);
|
||||
ArgumentBlock arg = new ArgumentBlock(reader, false).parse(false);
|
||||
Preconditions.checkArgument(!reader.canRead(), "Spurious trailing data: " + data);
|
||||
|
||||
blockData = arg.getBlockData();
|
||||
parsed = arg.getStateMap();
|
||||
blockData = arg.getState();
|
||||
parsed = arg.getProperties();
|
||||
} catch (CommandSyntaxException ex) {
|
||||
throw new IllegalArgumentException("Could not parse data: " + data, ex);
|
||||
}
|
||||
} else {
|
||||
blockData = block.getBlockData();
|
||||
blockData = block.defaultBlockState();
|
||||
}
|
||||
|
||||
CraftBlockData craft = fromData(blockData);
|
||||
@@ -533,6 +533,6 @@ public class CraftBlockData implements BlockData {
|
||||
|
||||
@Override
|
||||
public SoundGroup getSoundGroup() {
|
||||
return CraftSoundGroup.getSoundGroup(state.getStepSound());
|
||||
return CraftSoundGroup.getSoundGroup(state.getSoundType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*/
|
||||
package org.bukkit.craftbukkit.block.impl;
|
||||
|
||||
import org.bukkit.block.data.type.BigDripleaf.Tilt;
|
||||
|
||||
public final class CraftBigDripleaf extends org.bukkit.craftbukkit.block.data.CraftBlockData implements org.bukkit.block.data.type.BigDripleaf, org.bukkit.block.data.type.Dripleaf, org.bukkit.block.data.Directional, org.bukkit.block.data.Waterlogged {
|
||||
|
||||
public CraftBigDripleaf() {
|
||||
|
||||
Reference in New Issue
Block a user