Remove DelegateClipboard

This commit is contained in:
MattBDev 2020-02-19 13:44:39 -05:00
parent 1ed4118319
commit 798e04a644
2 changed files with 20 additions and 169 deletions

View File

@ -1,164 +0,0 @@
package com.boydti.fawe.object.clipboard;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import javax.annotation.Nullable;
import java.net.URI;
import java.util.List;
import java.util.UUID;
public class DelegateClipboard implements Clipboard {
private final Clipboard parent;
public DelegateClipboard(Clipboard parent) {
this.parent = parent;
}
public Clipboard getParent() {
return parent;
}
@Override
public URI getURI() {
return parent.getURI();
}
@Override
public void setOrigin(BlockVector3 offset) {
parent.setOrigin(offset);
}
@Override
public BlockVector3 getDimensions() {
return parent.getDimensions();
}
@Override
public Region getRegion() {
return parent.getRegion();
}
@Override
public BlockVector3 getOrigin() {
return parent.getOrigin();
}
@Override
public boolean hasBiomes() {
return parent.hasBiomes();
}
@Override
public void removeEntity(Entity entity) {
parent.removeEntity(entity);
}
@Override
public BlockVector3 getMinimumPoint() {
return parent.getMinimumPoint();
}
@Override
public BlockVector3 getMaximumPoint() {
return parent.getMaximumPoint();
}
@Override
public List<? extends Entity> getEntities(Region region) {
return parent.getEntities(region);
}
@Override
public List<? extends Entity> getEntities() {
return parent.getEntities();
}
@Override
@Nullable
public Entity createEntity(Location location, BaseEntity entity) {
return parent.createEntity(location, entity);
}
@Override
public void removeEntity(int x, int y, int z, UUID uuid) {
parent.removeEntity(x, y, z, uuid);
}
@Override
public boolean isWorld() {
return parent.isWorld();
}
@Override
public BlockState getBlock(BlockVector3 position) {
return parent.getBlock(position);
}
@Override
public BlockState getBlock(int x, int y, int z) {
return parent.getBlock(x, y, z);
}
@Override
public BaseBlock getFullBlock(BlockVector3 position) {
return parent.getFullBlock(position);
}
@Override
public BaseBlock getFullBlock(int x, int y, int z) {
return parent.getFullBlock(x, y, z);
}
@Override
public BiomeType getBiome(BlockVector2 position) {
return parent.getBiome(position);
}
@Override
public BiomeType getBiomeType(int x, int y, int z) {
return parent.getBiomeType(x, y, z);
}
@Override
@Deprecated
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException {
return parent.setBlock(position, block);
}
@Override
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) throws WorldEditException {
return parent.setBlock(x, y, z, block);
}
@Override
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
return parent.setTile(x, y, z, tile);
}
@Override
public boolean setBiome(BlockVector2 position, BiomeType biome) {
return parent.setBiome(position, biome);
}
@Override
public boolean setBiome(int x, int y, int z, BiomeType biome) {
return parent.setBiome(x, y, z, biome);
}
@Override
public void close() {
parent.close();
}
}

View File

@ -19,7 +19,6 @@
package com.sk89q.worldedit.extent.clipboard; package com.sk89q.worldedit.extent.clipboard;
import com.boydti.fawe.object.clipboard.DelegateClipboard;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
@ -51,17 +50,18 @@ import static com.google.common.base.Preconditions.checkNotNull;
* Stores block data as a multi-dimensional array of {@link BlockState}s and * Stores block data as a multi-dimensional array of {@link BlockState}s and
* other data as lists or maps. * other data as lists or maps.
*/ */
public class BlockArrayClipboard extends DelegateClipboard implements Clipboard { public class BlockArrayClipboard implements Clipboard {
private final Region region; private final Region region;
private final BlockVector3 origin; private final BlockVector3 origin;
private final Clipboard parent;
public BlockArrayClipboard(Region region) { public BlockArrayClipboard(Region region) {
this(region, UUID.randomUUID()); this(region, UUID.randomUUID());
} }
public BlockArrayClipboard(Clipboard clipboard, BlockVector3 offset) { public BlockArrayClipboard(Clipboard clipboard, BlockVector3 offset) {
super(clipboard); this.parent = clipboard;
Region shifted = clipboard.getRegion(); Region shifted = clipboard.getRegion();
shifted.shift(offset); shifted.shift(offset);
this.region = shifted; this.region = shifted;
@ -80,8 +80,9 @@ public class BlockArrayClipboard extends DelegateClipboard implements Clipboard
} }
public BlockArrayClipboard(Region region, Clipboard clipboard) { public BlockArrayClipboard(Region region, Clipboard clipboard) {
super(clipboard); checkNotNull(clipboard);
checkNotNull(region); checkNotNull(region);
this.parent = clipboard;
this.region = region; this.region = region;
this.origin = region.getMinimumPoint(); this.origin = region.getMinimumPoint();
} }
@ -163,7 +164,7 @@ public class BlockArrayClipboard extends DelegateClipboard implements Clipboard
x -= origin.getX(); x -= origin.getX();
y -= origin.getY(); y -= origin.getY();
z -= origin.getZ(); z -= origin.getZ();
return getParent().setBlock(x, y, z, block); return parent.setBlock(x, y, z, block);
} }
@Override @Override
@ -256,6 +257,20 @@ public class BlockArrayClipboard extends DelegateClipboard implements Clipboard
return Iterators.transform(getParent().iterator(order), mutable::init); return Iterators.transform(getParent().iterator(order), mutable::init);
} }
@Override
public BlockVector3 getDimensions() {
return this.parent.getDimensions();
}
@Override
public void removeEntity(Entity entity) {
this.parent.removeEntity(entity);
}
public Clipboard getParent() {
return parent;
}
/** /**
* Stores entity data. * Stores entity data.
*/ */