SPIGOT-7283, SPIGOT-7318: Add AsyncStructureGenerateEvent and BlockState cloning

By: Lauriichan <laura.endress@playuniverse.org>
This commit is contained in:
CraftBukkit/Spigot
2023-09-29 06:54:35 +10:00
parent bbc6a0e459
commit c651c0a51b
61 changed files with 1920 additions and 4 deletions

View File

@@ -21,6 +21,12 @@ public final class CapturedBlockState extends CraftBlockState {
this.treeBlock = treeBlock;
}
protected CapturedBlockState(CapturedBlockState state) {
super(state);
this.treeBlock = state.treeBlock;
}
@Override
public boolean update(boolean force, boolean applyPhysics) {
boolean result = super.update(force, applyPhysics);
@@ -50,6 +56,11 @@ public final class CapturedBlockState extends CraftBlockState {
return result;
}
@Override
public CapturedBlockState copy() {
return new CapturedBlockState(this);
}
public static CapturedBlockState getBlockState(World world, BlockPosition pos, int flag) {
return new CapturedBlockState(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), flag, false);
}

View File

@@ -23,6 +23,10 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
super(world, tileEntity);
}
protected CraftBanner(CraftBanner state) {
super(state);
}
@Override
public void load(TileEntityBanner banner) {
super.load(banner);
@@ -100,4 +104,9 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
}
banner.itemPatterns = newPatterns;
}
@Override
public CraftBanner copy() {
return new CraftBanner(this);
}
}

View File

@@ -15,6 +15,10 @@ public class CraftBarrel extends CraftLootable<TileEntityBarrel> implements Barr
super(world, tileEntity);
}
protected CraftBarrel(CraftBarrel state) {
super(state);
}
@Override
public Inventory getSnapshotInventory() {
return new CraftInventory(this.getSnapshot());
@@ -58,4 +62,9 @@ public class CraftBarrel extends CraftLootable<TileEntityBarrel> implements Barr
}
getTileEntity().openersCounter.opened = false;
}
@Override
public CraftBarrel copy() {
return new CraftBarrel(this);
}
}

View File

@@ -20,6 +20,10 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
super(world, tileEntity);
}
protected CraftBeacon(CraftBeacon state) {
super(state);
}
@Override
public Collection<LivingEntity> getEntitiesInRange() {
ensureNoWorldGeneration();
@@ -92,4 +96,9 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
public void setLock(String key) {
this.getSnapshot().lockKey = (key == null) ? ChestLock.NO_LOCK : new ChestLock(key);
}
@Override
public CraftBeacon copy() {
return new CraftBeacon(this);
}
}

View File

@@ -11,6 +11,10 @@ public class CraftBed extends CraftBlockEntityState<TileEntityBed> implements Be
super(world, tileEntity);
}
protected CraftBed(CraftBed state) {
super(state);
}
@Override
public DyeColor getColor() {
switch (getType()) {
@@ -55,4 +59,9 @@ public class CraftBed extends CraftBlockEntityState<TileEntityBed> implements Be
public void setColor(DyeColor color) {
throw new UnsupportedOperationException("Must set block type to appropriate bed colour");
}
@Override
public CraftBed copy() {
return new CraftBed(this);
}
}

View File

@@ -20,6 +20,10 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
super(world, tileEntity);
}
protected CraftBeehive(CraftBeehive state) {
super(state);
}
@Override
public Location getFlower() {
BlockPosition flower = getSnapshot().savedFlowerPos;
@@ -81,4 +85,9 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
getSnapshot().addOccupant(((CraftBee) entity).getHandle(), false);
}
@Override
public CraftBeehive copy() {
return new CraftBeehive(this);
}
}

View File

@@ -18,6 +18,10 @@ public class CraftBell extends CraftBlockEntityState<TileEntityBell> implements
super(world, tileEntity);
}
protected CraftBell(CraftBell state) {
super(state);
}
@Override
public boolean ring(Entity entity, BlockFace direction) {
Preconditions.checkArgument(direction == null || direction.isCartesian(), "direction must be cartesian, given %s", direction);
@@ -67,4 +71,9 @@ public class CraftBell extends CraftBlockEntityState<TileEntityBell> implements
public int getResonatingTicks() {
return isResonating() ? getSnapshot().ticks : 0;
}
@Override
public CraftBell copy() {
return new CraftBell(this);
}
}

View File

