Migrate EmptyClipboard to Kotlin

This commit is contained in:
MattBDev 2020-03-02 21:18:36 -05:00
parent 0acbcdd6e5
commit 9241e2d018
3 changed files with 48 additions and 72 deletions

View File

@ -1,99 +1,74 @@
package com.boydti.fawe.object.clipboard; package com.boydti.fawe.`object`.clipboard
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard
import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector2
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3
import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CuboidRegion
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes
public class EmptyClipboard implements Clipboard { object EmptyClipboard : Clipboard {
override fun getRegion(): Region {
public static final EmptyClipboard INSTANCE = new EmptyClipboard(); return CuboidRegion(BlockVector3.ZERO, BlockVector3.ZERO)
private EmptyClipboard() {
} }
@Override override fun getDimensions(): BlockVector3 {
public Region getRegion() { return BlockVector3.ZERO
return new CuboidRegion(BlockVector3.ZERO, BlockVector3.ZERO);
} }
@Override override fun getOrigin(): BlockVector3 {
public BlockVector3 getDimensions() { return BlockVector3.ZERO
return BlockVector3.ZERO;
} }
@Override override fun setOrigin(origin: BlockVector3) {}
public BlockVector3 getOrigin() { override fun removeEntity(entity: Entity) {}
return BlockVector3.ZERO; override fun getMinimumPoint(): BlockVector3 {
return BlockVector3.ZERO
} }
@Override override fun getMaximumPoint(): BlockVector3 {
public void setOrigin(BlockVector3 origin) { return BlockVector3.ZERO
} }
@Override override fun getFullBlock(position: BlockVector3): BaseBlock {
public void removeEntity(Entity entity) { return BlockTypes.AIR!!.defaultState.toBaseBlock()
} }
@Override override fun getBlock(position: BlockVector3): BlockState {
public BlockVector3 getMinimumPoint() { return BlockTypes.AIR!!.defaultState
return BlockVector3.ZERO;
} }
@Override override fun getBiome(position: BlockVector2): BiomeType? {
public BlockVector3 getMaximumPoint() { return null
return BlockVector3.ZERO;
} }
@Override @Throws(WorldEditException::class)
public BaseBlock getFullBlock(BlockVector3 position) { override fun <T : BlockStateHolder<T>?> setBlock(position: BlockVector3, block: T): Boolean {
return BlockTypes.AIR.getDefaultState().toBaseBlock(); return false
} }
@Override @Throws(WorldEditException::class)
public BlockState getBlock(BlockVector3 position) { override fun <T : BlockStateHolder<T>?> setBlock(x: Int, y: Int, z: Int, block: T): Boolean {
return BlockTypes.AIR.getDefaultState(); return false
} }
@Override @Throws(WorldEditException::class)
public BiomeType getBiome(BlockVector2 position) { override fun setTile(x: Int, y: Int, z: Int, tile: CompoundTag): Boolean {
return null; return false
} }
@Override override fun setBiome(position: BlockVector2, biome: BiomeType): Boolean {
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block) throws WorldEditException { return false
return false;
} }
@Override override fun setBiome(x: Int, y: Int, z: Int, biome: BiomeType): Boolean {
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block) return false
throws WorldEditException {
return false;
} }
@Override
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
return false;
}
@Override
public boolean setBiome(BlockVector2 position, BiomeType biome) {
return false;
}
@Override
public boolean setBiome(int x, int y, int z, BiomeType biome) {
return false;
}
} }

View File

@ -67,6 +67,7 @@ public abstract class ReadOnlyClipboard extends SimpleClipboard {
}; };
} }
@Override
public Region getRegion() { public Region getRegion() {
return region; return region;
} }

View File

@ -22,7 +22,7 @@ public abstract class SimpleClipboard implements Clipboard {
this.origin = BlockVector3.ZERO; this.origin = BlockVector3.ZERO;
} }
public SimpleClipboard(Region region) { SimpleClipboard(Region region) {
this(region.getDimensions()); this(region.getDimensions());
} }