mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-03-21 11:09:27 +01:00
Mask tweaks
Biome pattern can be properly masked now Added `false` and `true` mask
This commit is contained in:
parent
fb8f76f833
commit
fa8d9d322e
@ -4,10 +4,7 @@ import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
@ -142,6 +139,17 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome newBiome) {
|
||||
BaseBiome oldBiome = this.getBiome(MutableBlockVector2D.get(x, z));
|
||||
if (oldBiome.getId() != newBiome.getId()) {
|
||||
this.changeSet.addBiomeChange(x, z, oldBiome, newBiome);
|
||||
return getExtent().setBiome(x, y, z, newBiome);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class TrackedEntity implements Entity {
|
||||
private final Entity entity;
|
||||
|
||||
|
@ -41,6 +41,11 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
return super.setBiome(position.add(dx, dz), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
return super.setBiome(x + dx, y + dy, z + dz, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
return super.getBiome(position.add(dx, dz));
|
||||
|
@ -62,6 +62,11 @@ public class EmptyExtent implements Extent {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Operation commit() {
|
||||
return null;
|
||||
|
@ -86,6 +86,17 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
return super.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
if (!contains(position)) {
|
||||
|
@ -24,6 +24,11 @@ public class OffsetExtent extends ResettableExtent {
|
||||
return getExtent().setBiome(mutable.setComponents(position.getBlockX() + dx, position.getBlockZ() + dz), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
return getExtent().setBiome(x + dx, y + dy, z + dz, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException {
|
||||
return getExtent().setBlock(location.getBlockX() + dx, location.getBlockY() + dy, location.getBlockZ() + dz, block);
|
||||
|
@ -23,8 +23,8 @@ public class BiomePattern extends ExistingPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Extent extent, Vector setPosition, Vector getPosition) throws WorldEditException {
|
||||
return extent.setBiome(mutable.setComponents(setPosition.getBlockX(), setPosition.getBlockZ()), biome);
|
||||
public boolean apply(Extent extent, Vector set, Vector getPosition) throws WorldEditException {
|
||||
return extent.setBiome(set.getBlockX(), set.getBlockY(), set.getBlockZ(), biome);
|
||||
}
|
||||
|
||||
public class BiomePatternException extends RuntimeException {
|
||||
|
@ -983,6 +983,12 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue,
|
||||
return this.extent.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
this.changes++;
|
||||
return this.extent.setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLight(int x, int y, int z) {
|
||||
return queue.getLight(x, y, z);
|
||||
|
@ -85,6 +85,22 @@ public class MaskCommands extends MethodCommands {
|
||||
return new LightMask(extent, (int) min, (int) max);
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"false"},
|
||||
desc = "Always false"
|
||||
)
|
||||
public Mask falseMask(Extent extent) {
|
||||
return Masks.alwaysFalse();
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"true"},
|
||||
desc = "Always true"
|
||||
)
|
||||
public Mask trueMask(Extent extent) {
|
||||
return Masks.alwaysTrue();
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = {"#skylight"},
|
||||
desc = "Restrict to specific sky light levels",
|
||||
|
@ -7,11 +7,7 @@ import com.boydti.fawe.jnbt.anvil.generator.OreGen;
|
||||
import com.boydti.fawe.jnbt.anvil.generator.Resource;
|
||||
import com.boydti.fawe.jnbt.anvil.generator.SchemGen;
|
||||
import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
@ -22,6 +18,7 @@ import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
import com.sk89q.worldedit.world.registry.WorldData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -70,6 +67,10 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
return 255;
|
||||
}
|
||||
|
||||
default boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
return setBiome(MutableBlockVector2D.get(x, z), biome);
|
||||
}
|
||||
|
||||
default public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) {
|
||||
int clearanceAbove = maxY - y;
|
||||
int clearanceBelow = y - minY;
|
||||
|
Loading…
Reference in New Issue
Block a user