@@ -9,4 +9,13 @@ public class CraftBlastFurnace extends CraftFurnace<TileEntityBlastFurnace> impl
public CraftBlastFurnace(World world, TileEntityBlastFurnace tileEntity) {
super(world, tileEntity);
}
protected CraftBlastFurnace(CraftBlastFurnace state) {
super(state);
}
@Override
public CraftBlastFurnace copy() {
return new CraftBlastFurnace(this);
}
}

View File

@@ -28,6 +28,13 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
this.load(snapshot);
}
protected CraftBlockEntityState(CraftBlockEntityState<T> state) {
super(state);
this.tileEntity = createSnapshot(state.snapshot);
this.snapshot = tileEntity;
load(snapshot);
}
public void refreshSnapshot() {
this.load(tileEntity);
}
@@ -43,6 +50,12 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
return snapshot;
}
// Loads the specified data into the snapshot TileEntity.
public void loadData(NBTTagCompound nbtTagCompound) {
snapshot.load(nbtTagCompound);
load(snapshot);
}
// copies the TileEntity-specific data, retains the position
private void copyData(T from, T to) {
NBTTagCompound nbtTagCompound = from.saveWithFullMetadata();
@@ -118,4 +131,9 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
T vanillaTileEntitiy = (T) TileEntity.loadStatic(CraftLocation.toBlockPosition(location), getHandle(), getSnapshotNBT());
return PacketPlayOutTileEntityData.create(vanillaTileEntitiy);
}
@Override
public CraftBlockEntityState<T> copy() {
return new CraftBlockEntityState<>(this);
}
}

View File

@@ -50,6 +50,15 @@ public class CraftBlockState implements BlockState {
data = blockData;
}
// Creates a unplaced copy (world == null copy)
protected CraftBlockState(CraftBlockState state) {
this.world = null;
this.position = state.getPosition().immutable();
this.data = state.data;
this.flag = state.flag;
setWorldHandle(state.getWorldHandle());
}
public void setWorldHandle(GeneratorAccess generatorAccess) {
if (generatorAccess instanceof net.minecraft.world.level.World) {
this.weakWorld = null;
@@ -318,4 +327,9 @@ public class CraftBlockState implements BlockState {
protected void requirePlaced() {
Preconditions.checkState(isPlaced(), "The blockState must be placed to call this method");
}
@Override
public CraftBlockState copy() {
return new CraftBlockState(this);
}
}

View File

@@ -12,6 +12,10 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
super(world, tileEntity);
}
protected CraftBrewingStand(CraftBrewingStand state) {
super(state);
}
@Override
public BrewerInventory getSnapshotInventory() {
return new CraftInventoryBrewer(this.getSnapshot());
@@ -45,4 +49,9 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
public void setFuelLevel(int level) {
this.getSnapshot().fuel = level;
}
@Override
public CraftBrewingStand copy() {
return new CraftBrewingStand(this);
}
}

View File

@@ -16,6 +16,10 @@ public class CraftBrushableBlock extends CraftBlockEntityState<BrushableBlockEnt
super(world, tileEntity);
}
protected CraftBrushableBlock(CraftBrushableBlock state) {
super(state);
}
@Override
public ItemStack getItem() {
return CraftItemStack.asBukkitCopy(getSnapshot().getItem());
@@ -64,4 +68,9 @@ public class CraftBrushableBlock extends CraftBlockEntityState<BrushableBlockEnt
MinecraftKey key = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
getSnapshot().setLootTable(key, seed);
}
@Override
public CraftBrushableBlock copy() {
return new CraftBrushableBlock(this);
}
}

View File

@@ -9,4 +9,13 @@ public class CraftCalibratedSculkSensor extends CraftSculkSensor<CalibratedSculk
public CraftCalibratedSculkSensor(World world, CalibratedSculkSensorBlockEntity tileEntity) {
super(world, tileEntity);
}
protected CraftCalibratedSculkSensor(CraftCalibratedSculkSensor state) {
super(state);
}
@Override
public CraftCalibratedSculkSensor copy() {
return new CraftCalibratedSculkSensor(this);
}
}

View File

@@ -12,6 +12,10 @@ public class CraftCampfire extends CraftBlockEntityState<TileEntityCampfire> imp
super(world, tileEntity);
}
protected CraftCampfire(CraftCampfire state) {
super(state);
}
@Override
public int getSize() {
return getSnapshot().getItems().size();
@@ -47,4 +51,9 @@ public class CraftCampfire extends CraftBlockEntityState<TileEntityCampfire> imp
public void setCookTimeTotal(int index, int cookTimeTotal) {
getSnapshot().cookingTime[index] = cookTimeTotal;
}
@Override
public CraftCampfire copy() {
return new CraftCampfire(this);
}
}

