#1363: Add API to copy BlockState to a new Location

By: lbenav8095 <lubensaico@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2024-04-07 12:22:10 +10:00
parent f2f79d2380
commit f127f9030d
49 changed files with 435 additions and 147 deletions

View file

@ -8,6 +8,7 @@ import net.minecraft.world.level.GeneratorAccessSeed;
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityBeehive;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
@ -23,9 +24,8 @@ public final class CapturedBlockState extends CraftBlockState {
this.treeBlock = treeBlock;
}
protected CapturedBlockState(CapturedBlockState state) {
super(state);
protected CapturedBlockState(CapturedBlockState state, Location location) {
super(state, location);
this.treeBlock = state.treeBlock;
}
@ -74,7 +74,12 @@ public final class CapturedBlockState extends CraftBlockState {
@Override
public CapturedBlockState copy() {
return new CapturedBlockState(this);
return new CapturedBlockState(this, null);
}
@Override
public CapturedBlockState copy(Location location) {
return new CapturedBlockState(this, location);
}
public static CapturedBlockState getBlockState(World world, BlockPosition pos, int flag) {

View file

@ -9,6 +9,7 @@ import net.minecraft.world.item.EnumColor;
import net.minecraft.world.level.block.BlockBannerAbstract;
import net.minecraft.world.level.block.entity.TileEntityBanner;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Banner;
import org.bukkit.block.banner.Pattern;
@ -23,8 +24,8 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
super(world, tileEntity);
}
protected CraftBanner(CraftBanner state) {
super(state);
protected CraftBanner(CraftBanner state, Location location) {
super(state, location);
}
@Override
@ -107,6 +108,11 @@ public class CraftBanner extends CraftBlockEntityState<TileEntityBanner> impleme
@Override
public CraftBanner copy() {
return new CraftBanner(this);
return new CraftBanner(this, null);
}
@Override
public CraftBanner copy(Location location) {
return new CraftBanner(this, location);
}
}

View file

@ -4,6 +4,7 @@ import net.minecraft.sounds.SoundEffects;
import net.minecraft.world.level.block.BlockBarrel;
import net.minecraft.world.level.block.entity.TileEntityBarrel;
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Barrel;
import org.bukkit.craftbukkit.inventory.CraftInventory;
@ -15,8 +16,8 @@ public class CraftBarrel extends CraftLootable<TileEntityBarrel> implements Barr
super(world, tileEntity);
}
protected CraftBarrel(CraftBarrel state) {
super(state);
protected CraftBarrel(CraftBarrel state, Location location) {
super(state, location);
}
@Override
@ -65,6 +66,11 @@ public class CraftBarrel extends CraftLootable<TileEntityBarrel> implements Barr
@Override
public CraftBarrel copy() {
return new CraftBarrel(this);
return new CraftBarrel(this, null);
}
@Override
public CraftBarrel copy(Location location) {
return new CraftBarrel(this, location);
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.world.ChestLock;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityBeacon;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Beacon;
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
@ -20,8 +21,8 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
super(world, tileEntity);
}
protected CraftBeacon(CraftBeacon state) {
super(state);
protected CraftBeacon(CraftBeacon state, Location location) {
super(state, location);
}
@Override
@ -99,6 +100,11 @@ public class CraftBeacon extends CraftBlockEntityState<TileEntityBeacon> impleme
@Override
public CraftBeacon copy() {
return new CraftBeacon(this);
return new CraftBeacon(this, null);
}
@Override
public CraftBeacon copy(Location location) {
return new CraftBeacon(this, location);
}
}

View file

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityBed;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Bed;
@ -11,8 +12,8 @@ public class CraftBed extends CraftBlockEntityState<TileEntityBed> implements Be
super(world, tileEntity);
}
protected CraftBed(CraftBed state) {
super(state);
protected CraftBed(CraftBed state, Location location) {
super(state, location);
}
@Override
@ -62,6 +63,11 @@ public class CraftBed extends CraftBlockEntityState<TileEntityBed> implements Be
@Override
public CraftBed copy() {
return new CraftBed(this);
return new CraftBed(this, null);
}
@Override
public CraftBed copy(Location location) {
return new CraftBed(this, location);
}
}

View file

@ -20,8 +20,8 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
super(world, tileEntity);
}
protected CraftBeehive(CraftBeehive state) {
super(state);
protected CraftBeehive(CraftBeehive state, Location location) {
super(state, location);
}
@Override
@ -88,6 +88,11 @@ public class CraftBeehive extends CraftBlockEntityState<TileEntityBeehive> imple
@Override
public CraftBeehive copy() {
return new CraftBeehive(this);
return new CraftBeehive(this, null);
}
@Override
public CraftBeehive copy(Location location) {
return new CraftBeehive(this, location);
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.world.level.block.BlockBell;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityBell;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Bell;
import org.bukkit.block.BlockFace;
@ -18,8 +19,8 @@ public class CraftBell extends CraftBlockEntityState<TileEntityBell> implements
super(world, tileEntity);
}
protected CraftBell(CraftBell state) {
super(state);
protected CraftBell(CraftBell state, Location location) {
super(state, location);
}
@Override
@ -74,6 +75,11 @@ public class CraftBell extends CraftBlockEntityState<TileEntityBell> implements
@Override
public CraftBell copy() {
return new CraftBell(this);
return new CraftBell(this, null);
}
@Override
public CraftBell copy(Location location) {
return new CraftBell(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityBlastFurnace;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BlastFurnace;
@ -10,12 +11,17 @@ public class CraftBlastFurnace extends CraftFurnace<TileEntityBlastFurnace> impl
super(world, tileEntity);
}
protected CraftBlastFurnace(CraftBlastFurnace state) {
super(state);
protected CraftBlastFurnace(CraftBlastFurnace state, Location location) {
super(state, location);
}
@Override
public CraftBlastFurnace copy() {
return new CraftBlastFurnace(this);
return new CraftBlastFurnace(this, null);
}
@Override
public CraftBlastFurnace copy(Location location) {
return new CraftBlastFurnace(this, location);
}
}

View file

@ -28,8 +28,8 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
this.load(snapshot);
}
protected CraftBlockEntityState(CraftBlockEntityState<T> state) {
super(state);
protected CraftBlockEntityState(CraftBlockEntityState<T> state, Location location) {
super(state, location);
this.tileEntity = createSnapshot(state.snapshot);
this.snapshot = tileEntity;
loadData(state.getSnapshotNBT());
@ -134,6 +134,11 @@ public class CraftBlockEntityState<T extends TileEntity> extends CraftBlockState
@Override
public CraftBlockEntityState<T> copy() {
return new CraftBlockEntityState<>(this);
return new CraftBlockEntityState<>(this, null);
}
@Override
public CraftBlockEntityState<T> copy(Location location) {
return new CraftBlockEntityState<>(this, location);
}
}

View file

@ -50,10 +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();
// Creates an unplaced copy of the given CraftBlockState at the given location
protected CraftBlockState(CraftBlockState state, @Nullable Location location) {
if (location == null) {
this.world = null;
this.position = state.getPosition().immutable();
} else {
this.world = (CraftWorld) location.getWorld();
this.position = CraftLocation.toBlockPosition(location);
}
this.data = state.data;
this.flag = state.flag;
setWorldHandle(state.getWorldHandle());
@ -330,6 +335,11 @@ public class CraftBlockState implements BlockState {
@Override
public CraftBlockState copy() {
return new CraftBlockState(this);
return new CraftBlockState(this, null);
}
@Override
public BlockState copy(Location location) {
return new CraftBlockState(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityBrewingStand;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BrewingStand;
import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer;
@ -12,8 +13,8 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
super(world, tileEntity);
}
protected CraftBrewingStand(CraftBrewingStand state) {
super(state);
protected CraftBrewingStand(CraftBrewingStand state, Location location) {
super(state, location);
}
@Override
@ -52,6 +53,11 @@ public class CraftBrewingStand extends CraftContainer<TileEntityBrewingStand> im
@Override
public CraftBrewingStand copy() {
return new CraftBrewingStand(this);
return new CraftBrewingStand(this, null);
}
@Override
public CraftBrewingStand copy(Location location) {
return new CraftBrewingStand(this, location);
}
}

View file

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.level.block.entity.BrushableBlockEntity;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BrushableBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -16,8 +17,8 @@ public class CraftBrushableBlock extends CraftBlockEntityState<BrushableBlockEnt
super(world, tileEntity);
}
protected CraftBrushableBlock(CraftBrushableBlock state) {
super(state);
protected CraftBrushableBlock(CraftBrushableBlock state, Location location) {
super(state, location);
}
@Override
@ -71,6 +72,11 @@ public class CraftBrushableBlock extends CraftBlockEntityState<BrushableBlockEnt
@Override
public CraftBrushableBlock copy() {
return new CraftBrushableBlock(this);
return new CraftBrushableBlock(this, null);
}
@Override
public CraftBrushableBlock copy(Location location) {
return new CraftBrushableBlock(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.CalibratedSculkSensorBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.CalibratedSculkSensor;
@ -10,12 +11,17 @@ public class CraftCalibratedSculkSensor extends CraftSculkSensor<CalibratedSculk
super(world, tileEntity);
}
protected CraftCalibratedSculkSensor(CraftCalibratedSculkSensor state) {
super(state);
protected CraftCalibratedSculkSensor(CraftCalibratedSculkSensor state, Location location) {
super(state, location);
}
@Override
public CraftCalibratedSculkSensor copy() {
return new CraftCalibratedSculkSensor(this);
return new CraftCalibratedSculkSensor(this, null);
}
@Override
public CraftCalibratedSculkSensor copy(Location location) {
return new CraftCalibratedSculkSensor(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityCampfire;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Campfire;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -12,8 +13,8 @@ public class CraftCampfire extends CraftBlockEntityState<TileEntityCampfire> imp
super(world, tileEntity);
}
protected CraftCampfire(CraftCampfire state) {
super(state);
protected CraftCampfire(CraftCampfire state, Location location) {
super(state, location);
}
@Override
@ -54,6 +55,11 @@ public class CraftCampfire extends CraftBlockEntityState<TileEntityCampfire> imp
@Override
public CraftCampfire copy() {
return new CraftCampfire(this);
return new CraftCampfire(this, null);
}
@Override
public CraftCampfire copy(Location location) {
return new CraftCampfire(this, location);
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.world.level.block.BlockChest;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntityChest;
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Chest;
@ -19,8 +20,8 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
super(world, tileEntity);
}
protected CraftChest(CraftChest state) {
super(state);
protected CraftChest(CraftChest state, Location location) {
super(state, location);
}
@Override
@ -84,6 +85,11 @@ public class CraftChest extends CraftLootable<TileEntityChest> implements Chest
@Override
public CraftChest copy() {
return new CraftChest(this);
return new CraftChest(this, null);
}
@Override
public CraftChest copy(Location location) {
return new CraftChest(this, location);
}
}

View file

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.ChiseledBookShelfBlock;
import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity;
import net.minecraft.world.phys.Vec2F;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.block.ChiseledBookshelf;
@ -17,8 +18,8 @@ public class CraftChiseledBookshelf extends CraftBlockEntityState<ChiseledBookSh
super(world, tileEntity);
}
protected CraftChiseledBookshelf(CraftChiseledBookshelf state) {
super(state);
protected CraftChiseledBookshelf(CraftChiseledBookshelf state, Location location) {
super(state, location);
}
@Override
@ -74,6 +75,11 @@ public class CraftChiseledBookshelf extends CraftBlockEntityState<ChiseledBookSh
@Override
public CraftChiseledBookshelf copy() {
return new CraftChiseledBookshelf(this);
return new CraftChiseledBookshelf(this, null);
}
@Override
public CraftChiseledBookshelf copy(Location location) {
return new CraftChiseledBookshelf(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityCommand;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.CommandBlock;
import org.bukkit.craftbukkit.util.CraftChatMessage;
@ -11,8 +12,8 @@ public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand>
super(world, tileEntity);
}
protected CraftCommandBlock(CraftCommandBlock state) {
super(state);
protected CraftCommandBlock(CraftCommandBlock state, Location location) {
super(state, location);
}
@Override
@ -37,6 +38,11 @@ public class CraftCommandBlock extends CraftBlockEntityState<TileEntityCommand>
@Override
public CraftCommandBlock copy() {
return new CraftCommandBlock(this);
return new CraftCommandBlock(this, null);
}
@Override
public CraftCommandBlock copy(Location location) {
return new CraftCommandBlock(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityComparator;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Comparator;
@ -10,12 +11,17 @@ public class CraftComparator extends CraftBlockEntityState<TileEntityComparator>
super(world, tileEntity);
}
protected CraftComparator(CraftComparator state) {
super(state);
protected CraftComparator(CraftComparator state, Location location) {
super(state, location);
}
@Override
public CraftComparator copy() {
return new CraftComparator(this);
return new CraftComparator(this, null);
}
@Override
public CraftComparator copy(Location location) {
return new CraftComparator(this, location);
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.core.BlockPosition;
import net.minecraft.world.entity.EntityLiving;
import net.minecraft.world.level.block.entity.TileEntityConduit;
import net.minecraft.world.phys.AxisAlignedBB;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Conduit;
@ -19,13 +20,18 @@ public class CraftConduit extends CraftBlockEntityState<TileEntityConduit> imple
super(world, tileEntity);
}
protected CraftConduit(CraftConduit state) {
super(state);
protected CraftConduit(CraftConduit state, Location location) {
super(state, location);
}
@Override
public CraftConduit copy() {
return new CraftConduit(this);
return new CraftConduit(this, null);
}
@Override
public CraftConduit copy(Location location) {
return new CraftConduit(this, location);
}
@Override

View file

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.world.ChestLock;
import net.minecraft.world.level.block.entity.TileEntityContainer;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Container;
import org.bukkit.craftbukkit.util.CraftChatMessage;
@ -12,8 +13,8 @@ public abstract class CraftContainer<T extends TileEntityContainer> extends Craf
super(world, tileEntity);
}
protected CraftContainer(CraftContainer<T> state) {
super(state);
protected CraftContainer(CraftContainer<T> state, Location location) {
super(state, location);
}
@Override
@ -53,4 +54,7 @@ public abstract class CraftContainer<T extends TileEntityContainer> extends Craf
@Override
public abstract CraftContainer<T> copy();
@Override
public abstract CraftContainer<T> copy(Location location);
}

View file

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.world.level.block.entity.CrafterBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Crafter;
import org.bukkit.craftbukkit.inventory.CraftInventory;
@ -13,8 +14,8 @@ public class CraftCrafter extends CraftLootable<CrafterBlockEntity> implements C
super(world, tileEntity);
}
protected CraftCrafter(CraftCrafter state) {
super(state);
protected CraftCrafter(CraftCrafter state, Location location) {
super(state, location);
}
@Override
@ -33,7 +34,12 @@ public class CraftCrafter extends CraftLootable<CrafterBlockEntity> implements C
@Override
public CraftCrafter copy() {
return new CraftCrafter(this);
return new CraftCrafter(this, null);
}
@Override
public CraftCrafter copy(Location location) {
return new CraftCrafter(this, location);
}
@Override

View file

@ -13,6 +13,7 @@ import net.minecraft.util.random.WeightedEntry.b;
import net.minecraft.world.entity.EntityTypes;
import net.minecraft.world.level.MobSpawnerData;
import net.minecraft.world.level.block.entity.TileEntityMobSpawner;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.spawner.SpawnRule;
@ -28,8 +29,8 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
super(world, tileEntity);
}
protected CraftCreatureSpawner(CraftCreatureSpawner state) {
super(state);
protected CraftCreatureSpawner(CraftCreatureSpawner state, Location location) {
super(state, location);
}
@Override
@ -225,6 +226,11 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<TileEntityMobSpa
@Override
public CraftCreatureSpawner copy() {
return new CraftCreatureSpawner(this);
return new CraftCreatureSpawner(this, null);
}
@Override
public CraftCreatureSpawner copy(Location location) {
return new CraftCreatureSpawner(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityLightDetector;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.DaylightDetector;
@ -10,12 +11,17 @@ public class CraftDaylightDetector extends CraftBlockEntityState<TileEntityLight
super(world, tileEntity);
}
protected CraftDaylightDetector(CraftDaylightDetector state) {
super(state);
protected CraftDaylightDetector(CraftDaylightDetector state, Location location) {
super(state, location);
}
@Override
public CraftDaylightDetector copy() {
return new CraftDaylightDetector(this);
return new CraftDaylightDetector(this, null);
}
@Override
public CraftDaylightDetector copy(Location location) {
return new CraftDaylightDetector(this, location);
}
}

View file

@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.entity.DecoratedPotBlockEntity;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.World;
@ -22,8 +23,8 @@ public class CraftDecoratedPot extends CraftBlockEntityState<DecoratedPotBlockEn
super(world, tileEntity);
}
protected CraftDecoratedPot(CraftDecoratedPot state) {
super(state);
protected CraftDecoratedPot(CraftDecoratedPot state, Location location) {
super(state, location);
}
@Override
@ -92,6 +93,11 @@ public class CraftDecoratedPot extends CraftBlockEntityState<DecoratedPotBlockEn
@Override
public CraftDecoratedPot copy() {
return new CraftDecoratedPot(this);
return new CraftDecoratedPot(this, null);
}
@Override
public CraftDecoratedPot copy(Location location) {
return new CraftDecoratedPot(this, location);
}
}

View file

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.BlockDispenser;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntityDispenser;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -19,8 +20,8 @@ public class CraftDispenser extends CraftLootable<TileEntityDispenser> implement
super(world, tileEntity);
}
protected CraftDispenser(CraftDispenser state) {
super(state);
protected CraftDispenser(CraftDispenser state, Location location) {
super(state, location);
}
@Override
@ -65,6 +66,11 @@ public class CraftDispenser extends CraftLootable<TileEntityDispenser> implement
@Override
public CraftDispenser copy() {
return new CraftDispenser(this);
return new CraftDispenser(this, null);
}
@Override
public CraftDispenser copy(Location location) {
return new CraftDispenser(this, location);
}
}

View file

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.BlockDropper;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.TileEntityDropper;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
@ -17,8 +18,8 @@ public class CraftDropper extends CraftLootable<TileEntityDropper> implements Dr
super(world, tileEntity);
}
protected CraftDropper(CraftDropper state) {
super(state);
protected CraftDropper(CraftDropper state, Location location) {
super(state, location);
}
@Override
@ -49,6 +50,11 @@ public class CraftDropper extends CraftLootable<TileEntityDropper> implements Dr
@Override
public CraftDropper copy() {
return new CraftDropper(this);
return new CraftDropper(this, null);
}
@Override
public CraftDropper copy(Location location) {
return new CraftDropper(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityEnchantTable;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.EnchantingTable;
import org.bukkit.craftbukkit.util.CraftChatMessage;
@ -11,8 +12,8 @@ public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchan
super(world, tileEntity);
}
protected CraftEnchantingTable(CraftEnchantingTable state) {
super(state);
protected CraftEnchantingTable(CraftEnchantingTable state, Location location) {
super(state, location);
}
@Override
@ -37,6 +38,11 @@ public class CraftEnchantingTable extends CraftBlockEntityState<TileEntityEnchan
@Override
public CraftEnchantingTable copy() {
return new CraftEnchantingTable(this);
return new CraftEnchantingTable(this, null);
}
@Override
public CraftEnchantingTable copy(Location location) {
return new CraftEnchantingTable(this, location);
}
}

View file

@ -14,8 +14,8 @@ public class CraftEndGateway extends CraftBlockEntityState<TileEntityEndGateway>
super(world, tileEntity);
}
protected CraftEndGateway(CraftEndGateway state) {
super(state);
protected CraftEndGateway(CraftEndGateway state, Location location) {
super(state, location);
}
@Override
@ -66,6 +66,11 @@ public class CraftEndGateway extends CraftBlockEntityState<TileEntityEndGateway>
@Override
public CraftEndGateway copy() {
return new CraftEndGateway(this);
return new CraftEndGateway(this, null);
}
@Override
public CraftEndGateway copy(Location location) {
return new CraftEndGateway(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityEnderPortal;
import org.bukkit.Location;
import org.bukkit.World;
public class CraftEndPortal extends CraftBlockEntityState<TileEntityEnderPortal> {
@ -9,12 +10,17 @@ public class CraftEndPortal extends CraftBlockEntityState<TileEntityEnderPortal>
super(world, tileEntity);
}
protected CraftEndPortal(CraftEndPortal state) {
super(state);
protected CraftEndPortal(CraftEndPortal state, Location location) {
super(state, location);
}
@Override
public CraftEndPortal copy() {
return new CraftEndPortal(this);
return new CraftEndPortal(this, null);
}
@Override
public CraftEndPortal copy(Location location) {
return new CraftEndPortal(this, location);
}
}

View file

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityEnderChest;
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.EnderChest;
@ -11,8 +12,8 @@ public class CraftEnderChest extends CraftBlockEntityState<TileEntityEnderChest>
super(world, tileEntity);
}
protected CraftEnderChest(CraftEnderChest state) {
super(state);
protected CraftEnderChest(CraftEnderChest state, Location location) {
super(state, location);
}
@Override
@ -43,6 +44,11 @@ public class CraftEnderChest extends CraftBlockEntityState<TileEntityEnderChest>
@Override
public CraftEnderChest copy() {
return new CraftEnderChest(this);
return new CraftEnderChest(this, null);
}
@Override
public CraftEnderChest copy(Location location) {
return new CraftEnderChest(this, location);
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.level.block.BlockFurnace;
import net.minecraft.world.level.block.entity.TileEntityFurnace;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Furnace;
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
@ -20,8 +21,8 @@ public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftCon
super(world, tileEntity);
}
protected CraftFurnace(CraftFurnace<T> state) {
super(state);
protected CraftFurnace(CraftFurnace<T> state, Location location) {
super(state, location);
}
@Override
@ -85,4 +86,7 @@ public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftCon
@Override
public abstract CraftFurnace<T> copy();
@Override
public abstract CraftFurnace<T> copy(Location location);
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityFurnaceFurnace;
import org.bukkit.Location;
import org.bukkit.World;
public class CraftFurnaceFurnace extends CraftFurnace<TileEntityFurnaceFurnace> {
@ -9,12 +10,17 @@ public class CraftFurnaceFurnace extends CraftFurnace<TileEntityFurnaceFurnace>
super(world, tileEntity);
}
protected CraftFurnaceFurnace(CraftFurnaceFurnace state) {
super(state);
protected CraftFurnaceFurnace(CraftFurnaceFurnace state, Location location) {
super(state, location);
}
@Override
public CraftFurnaceFurnace copy() {
return new CraftFurnaceFurnace(this);
return new CraftFurnaceFurnace(this, null);
}
@Override
public CraftFurnaceFurnace copy(Location location) {
return new CraftFurnaceFurnace(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.HangingSignBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.HangingSign;
@ -10,12 +11,17 @@ public class CraftHangingSign extends CraftSign<HangingSignBlockEntity> implemen
super(world, tileEntity);
}
protected CraftHangingSign(CraftHangingSign state) {
super(state);
protected CraftHangingSign(CraftHangingSign state, Location location) {
super(state, location);
}
@Override
public CraftHangingSign copy() {
return new CraftHangingSign(this);
return new CraftHangingSign(this, null);
}
@Override
public CraftHangingSign copy(Location location) {
return new CraftHangingSign(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityHopper;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Hopper;
import org.bukkit.craftbukkit.inventory.CraftInventory;
@ -12,8 +13,8 @@ public class CraftHopper extends CraftLootable<TileEntityHopper> implements Hopp
super(world, tileEntity);
}
protected CraftHopper(CraftHopper state) {
super(state);
protected CraftHopper(CraftHopper state, Location location) {
super(state, location);
}
@Override
@ -32,6 +33,11 @@ public class CraftHopper extends CraftLootable<TileEntityHopper> implements Hopp
@Override
public CraftHopper copy() {
return new CraftHopper(this);
return new CraftHopper(this, null);
}
@Override
public CraftHopper copy(Location location) {
return new CraftHopper(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntityJigsaw;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Jigsaw;
@ -10,12 +11,17 @@ public class CraftJigsaw extends CraftBlockEntityState<TileEntityJigsaw> impleme
super(world, tileEntity);
}
protected CraftJigsaw(CraftJigsaw state) {
super(state);
protected CraftJigsaw(CraftJigsaw state, Location location) {
super(state, location);
}
@Override
public CraftJigsaw copy() {
return new CraftJigsaw(this);
return new CraftJigsaw(this, null);
}
@Override
public CraftJigsaw copy(Location location) {
return new CraftJigsaw(this, location);
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.world.level.block.BlockJukeBox;
import net.minecraft.world.level.block.entity.TileEntity;
import net.minecraft.world.level.block.entity.TileEntityJukeBox;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Jukebox;
@ -20,8 +21,8 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> imple
super(world, tileEntity);
}
protected CraftJukebox(CraftJukebox state) {
super(state);
protected CraftJukebox(CraftJukebox state, Location location) {
super(state, location);
}
@Override
@ -154,6 +155,11 @@ public class CraftJukebox extends CraftBlockEntityState<TileEntityJukeBox> imple
@Override
public CraftJukebox copy() {
return new CraftJukebox(this);
return new CraftJukebox(this, null);
}
@Override
public CraftJukebox copy(Location location) {
return new CraftJukebox(this, location);
}
}

View file

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.BlockLectern;
import net.minecraft.world.level.block.entity.TileEntityLectern;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Lectern;
@ -14,8 +15,8 @@ public class CraftLectern extends CraftBlockEntityState<TileEntityLectern> imple
super(world, tileEntity);
}
protected CraftLectern(CraftLectern state) {
super(state);
protected CraftLectern(CraftLectern state, Location location) {
super(state, location);
}
@Override
@ -55,6 +56,11 @@ public class CraftLectern extends CraftBlockEntityState<TileEntityLectern> imple
@Override
public CraftLectern copy() {
return new CraftLectern(this);
return new CraftLectern(this, null);
}
@Override
public CraftLectern copy(Location location) {
return new CraftLectern(this, location);
}
}

View file

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.level.block.entity.TileEntityLootable;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Nameable;
import org.bukkit.World;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@ -15,8 +16,8 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
super(world, tileEntity);
}
protected CraftLootable(CraftLootable<T> state) {
super(state);
protected CraftLootable(CraftLootable<T> state, Location location) {
super(state, location);
}
@Override
@ -60,4 +61,7 @@ public abstract class CraftLootable<T extends TileEntityLootable> extends CraftC
@Override
public abstract CraftLootable<T> copy();
@Override
public abstract CraftLootable<T> copy(Location location);
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.piston.TileEntityPiston;
import org.bukkit.Location;
import org.bukkit.World;
public class CraftMovingPiston extends CraftBlockEntityState<TileEntityPiston> {
@ -9,12 +10,17 @@ public class CraftMovingPiston extends CraftBlockEntityState<TileEntityPiston> {
super(world, tileEntity);
}
protected CraftMovingPiston(CraftMovingPiston state) {
super(state);
protected CraftMovingPiston(CraftMovingPiston state, Location location) {
super(state, location);
}
@Override
public CraftMovingPiston copy() {
return new CraftMovingPiston(this);
return new CraftMovingPiston(this, null);
}
@Override
public CraftMovingPiston copy(Location location) {
return new CraftMovingPiston(this, location);
}
}

View file

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.level.block.entity.SculkCatalystBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.SculkCatalyst;
@ -13,8 +14,8 @@ public class CraftSculkCatalyst extends CraftBlockEntityState<SculkCatalystBlock
super(world, tileEntity);
}
protected CraftSculkCatalyst(CraftSculkCatalyst state) {
super(state);
protected CraftSculkCatalyst(CraftSculkCatalyst state, Location location) {
super(state, location);
}
@Override
@ -30,6 +31,11 @@ public class CraftSculkCatalyst extends CraftBlockEntityState<SculkCatalystBlock
@Override
public CraftSculkCatalyst copy() {
return new CraftSculkCatalyst(this);
return new CraftSculkCatalyst(this, null);
}
@Override
public CraftSculkCatalyst copy(Location location) {
return new CraftSculkCatalyst(this, location);
}
}

View file

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import com.google.common.base.Preconditions;
import net.minecraft.world.level.block.entity.SculkSensorBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.SculkSensor;
@ -11,8 +12,8 @@ public class CraftSculkSensor<T extends SculkSensorBlockEntity> extends CraftBlo
super(world, tileEntity);
}
protected CraftSculkSensor(CraftSculkSensor<T> state) {
super(state);
protected CraftSculkSensor(CraftSculkSensor<T> state, Location location) {
super(state, location);
}
@Override
@ -28,6 +29,11 @@ public class CraftSculkSensor<T extends SculkSensorBlockEntity> extends CraftBlo
@Override
public CraftSculkSensor<T> copy() {
return new CraftSculkSensor<>(this);
return new CraftSculkSensor<>(this, null);
}
@Override
public CraftSculkSensor<T> copy(Location location) {
return new CraftSculkSensor<>(this, location);
}
}

View file

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.block;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.world.level.block.entity.SculkShriekerBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.SculkShrieker;
import org.bukkit.craftbukkit.entity.CraftPlayer;
@ -13,8 +14,8 @@ public class CraftSculkShrieker extends CraftBlockEntityState<SculkShriekerBlock
super(world, tileEntity);
}
protected CraftSculkShrieker(CraftSculkShrieker state) {
super(state);
protected CraftSculkShrieker(CraftSculkShrieker state, Location location) {
super(state, location);
}
@Override
@ -37,6 +38,11 @@ public class CraftSculkShrieker extends CraftBlockEntityState<SculkShriekerBlock
@Override
public CraftSculkShrieker copy() {
return new CraftSculkShrieker(this);
return new CraftSculkShrieker(this, null);
}
@Override
public CraftSculkShrieker copy(Location location) {
return new CraftSculkShrieker(this, location);
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.world.item.EnumColor;
import net.minecraft.world.level.block.BlockShulkerBox;
import net.minecraft.world.level.block.entity.TileEntityShulkerBox;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.ShulkerBox;
import org.bukkit.craftbukkit.inventory.CraftInventory;
@ -17,8 +18,8 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> impleme
super(world, tileEntity);
}
protected CraftShulkerBox(CraftShulkerBox state) {
super(state);
protected CraftShulkerBox(CraftShulkerBox state, Location location) {
super(state, location);
}
@Override
@ -66,6 +67,11 @@ public class CraftShulkerBox extends CraftLootable<TileEntityShulkerBox> impleme
@Override
public CraftShulkerBox copy() {
return new CraftShulkerBox(this);
return new CraftShulkerBox(this, null);
}
@Override
public CraftShulkerBox copy(Location location) {
return new CraftShulkerBox(this, location);
}
}

View file

@ -6,6 +6,7 @@ import net.minecraft.network.chat.IChatBaseComponent;
import net.minecraft.world.level.block.entity.TileEntitySign;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Sign;
import org.bukkit.block.sign.Side;
@ -29,8 +30,8 @@ public class CraftSign<T extends TileEntitySign> extends CraftBlockEntityState<T
this.back = new CraftSignSide(this.getSnapshot().getBackText());
}
protected CraftSign(CraftSign<T> state) {
super(state);
protected CraftSign(CraftSign<T> state, Location location) {
super(state, location);
this.front = new CraftSignSide(this.getSnapshot().getFrontText());
this.back = new CraftSignSide(this.getSnapshot().getBackText());
}
@ -136,7 +137,12 @@ public class CraftSign<T extends TileEntitySign> extends CraftBlockEntityState<T
@Override
public CraftSign<T> copy() {
return new CraftSign<T>(this);
return new CraftSign<T>(this, null);
}
@Override
public CraftSign<T> copy(Location location) {
return new CraftSign<T>(this, location);
}
public static void openSign(Sign sign, Player player, Side side) {

View file

@ -7,6 +7,7 @@ import net.minecraft.resources.MinecraftKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.block.entity.TileEntitySkull;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.OfflinePlayer;
import org.bukkit.SkullType;
@ -31,8 +32,8 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
super(world, tileEntity);
}
protected CraftSkull(CraftSkull state) {
super(state);
protected CraftSkull(CraftSkull state, Location location) {
super(state, location);
}
@Override
@ -206,6 +207,11 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
@Override
public CraftSkull copy() {
return new CraftSkull(this);
return new CraftSkull(this, null);
}
@Override
public CraftSkull copy(Location location) {
return new CraftSkull(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TileEntitySmoker;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Smoker;
@ -10,12 +11,17 @@ public class CraftSmoker extends CraftFurnace<TileEntitySmoker> implements Smoke
super(world, tileEntity);
}
protected CraftSmoker(CraftSmoker state) {
super(state);
protected CraftSmoker(CraftSmoker state, Location location) {
super(state, location);
}
@Override
public CraftSmoker copy() {
return new CraftSmoker(this);
return new CraftSmoker(this, null);
}
@Override
public CraftSmoker copy(Location location) {
return new CraftSmoker(this, location);
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.world.level.block.EnumBlockMirror;
import net.minecraft.world.level.block.EnumBlockRotation;
import net.minecraft.world.level.block.entity.TileEntityStructure;
import net.minecraft.world.level.block.state.properties.BlockPropertyStructureMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Structure;
import org.bukkit.block.structure.Mirror;
@ -23,8 +24,8 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
super(world, tileEntity);
}
protected CraftStructureBlock(CraftStructureBlock state) {
super(state);
protected CraftStructureBlock(CraftStructureBlock state, Location location) {
super(state, location);
}
@Override
@ -199,7 +200,12 @@ public class CraftStructureBlock extends CraftBlockEntityState<TileEntityStructu
@Override
public CraftStructureBlock copy() {
return new CraftStructureBlock(this);
return new CraftStructureBlock(this, null);
}
@Override
public CraftStructureBlock copy(Location location) {
return new CraftStructureBlock(this, location);
}
private static boolean isBetween(int num, int min, int max) {

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.BrushableBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.SuspiciousSand;
@ -10,12 +11,17 @@ public class CraftSuspiciousSand extends CraftBrushableBlock implements Suspicio
super(world, tileEntity);
}
protected CraftSuspiciousSand(CraftSuspiciousSand state) {
super(state);
protected CraftSuspiciousSand(CraftSuspiciousSand state, Location location) {
super(state, location);
}
@Override
public CraftSuspiciousSand copy() {
return new CraftSuspiciousSand(this);
return new CraftSuspiciousSand(this, null);
}
@Override
public CraftSuspiciousSand copy(Location location) {
return new CraftSuspiciousSand(this, location);
}
}

View file

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.block;
import net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.TrialSpawner;
@ -10,12 +11,17 @@ public class CraftTrialSpawner extends CraftBlockEntityState<TrialSpawnerBlockEn
super(world, tileEntity);
}
protected CraftTrialSpawner(CraftTrialSpawner state) {
super(state);
protected CraftTrialSpawner(CraftTrialSpawner state, Location location) {
super(state, location);
}
@Override
public CraftTrialSpawner copy() {
return new CraftTrialSpawner(this);
return new CraftTrialSpawner(this, null);
}
@Override
public CraftTrialSpawner copy(Location location) {
return new CraftTrialSpawner(this, location);
}
}