2021-07-23 15:48:51 +00:00
|
|
|
package com.fastasyncworldedit.core.extent;
|
2018-08-12 14:03:07 +00:00
|
|
|
|
|
|
|
import com.sk89q.worldedit.WorldEditException;
|
|
|
|
import com.sk89q.worldedit.extent.Extent;
|
2018-12-23 16:19:33 +00:00
|
|
|
import com.sk89q.worldedit.math.BlockVector3;
|
2019-04-03 05:53:58 +00:00
|
|
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
2018-08-12 14:03:07 +00:00
|
|
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
|
|
|
|
|
|
public class OffsetExtent extends ResettableExtent {
|
2020-04-30 20:26:52 +00:00
|
|
|
|
2020-10-05 17:41:41 +00:00
|
|
|
private final int dx;
|
|
|
|
private final int dy;
|
|
|
|
private final int dz;
|
2018-08-12 14:03:07 +00:00
|
|
|
|
|
|
|
public OffsetExtent(Extent parent, int dx, int dy, int dz) {
|
|
|
|
super(parent);
|
|
|
|
this.dx = dx;
|
|
|
|
this.dy = dy;
|
|
|
|
this.dz = dz;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-10-22 21:18:16 +00:00
|
|
|
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
2020-04-30 20:26:52 +00:00
|
|
|
return getExtent()
|
2020-10-22 21:18:16 +00:00
|
|
|
.setBiome(position.getBlockX() + dx, position.getBlockY() + dy, position.getBlockZ() + dz,
|
2020-04-30 20:26:52 +00:00
|
|
|
biome);
|
2018-08-12 14:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-04-03 05:53:58 +00:00
|
|
|
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
2018-08-12 14:03:07 +00:00
|
|
|
return getExtent().setBiome(x + dx, y + dy, z + dz, biome);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-04-30 20:26:52 +00:00
|
|
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 location, T block)
|
|
|
|
throws WorldEditException {
|
|
|
|
return getExtent().setBlock(location.getBlockX() + dx, location.getBlockY() + dy,
|
|
|
|
location.getBlockZ() + dz, block);
|
2018-08-12 14:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-04-30 20:26:52 +00:00
|
|
|
public <T extends BlockStateHolder<T>> boolean setBlock(int x, int y, int z, T block)
|
|
|
|
throws WorldEditException {
|
2018-08-12 14:03:07 +00:00
|
|
|
return getExtent().setBlock(x + dx, y + dy, z + dz, block);
|
|
|
|
}
|
|
|
|
}
|