View File

@@ -19,6 +19,10 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
super(world, tileEntity);
}
protected CraftChest(CraftChest state) {
super(state);
}
@Override
public Inventory getSnapshotInventory() {
return new CraftInventory(this.getSnapshot());
@@ -77,4 +81,9 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
}
getTileEntity().openersCounter.opened = false;
}
@Override
public CraftChest copy() {
return new CraftChest(this);
}
}

View File

@@ -17,6 +17,10 @@ public class CraftChiseledBookshelf extends CraftBlockEntityState<ChiseledBookSh
super(world, tileEntity);
}
protected CraftChiseledBookshelf(CraftChiseledBookshelf state) {
super(state);
}
@Override
public int getLastInteractedSlot() {
return getSnapshot().getLastInteractedSlot();
@@ -67,4 +71,9 @@ public class CraftChiseledBookshelf extends CraftBlockEntityState<ChiseledBookSh
return ChiseledBookShelfBlock.getHitSlot(faceVector);
}
@Override
public CraftChiseledBookshelf copy() {
return new CraftChiseledBookshelf(this);
}
}

View File

@@ -11,6 +11,10 @@ public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand>
super(world, tileEntity);
}
protected CraftCommandBlock(CraftCommandBlock state) {
super(state);
}
@Override
public String getCommand() {
return getSnapshot().getCommandBlock().getCommand();
@@ -30,4 +34,9 @@ public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand>
public void setName(String name) {
getSnapshot().getCommandBlock().setName(CraftChatMessage.fromStringOrNull(name != null ? name : "@"));
}
@Override
public CraftCommandBlock copy() {
return new CraftCommandBlock(this);
}
}

View File

@@ -9,4 +9,13 @@ public class CraftComparator extends CraftBlockEntityState<TileEntityComparator>
public CraftComparator(World world, TileEntityComparator tileEntity) {
super(world, tileEntity);
}
protected CraftComparator(CraftComparator state) {
super(state);
}
@Override
public CraftComparator copy() {
return new CraftComparator(this);
}
}

View File

@@ -9,4 +9,13 @@ public class CraftConduit extends CraftBlockEntityState<TileEntityConduit> imple
public CraftConduit(World world, TileEntityConduit tileEntity) {
super(world, tileEntity);
}
protected CraftConduit(CraftConduit state) {
super(state);
}
@Override
public CraftConduit copy() {
return new CraftConduit(this);
}
}

View File

@@ -12,6 +12,10 @@ public abstract class CraftContainer<T extends TileEntityContainer> extends Craf
super(world, tileEntity);
}
protected CraftContainer(CraftContainer<T> state) {
super(state);
}
@Override
public boolean isLocked() {
return !this.getSnapshot().lockKey.key.isEmpty();
@@ -46,4 +50,7 @@ public abstract class CraftContainer<T extends TileEntityContainer> extends Craf
container.setCustomName(null);
}
}
@Override
public abstract CraftContainer<T> copy();
}

View File

@@ -18,6 +18,10 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
super(world, tileEntity);
}
protected CraftCreatureSpawner(CraftCreatureSpawner state) {
super(state);
}
@Override
public EntityType getSpawnedType() {
MobSpawnerData spawnData = this.getSnapshot().getSpawner().nextSpawnData;
@@ -136,4 +140,9 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
public void setSpawnRange(int spawnRange) {
this.getSnapshot().getSpawner().spawnRange = spawnRange;
}
@Override
public CraftCreatureSpawner copy() {
return new CraftCreatureSpawner(this);
}
}

View File

@@ -9,4 +9,13 @@ public class CraftDaylightDetector extends CraftBlockEntityState<TileEntityLight
public CraftDaylightDetector(World world, TileEntityLightDetector tileEntity) {
super(world, tileEntity);
}
protected CraftDaylightDetector(CraftDaylightDetector state) {
super(state);
}
@Override
public CraftDaylightDetector copy() {
return new CraftDaylightDetector(this);
}
}

View File

