Full support for 3D biomes (#714)

* Full support for 3D biomes
Since we're only supporting 1.15+ there's no need to try anything other than compatibility

* this is not part of the PR

* Clipboards should still always be y 0 for biomes
(this "bug" has existed for ages)
Dieser Commit ist enthalten in:
dordsor21 2020-10-22 22:18:16 +01:00 committet von GitHub
Ursprung 28f5a7072d
Commit c6ef1bc1de
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
28 geänderte Dateien mit 106 neuen und 103 gelöschten Zeilen

Datei anzeigen

@ -419,14 +419,14 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
if (createCopy) { if (createCopy) {
copy.storeBiomes(currentBiomes); copy.storeBiomes(currentBiomes);
} }
for (int z = 0, i = 0; z < 16; z++) { for (int y = 0, i = 0; y < 64; y++) {
for (int x = 0; x < 16; x++, i++) { for (int z = 0; z < 4; z++) {
for (int x = 0; x < 4; x++, i++) {
final BiomeType biome = biomes[i]; final BiomeType biome = biomes[i];
if (biome != null) { if (biome != null) {
final Biome craftBiome = BukkitAdapter.adapt(biome); final Biome craftBiome = BukkitAdapter.adapt(biome);
BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(craftBiome); BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(craftBiome);
for (int y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) { currentBiomes.setBiome(x, y, z, nmsBiome);
currentBiomes.setBiome(x >> 2, y >> 2, z >> 2, nmsBiome);
} }
} }
} }

Datei anzeigen

@ -421,14 +421,14 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
if (createCopy) { if (createCopy) {
copy.storeBiomes(currentBiomes); copy.storeBiomes(currentBiomes);
} }
for (int z = 0, i = 0; z < 16; z++) { for (int y = 0, i = 0; y < 64; y++) {
for (int x = 0; x < 16; x++, i++) { for (int z = 0; z < 4; z++) {
for (int x = 0; x < 4; x++, i++) {
final BiomeType biome = biomes[i]; final BiomeType biome = biomes[i];
if (biome != null) { if (biome != null) {
final Biome craftBiome = BukkitAdapter.adapt(biome); final Biome craftBiome = BukkitAdapter.adapt(biome);
BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(craftBiome); BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(craftBiome);
for (int y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) { currentBiomes.setBiome(x, y, z, nmsBiome);
currentBiomes.setBiome(x >> 2, y >> 2, z >> 2, nmsBiome);
} }
} }
} }

Datei anzeigen

@ -59,6 +59,7 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.AbstractSet; import java.util.AbstractSet;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -72,7 +73,6 @@ import java.util.UUID;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.function.Function; import java.util.function.Function;
import javax.annotation.Nullable;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
@ -424,14 +424,14 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
if (createCopy) { if (createCopy) {
copy.storeBiomes(currentBiomes); copy.storeBiomes(currentBiomes);
} }
for (int z = 0, i = 0; z < 16; z++) { for (int y = 0, i = 0; y < 64; y++) {
for (int x = 0; x < 16; x++, i++) { for (int z = 0; z < 4; z++) {
for (int x = 0; x < 4; x++, i++) {
final BiomeType biome = biomes[i]; final BiomeType biome = biomes[i];
if (biome != null) { if (biome != null) {
final Biome craftBiome = BukkitAdapter.adapt(biome); final Biome craftBiome = BukkitAdapter.adapt(biome);
BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(nmsWorld.r().b(IRegistry.ay), craftBiome); BiomeBase nmsBiome = CraftBlock.biomeToBiomeBase(nmsWorld.r().b(IRegistry.ay), craftBiome);
for (int y = 0; y < FaweCache.IMP.WORLD_HEIGHT; y++) { currentBiomes.setBiome(x, y, z, nmsBiome);
currentBiomes.setBiome(x >> 2, y >> 2, z >> 2, nmsBiome);
} }
} }
} }

Datei anzeigen

@ -60,6 +60,12 @@ public interface IChunkSet extends IBlocks, OutputExtent {
Set<UUID> getEntityRemoves(); Set<UUID> getEntityRemoves();
/**
* This will return only biomes SET to the EXTENT or QUEUE. This will NOT return the current biomes in the world.
* This is used for history purposes.
*
* @return Array of biomes set
*/
BiomeType[] getBiomes(); BiomeType[] getBiomes();
default boolean hasBiomes() { default boolean hasBiomes() {

Datei anzeigen

@ -57,7 +57,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
if (biomes == null) { if (biomes == null) {
return null; return null;
} }
return biomes[(z << 4) | x]; return biomes[y << 2 | z & 12 | x >> 2];
} }
@Override @Override
@ -88,9 +88,9 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
@Override @Override
public boolean setBiome(int x, int y, int z, BiomeType biome) { public boolean setBiome(int x, int y, int z, BiomeType biome) {
if (biomes == null) { if (biomes == null) {
biomes = new BiomeType[256]; biomes = new BiomeType[1024];
} }
biomes[x + (z << 4)] = biome; biomes[y << 2 | z & 12 | x >> 2] = biome;
return true; return true;
} }

Datei anzeigen

@ -159,11 +159,13 @@ public class FallbackChunkGet implements IChunkGet {
} }
BiomeType[] biomes = set.getBiomes(); BiomeType[] biomes = set.getBiomes();
if (biomes != null) { if (biomes != null) {
for (int z = 0, i = 0; z < 16; z++) { for (int y = 0, i = 0; y < 64; y++) {
for (int x = 0; x < 16; x++, i++) { for (int z = 0; z < 4; z++) {
for (int x = 0; x < 4; x++, i++) {
BiomeType biome = biomes[i]; BiomeType biome = biomes[i];
if (biome != null) { if (biome != null) {
extent.setBiome(bx + x, 0, bz + z, biome); extent.setBiome(bx + (x << 2), y << 2, bz + (z << 2), biome);
}
} }
} }
} }

Datei anzeigen

@ -94,7 +94,8 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
@Override @Override
public BiomeType[] getBiomes() { public BiomeType[] getBiomes() {
return delegate.set(this).getBiomes(); // TODO return get? // Uses set as this method is only used to retrieve biomes that have been set to the extent/chunk.
return delegate.set(this).getBiomes();
} }
@Override public char[][] getLight() { @Override public char[][] getLight() {
@ -218,8 +219,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
} }
@Override @Override
public BaseBlock getFullBlock(ChunkHolder chunk, int x, int y, public BaseBlock getFullBlock(ChunkHolder chunk, int x, int y, int z) {
int z) {
return chunk.chunkExisting.getFullBlock(x, y, z); return chunk.chunkExisting.getFullBlock(x, y, z);
} }

Datei anzeigen

@ -50,7 +50,7 @@ public class MCAChunk implements IChunk {
public final boolean[] hasSections = new boolean[16]; public final boolean[] hasSections = new boolean[16];
public boolean hasBiomes = false; public boolean hasBiomes = false;
public final BiomeType[] biomes = new BiomeType[256]; public final BiomeType[] biomes = new BiomeType[1024];
public final char[] blocks = new char[65536]; public final char[] blocks = new char[65536];
@ -481,7 +481,7 @@ public class MCAChunk implements IChunk {
@Override @Override
public BiomeType getBiomeType(int x, int y, int z) { public BiomeType getBiomeType(int x, int y, int z) {
return this.biomes[(z << 4) | x]; return this.biomes[y << 2 | z & 12 | x >> 2];
} }
@Override @Override
@ -505,7 +505,7 @@ public class MCAChunk implements IChunk {
@Override @Override
public boolean setBiome(int x, int y, int z, BiomeType biome) { public boolean setBiome(int x, int y, int z, BiomeType biome) {
setModified(); setModified();
biomes[x + (z << 4)] = biome; //TODO Support 3D Biomes biomes[y << 2 | z & 12 | x >> 2] = biome;
return true; return true;
} }

Datei anzeigen

@ -98,7 +98,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
public boolean setBiome(BlockVector3 position, BiomeType newBiome) { public boolean setBiome(BlockVector3 position, BiomeType newBiome) {
BiomeType oldBiome = this.getBiome(position); BiomeType oldBiome = this.getBiome(position);
if (oldBiome.getId() != newBiome.getId()) { if (oldBiome.getId() != newBiome.getId()) {
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockZ(), oldBiome, newBiome); this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockY(), position.getBlockZ(), oldBiome, newBiome);
return getExtent().setBiome(position, newBiome); return getExtent().setBiome(position, newBiome);
} else { } else {
return false; return false;
@ -109,7 +109,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
public boolean setBiome(int x, int y, int z, BiomeType newBiome) { public boolean setBiome(int x, int y, int z, BiomeType newBiome) {
BiomeType oldBiome = this.getBiome(BlockVector3.at(x, y, z)); BiomeType oldBiome = this.getBiome(BlockVector3.at(x, y, z));
if (oldBiome.getId() != newBiome.getId()) { if (oldBiome.getId() != newBiome.getId()) {
this.changeSet.addBiomeChange(x, z, oldBiome, newBiome); this.changeSet.addBiomeChange(x, y, z, oldBiome, newBiome);
return getExtent().setBiome(x, y, z, newBiome); return getExtent().setBiome(x, y, z, newBiome);
} else { } else {
return false; return false;

Datei anzeigen

@ -46,7 +46,7 @@ public class NullChangeSet extends AbstractChangeSet {
} }
@Override @Override
public void addBiomeChange(int x, int z, BiomeType from, BiomeType to) { public void addBiomeChange(int x, int y, int z, BiomeType from, BiomeType to) {
} }

Datei anzeigen

@ -57,6 +57,12 @@ public class VisualExtent extends AbstractDelegateExtent {
return false; return false;
} }
@Override
public boolean setBiome(BlockVector3 position, BiomeType biome) {
// Do nothing
return false;
}
public void clear() { public void clear() {
IQueueExtent queue = (IQueueExtent) getExtent(); IQueueExtent queue = (IQueueExtent) getExtent();
queue.cancel(); queue.cancel();

Datei anzeigen

@ -4,11 +4,12 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.history.UndoContext;
import com.sk89q.worldedit.history.change.Change; import com.sk89q.worldedit.history.change.Change;
import com.sk89q.worldedit.math.MutableBlockVector2; import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.biome.BiomeTypes;
public class MutableBiomeChange implements Change { public class MutableBiomeChange implements Change {
private MutableBlockVector2 mutable = new MutableBlockVector2(); private final MutableBlockVector3 mutable = new MutableBlockVector3();
private int from; private int from;
private int to; private int to;
@ -17,8 +18,8 @@ public class MutableBiomeChange implements Change {
this.to = 0; this.to = 0;
} }
public void setBiome(int x, int z, int from, int to) { public void setBiome(int x, int y, int z, int from, int to) {
mutable.setComponents(x, z); mutable.setComponents(x, y, z);
this.from = from; this.from = from;
this.to = to; this.to = to;
} }

Datei anzeigen

@ -188,13 +188,15 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
BiomeType[] biomes = set.getBiomes(); BiomeType[] biomes = set.getBiomes();
if (biomes != null) { if (biomes != null) {
for (int z = 0, index = 0; z < 16; z++) { for (int y = 0, index = 0; y < 64; y++) {
for (int x = 0; x < 16; x++, index++) { for (int z = 0; z < 4; z++) {
for (int x = 0; x < 4; x++, index++) {
BiomeType newBiome = biomes[index]; BiomeType newBiome = biomes[index];
if (newBiome != null) { if (newBiome != null) {
BiomeType oldBiome = get.getBiomeType(x, 0, z); BiomeType oldBiome = get.getBiomeType(x, y, z);
if (oldBiome != newBiome) { if (oldBiome != newBiome) {
addBiomeChange(bx + x, bz + z, oldBiome, newBiome); addBiomeChange(bx + (x << 2), y << 2,bz + (z << 2), oldBiome, newBiome);
}
} }
} }
} }
@ -216,7 +218,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor {
public abstract void addEntityCreate(CompoundTag tag); public abstract void addEntityCreate(CompoundTag tag);
public abstract void addBiomeChange(int x, int z, BiomeType from, BiomeType to); public abstract void addBiomeChange(int x, int y, int z, BiomeType from, BiomeType to);
public Iterator<Change> getIterator(BlockBag blockBag, int mode, boolean redo) { public Iterator<Change> getIterator(BlockBag blockBag, int mode, boolean redo) {
return getIterator(redo); return getIterator(redo);

Datei anzeigen

@ -69,8 +69,8 @@ public class AbstractDelegateChangeSet extends AbstractChangeSet {
} }
@Override @Override
public void addBiomeChange(int x, int z, BiomeType from, BiomeType to) { public void addBiomeChange(int x, int y, int z, BiomeType from, BiomeType to) {
parent.addBiomeChange(x, z, from, to); parent.addBiomeChange(x, y, z, from, to);
} }
@Override @Override

Datei anzeigen

@ -68,7 +68,7 @@ public class CFIChangeSet extends AbstractChangeSet {
} }
@Override @Override
public void addBiomeChange(int x, int z, BiomeType from, BiomeType to) { public void addBiomeChange(int x, int y, int z, BiomeType from, BiomeType to) {
throw new UnsupportedOperationException("Only CFI operations are supported"); throw new UnsupportedOperationException("Only CFI operations are supported");
} }

Datei anzeigen

@ -321,7 +321,7 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet {
} }
@Override @Override
public void addBiomeChange(int x, int z, BiomeType from, BiomeType to) { public void addBiomeChange(int x, int y, int z, BiomeType from, BiomeType to) {
blockSize++; blockSize++;
try { try {
FaweOutputStream os = getBiomeOS(); FaweOutputStream os = getBiomeOS();
@ -333,6 +333,7 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet {
os.write((byte) (z >> 16)); os.write((byte) (z >> 16));
os.write((byte) (z >> 8)); os.write((byte) (z >> 8));
os.write((byte) (z)); os.write((byte) (z));
os.write((byte) (y));
os.writeVarInt(from.getInternalId()); os.writeVarInt(from.getInternalId());
os.writeVarInt(to.getInternalId()); os.writeVarInt(to.getInternalId());
} catch (Throwable e) { } catch (Throwable e) {
@ -462,9 +463,10 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet {
if (int1 != -1) { if (int1 != -1) {
int x = ((int1 << 24) + (is.read() << 16) + (is.read() << 8) + is.read()); int x = ((int1 << 24) + (is.read() << 16) + (is.read() << 8) + is.read());
int z = ((is.read() << 24) + (is.read() << 16) + (is.read() << 8) + is.read()); int z = ((is.read() << 24) + (is.read() << 16) + (is.read() << 8) + is.read());
int y = is.read();
int from = is.readVarInt(); int from = is.readVarInt();
int to = is.readVarInt(); int to = is.readVarInt();
change.setBiome(x, z, from, to); change.setBiome(x, y, z, from, to);
return change; return change;
} }
} catch (EOFException ignored) { } catch (EOFException ignored) {

Datei anzeigen

@ -185,7 +185,7 @@ public class DiskOptimizedClipboard extends LinearClipboard implements Closeable
@Override @Override
public boolean setBiome(int x, int y, int z, BiomeType biome) { public boolean setBiome(int x, int y, int z, BiomeType biome) {
setBiome(getIndex(x, y, z), biome); setBiome(getIndex(x, 0, z), biome);
return true; return true;
} }

Datei anzeigen

@ -4,7 +4,6 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
@ -56,7 +55,7 @@ public class MultiTransform extends RandomTransform {
} }
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
// don't use streams for each block place, it'd be incredibly slow // don't use streams for each block place, it'd be incredibly slow
boolean result = false; boolean result = false;
for (AbstractDelegateExtent extent : extents) { for (AbstractDelegateExtent extent : extents) {

Datei anzeigen

@ -2,9 +2,7 @@ package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -13,7 +11,6 @@ public class OffsetExtent extends ResettableExtent {
private final int dx; private final int dx;
private final int dy; private final int dy;
private final int dz; private final int dz;
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
public OffsetExtent(Extent parent, int dx, int dy, int dz) { public OffsetExtent(Extent parent, int dx, int dy, int dz) {
super(parent); super(parent);
@ -23,9 +20,9 @@ public class OffsetExtent extends ResettableExtent {
} }
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
return getExtent() return getExtent()
.setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz), .setBiome(position.getBlockX() + dx, position.getBlockY() + dy, position.getBlockZ() + dz,
biome); biome);
} }
@ -46,10 +43,4 @@ public class OffsetExtent extends ResettableExtent {
throws WorldEditException { throws WorldEditException {
return getExtent().setBlock(x + dx, y + dy, z + dz, block); return getExtent().setBlock(x + dx, y + dy, z + dz, block);
} }
@Override
public ResettableExtent setExtent(Extent extent) {
mutable = new MutableBlockVector2();
return super.setExtent(extent);
}
} }

Datei anzeigen

@ -8,7 +8,6 @@ import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
@ -100,7 +99,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
} }
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
if (!limit.MAX_CHANGES()) { if (!limit.MAX_CHANGES()) {
WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_CHANGES); WEManager.IMP.cancelEditSafe(this, FaweCache.MAX_CHANGES);
return false; return false;

Datei anzeigen

@ -2,9 +2,7 @@ package com.boydti.fawe.object.extent;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector2;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -16,7 +14,6 @@ public class RandomOffsetTransform extends ResettableExtent {
private final int dy; private final int dy;
private final int dz; private final int dz;
private transient SplittableRandom random; private transient SplittableRandom random;
private transient MutableBlockVector2 mutable = new MutableBlockVector2();
public RandomOffsetTransform(Extent parent, int dx, int dy, int dz) { public RandomOffsetTransform(Extent parent, int dx, int dy, int dz) {
super(parent); super(parent);
@ -27,10 +24,11 @@ public class RandomOffsetTransform extends ResettableExtent {
} }
@Override @Override
public boolean setBiome(BlockVector2 pos, BiomeType biome) { public boolean setBiome(BlockVector3 pos, BiomeType biome) {
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx; int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
int y = pos.getBlockY() + random.nextInt(1 + (dy << 1)) - dy;
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz; int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
return getExtent().setBiome(mutable.setComponents(x, z), biome); return getExtent().setBiome(x, y, z, biome);
} }
@Override @Override
@ -54,7 +52,6 @@ public class RandomOffsetTransform extends ResettableExtent {
@Override @Override
public ResettableExtent setExtent(Extent extent) { public ResettableExtent setExtent(Extent extent) {
random = new SplittableRandom(); random = new SplittableRandom();
mutable = new MutableBlockVector2();
return super.setExtent(extent); return super.setExtent(extent);
} }
} }

Datei anzeigen

@ -4,7 +4,6 @@ import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
@ -82,17 +81,20 @@ public class ScaleTransform extends ResettableExtent {
} }
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
boolean result = false; boolean result = false;
MutableBlockVector3 pos = new MutableBlockVector3( MutableBlockVector3 pos = new MutableBlockVector3(getPos(position));
getPos(position.getBlockX(), 0, position.getBlockZ()));
double sx = pos.getX(); double sx = pos.getX();
double sy = pos.getY();
double sz = pos.getZ(); double sz = pos.getZ();
double ex = pos.getX() + dx; double ex = sx + dx;
double ez = pos.getZ() + dz; double ey = Math.min(maxy, sy + dy);
double ez = sz + dz;
for (pos.mutY(sy); pos.getY() < ey; pos.mutY(pos.getY() + 1)) {
for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) { for (pos.mutZ(sz); pos.getZ() < ez; pos.mutZ(pos.getZ() + 1)) {
for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) { for (pos.mutX(sx); pos.getX() < ex; pos.mutX(pos.getX() + 1)) {
result |= super.setBiome(pos.toBlockVector2(), biome); result |= super.setBiome(pos, biome);
}
} }
} }
return result; return result;

Datei anzeigen

@ -52,7 +52,7 @@ public abstract class SelectTransform extends ResettableExtent {
} }
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
return getExtent(position).setBiome(position, biome); return getExtent(position).setBiome(position, biome);
} }
} }

Datei anzeigen

@ -31,7 +31,6 @@ import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
@ -93,11 +92,6 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce
return this.mask.test(location) && super.setBlock(location, block); return this.mask.test(location) && super.setBlock(location, block);
} }
@Override
public boolean setBiome(BlockVector2 position, BiomeType biome) {
return this.mask.test(position.toBlockVector3()) && super.setBiome(position, biome);
}
@Override @Override
public boolean setBiome(int x, int y, int z, BiomeType biome) { public boolean setBiome(int x, int y, int z, BiomeType biome) {
return this.mask.test(BlockVector3.at(x, y, z)) && super.setBiome(x, y, z, biome); return this.mask.test(BlockVector3.at(x, y, z)) && super.setBiome(x, y, z, biome);

Datei anzeigen

@ -94,7 +94,11 @@ public interface OutputExtent {
*/ */
@Deprecated @Deprecated
default boolean setBiome(BlockVector2 position, BiomeType biome) { default boolean setBiome(BlockVector2 position, BiomeType biome) {
return setBiome(position.toBlockVector3(), biome); boolean result = false;
for (int y = 0; y < 256; y ++) {
result |= setBiome(position.toBlockVector3().mutY(y), biome);
}
return result;
} }
@NonAbstractForCompatibility( @NonAbstractForCompatibility(

Datei anzeigen

@ -10,7 +10,6 @@ import com.sk89q.worldedit.function.generator.Resource;
import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operation;
import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
@ -199,7 +198,7 @@ public class PassthroughExtent extends AbstractDelegateExtent {
} }
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
return getExtent().setBiome(position, biome); return getExtent().setBiome(position, biome);
} }

Datei anzeigen

@ -71,9 +71,9 @@ public class ChunkLoadingExtent extends AbstractDelegateExtent {
} }
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
if (enabled) { if (enabled) {
world.checkLoadedChunk(position.toBlockVector3()); world.checkLoadedChunk(position);
} }
return super.setBiome(position, biome); return super.setBiome(position, biome);
} }

Datei anzeigen

@ -25,7 +25,6 @@ import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extension.platform.Watchdog; import com.sk89q.worldedit.extension.platform.Watchdog;
import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
@ -88,7 +87,7 @@ public class WatchdogTickingExtent extends AbstractDelegateExtent {
} }
@Override @Override
public boolean setBiome(BlockVector2 position, BiomeType biome) { public boolean setBiome(BlockVector3 position, BiomeType biome) {
onOperation(); onOperation();
return super.setBiome(position, biome); return super.setBiome(position, biome);
} }