@@ -20,6 +20,10 @@ public class CraftDecoratedPot extends CraftBlockEntityState<DecoratedPotBlockEn
super(world, tileEntity);
}
protected CraftDecoratedPot(CraftDecoratedPot state) {
super(state);
}
@Override
public void setSherd(Side face, Material sherd) {
Preconditions.checkArgument(face != null, "face must not be null");
@@ -69,4 +73,9 @@ public class CraftDecoratedPot extends CraftBlockEntityState<DecoratedPotBlockEn
public List<Material> getShards() {
return getSnapshot().getDecorations().sorted().map(CraftMagicNumbers::getMaterial).collect(Collectors.toUnmodifiableList());
}
@Override
public CraftDecoratedPot copy() {
return new CraftDecoratedPot(this);
}
}

View File

@@ -19,6 +19,10 @@ public class CraftDispenser extends CraftLootable<TileEntityDispenser> implement
super(world, tileEntity);
}
protected CraftDispenser(CraftDispenser state) {
super(state);
}
@Override
public Inventory getSnapshotInventory() {
return new CraftInventory(this.getSnapshot());
@@ -58,4 +62,9 @@ public class CraftDispenser extends CraftLootable<TileEntityDispenser> implement
return false;
}
}
@Override
public CraftDispenser copy() {
return new CraftDispenser(this);
}
}

View File

@@ -17,6 +17,10 @@ public class CraftDropper extends CraftLootable<TileEntityDropper> implements Dr
super(world, tileEntity);
}
protected CraftDropper(CraftDropper state) {
super(state);
}
@Override
public Inventory getSnapshotInventory() {
return new CraftInventory(this.getSnapshot());
@@ -42,4 +46,9 @@ public class CraftDropper extends CraftLootable<TileEntityDropper> implements Dr
drop.dispenseFrom(world.getHandle(), this.getHandle(), this.getPosition());
}
}
@Override
public CraftDropper copy() {
return new CraftDropper(this);
}
}

View File

@@ -11,6 +11,10 @@ public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchan
super(world, tileEntity);
}
protected CraftEnchantingTable(CraftEnchantingTable state) {
super(state);
}
@Override
public String getCustomName() {
TileEntityEnchantTable enchant = this.getSnapshot();
@@ -30,4 +34,9 @@ public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchan
enchantingTable.setCustomName(null);
}
}
@Override
public CraftEnchantingTable copy() {
return new CraftEnchantingTable(this);
}
}

View File

@@ -14,6 +14,10 @@ public class CraftEndGateway extends CraftBlockEntityState<TileEntityEndGateway>
super(world, tileEntity);
}
protected CraftEndGateway(CraftEndGateway state) {
super(state);
}
@Override
public Location getExitLocation() {
BlockPosition pos = this.getSnapshot().exitPortal;
@@ -59,4 +63,9 @@ public class CraftEndGateway extends CraftBlockEntityState<TileEntityEndGateway>
endGateway.exitPortal = null;
}
}
@Override
public CraftEndGateway copy() {
return new CraftEndGateway(this);
}
}

View File

@@ -8,4 +8,13 @@ public class CraftEndPortal extends CraftBlockEntityState<TileEntityEnderPortal>
public CraftEndPortal(World world, TileEntityEnderPortal tileEntity) {
super(world, tileEntity);
}
protected CraftEndPortal(CraftEndPortal state) {
super(state);
}
@Override
public CraftEndPortal copy() {
return new CraftEndPortal(this);
}
}

View File

@@ -11,6 +11,10 @@ public class CraftEnderChest extends CraftBlockEntityState<TileEntityEnderChest>
super(world, tileEntity);
}
protected CraftEnderChest(CraftEnderChest state) {
super(state);
}
@Override
public void open() {
requirePlaced();
@@ -36,4 +40,9 @@ public class CraftEnderChest extends CraftBlockEntityState<TileEntityEnderChest>
}
getTileEntity().openersCounter.opened = false;
}
@Override
public CraftEnderChest copy() {
return new CraftEnderChest(this);
}
}

View File

@@ -20,6 +20,10 @@ public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftCon
super(world, tileEntity);
}
protected CraftFurnace(CraftFurnace<T> state) {
super(state);
}
@Override
public FurnaceInventory getSnapshotInventory() {
return new CraftInventoryFurnace(this.getSnapshot());
@@ -78,4 +82,7 @@ public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftCon
return recipesUsed.build();
}
@Override
public abstract CraftFurnace<T> copy();
}

View File

@@ -8,4 +8,13 @@ public class CraftFurnaceFurnace extends CraftFurnace<TileEntityFurnaceFurnace>
public CraftFurnaceFurnace(World world, TileEntityFurnaceFurnace tileEntity) {
super(world, tileEntity);
}
protected CraftFurnaceFurnace(CraftFurnaceFurnace state) {
super(state);
}
@Override
public CraftFurnaceFurnace copy() {
return new CraftFurnaceFurnace(this);
}
}

View File

@@ -9,4 +9,13 @@ public class CraftHangingSign extends CraftSign<HangingSignBlockEntity> implemen
public CraftHangingSign(World world, HangingSignBlockEntity tileEntity) {
super(world, tileEntity);
}
protected CraftHangingSign(CraftHangingSign state) {
super(state);
}
@Override
public CraftHangingSign copy() {
return new CraftHangingSign(this);
}
}

View File

@@ -12,6 +12,10 @@ public class CraftHopper extends CraftLootable<TileEntityHopper> implements Hopp
super(world, tileEntity);
}
protected CraftHopper(CraftHopper state) {
super(state);
}
@Override
public Inventory getSnapshotInventory() {
return new CraftInventory(this.getSnapshot());
@@ -25,4 +29,9 @@ public class CraftHopper extends CraftLootable<TileEntityHopper> implements Hopp
return new CraftInventory(this.getTileEntity());
}
@Override
public CraftHopper copy() {
return new CraftHopper(this);
}
}

View File

@@ -9,4 +9,13 @@ public class CraftJigsaw extends CraftBlockEntityState<TileEntityJigsaw> impleme
public CraftJigsaw(World world, TileEntityJigsaw tileEntity) {
super(world, tileEntity);
}
protected CraftJigsaw(CraftJigsaw state) {
super(state);
}
@Override
public CraftJigsaw copy() {
return new CraftJigsaw(this);
}
}

View File

@@ -20,6 +20,10 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> imple
super(world, tileEntity);
}
protected CraftJukebox(CraftJukebox state) {
super(state);
}
@Override
public JukeboxInventory getSnapshotInventory() {
return new CraftInventoryJukebox(this.getSnapshot());
@@ -147,4 +151,9 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> imple
jukebox.popOutRecord();
return result;
}
@Override
public CraftJukebox copy() {
return new CraftJukebox(this);
}
}

View File

@@ -14,6 +14,10 @@ public class CraftLectern extends CraftBlockEntityState<TileEntityLectern> imple
super(world, tileEntity);
}
protected CraftLectern(CraftLectern state) {
super(state);
}
@Override
public int getPage() {
return getSnapshot().getPage();
@@ -48,4 +52,9 @@ public class CraftLectern extends CraftBlockEntityState<TileEntityLectern> imple
return result;
}
@Override
public CraftLectern copy() {
return new CraftLectern(this);
}
}

View File

@@ -15,6 +15,10 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
super(world, tileEntity);
}
protected CraftLootable(CraftLootable<T> state) {
super(state);
}
@Override
public void applyTo(T lootable) {
super.applyTo(lootable);
@@ -53,4 +57,7 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
MinecraftKey key = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
getSnapshot().setLootTable(key, seed);
}
@Override
public abstract CraftLootable<T> copy();
}

View File

@@ -8,4 +8,13 @@ public class CraftMovingPiston extends CraftBlockEntityState<TileEntityPiston> {
public CraftMovingPiston(World world, TileEntityPiston tileEntity) {
super(world, tileEntity);
}
protected CraftMovingPiston(CraftMovingPiston state) {
super(state);
}
@Override
public CraftMovingPiston copy() {
return new CraftMovingPiston(this);
}
}

View File

@@ -13,6 +13,10 @@ public class CraftSculkCatalyst extends CraftBlockEntityState<SculkCatalystBlock
super(world, tileEntity);
}
protected CraftSculkCatalyst(CraftSculkCatalyst state) {
super(state);
}
@Override
public void bloom(Block block, int charge) {
Preconditions.checkArgument(block != null, "block cannot be null");
@@ -23,4 +27,9 @@ public class CraftSculkCatalyst extends CraftBlockEntityState<SculkCatalystBlock
getTileEntity().getListener().bloom(world.getHandle(), getPosition(), getHandle(), world.getHandle().getRandom());
getTileEntity().getListener().getSculkSpreader().addCursors(new BlockPosition(block.getX(), block.getY(), block.getZ()), charge);
}
@Override
public CraftSculkCatalyst copy() {
return new CraftSculkCatalyst(this);
}
}

View File

@@ -11,6 +11,10 @@ public class CraftSculkSensor<T extends SculkSensorBlockEntity> extends CraftBlo
super(world, tileEntity);
}
protected CraftSculkSensor(CraftSculkSensor<T> state) {
super(state);
}
@Override
public int getLastVibrationFrequency() {
return getSnapshot().getLastVibrationFrequency();
@@ -21,4 +25,9 @@ public class CraftSculkSensor<T extends SculkSensorBlockEntity> extends CraftBlo
Preconditions.checkArgument(0 <= lastVibrationFrequency && lastVibrationFrequency <= 15, "Vibration frequency must be between 0-15");
getSnapshot().lastVibrationFrequency = lastVibrationFrequency;
}
@Override
public CraftSculkSensor<T> copy() {
return new CraftSculkSensor<>(this);
}
}

View File

@@ -13,6 +13,10 @@ public class CraftSculkShrieker extends CraftBlockEntityState<SculkShriekerBlock
super(world, tileEntity);
}
protected CraftSculkShrieker(CraftSculkShrieker state) {
super(state);
}
@Override
public int getWarningLevel() {
return getSnapshot().warningLevel;
@@ -30,4 +34,9 @@ public class CraftSculkShrieker extends CraftBlockEntityState<SculkShriekerBlock
EntityPlayer entityPlayer = (player == null) ? null : ((CraftPlayer) player).getHandle();
getTileEntity().tryShriek(world.getHandle(), entityPlayer);
}
@Override
public CraftSculkShrieker copy() {
return new CraftSculkShrieker(this);
}
}

View File

@@ -18,6 +18,10 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> impleme
super(world, tileEntity);
}
protected CraftShulkerBox(CraftShulkerBox state) {
super(state);
}
@Override
public Inventory getSnapshotInventory() {
return new CraftInventory(this.getSnapshot());
@@ -60,4 +64,9 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> impleme
}
getTileEntity().opened = false;
}
@Override
public CraftShulkerBox copy() {
return new CraftShulkerBox(this);
}
}

View File

@@ -27,6 +27,12 @@ public class CraftSign<T extends TileEntitySign> extends CraftBlockEntityState<T
this.back = new CraftSignSide(this.getSnapshot().getBackText());
}
protected CraftSign(CraftSign<T> state) {
super(state);
this.front = new CraftSignSide(this.getSnapshot().getFrontText());
this.back = new CraftSignSide(this.getSnapshot().getBackText());
}
@Override
public String[] getLines() {
return front.getLines();
@@ -105,6 +111,11 @@ public class CraftSign<T extends TileEntitySign> extends CraftBlockEntityState<T
super.applyTo(sign);
}
@Override
public CraftSign<T> copy() {
return new CraftSign<T>(this);
}
public static void openSign(Sign sign, Player player, Side side) {
Preconditions.checkArgument(sign != null, "sign == null");
Preconditions.checkArgument(side != null, "side == null");

View File

@@ -31,6 +31,10 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
super(world, tileEntity);
}
protected CraftSkull(CraftSkull state) {
super(state);
}
@Override
public void load(TileEntitySkull skull) {
super.load(skull);
@@ -199,4 +203,9 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
skull.setOwner(profile);
}
}
@Override
public CraftSkull copy() {
return new CraftSkull(this);
}
}

View File

@@ -9,4 +9,13 @@ public class CraftSmoker extends CraftFurnace<TileEntitySmoker> implements Smoke
public CraftSmoker(World world, TileEntitySmoker tileEntity) {
super(world, tileEntity);
}
protected CraftSmoker(CraftSmoker state) {
super(state);
}
@Override
public CraftSmoker copy() {
return new CraftSmoker(this);
}
}

View File

@@ -23,6 +23,10 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
super(world, tileEntity);
}
protected CraftStructureBlock(CraftStructureBlock state) {
super(state);
}
@Override
public String getStructureName() {
return getSnapshot().getStructureName();
@@ -193,6 +197,11 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
}
}
@Override
public CraftStructureBlock copy() {
return new CraftStructureBlock(this);
}
private static boolean isBetween(int num, int min, int max) {
return num >= min && num <= max;
}

View File

@@ -9,4 +9,13 @@ public class CraftSuspiciousSand extends CraftBrushableBlock implements Suspicio
public CraftSuspiciousSand(World world, BrushableBlockEntity tileEntity) {
super(world, tileEntity);
}
protected CraftSuspiciousSand(CraftSuspiciousSand state) {
super(state);
}
@Override
public CraftSuspiciousSand copy() {
return new CraftSuspiciousSand(this);
}
}