mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 06:38:35 +00:00
More support for 3D biomes (#608)
* More support for 3D biomes * Resolved merge conflicts
This commit is contained in:
@ -7,7 +7,6 @@ import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
@ -96,7 +95,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType newBiome) {
|
||||
public boolean setBiome(BlockVector3 position, BiomeType newBiome) {
|
||||
BiomeType oldBiome = this.getBiome(position);
|
||||
if (oldBiome.getId() != newBiome.getId()) {
|
||||
this.changeSet.addBiomeChange(position.getBlockX(), position.getBlockZ(), oldBiome, newBiome);
|
||||
@ -108,7 +107,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType newBiome) {
|
||||
BiomeType oldBiome = this.getBiome(BlockVector2.at(x, z));
|
||||
BiomeType oldBiome = this.getBiome(BlockVector3.at(x, y, z));
|
||||
if (oldBiome.getId() != newBiome.getId()) {
|
||||
this.changeSet.addBiomeChange(x, z, oldBiome, newBiome);
|
||||
return getExtent().setBiome(x, y, z, newBiome);
|
||||
|
@ -4,7 +4,6 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
@ -28,7 +27,7 @@ public abstract class ImmutableVirtualWorld implements VirtualWorld {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return BiomeTypes.FOREST;
|
||||
}
|
||||
|
||||
|
@ -1024,8 +1024,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return getBiomeType(position.getBlockX(), 0, position.getBlockZ());
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return getBiomeType(position.getBlockX(), position.getBlockY(), position.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ object EmptyClipboard : Clipboard {
|
||||
return BlockTypes.AIR!!.defaultState
|
||||
}
|
||||
|
||||
override fun getBiome(position: BlockVector2): BiomeType? {
|
||||
override fun getBiome(position: BlockVector3): BiomeType? {
|
||||
return null
|
||||
}
|
||||
|
||||
@ -64,7 +64,11 @@ object EmptyClipboard : Clipboard {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun setBiome(position: BlockVector2, biome: BiomeType): Boolean {
|
||||
override fun setBiome(position: BlockVector3, biome: BiomeType): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun fullySupports3DBiomes(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.boydti.fawe.object.extent;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
@ -36,8 +35,8 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return super.setBiome(position.add(dx, dz), biome);
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return super.setBiome(position.add(dx, dy, dz), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,8 +45,8 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
return super.getBiome(position.add(dx, dz));
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return super.getBiome(position.add(dx, dy, dz));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,7 +93,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweCache.OUTSIDE_REGION);
|
||||
|
@ -19,7 +19,6 @@ import com.sk89q.worldedit.function.generator.Resource;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
@ -110,7 +109,7 @@ public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return BiomeTypes.THE_VOID;
|
||||
}
|
||||
|
||||
@ -141,7 +140,7 @@ public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -149,7 +148,7 @@ public class NullExtent extends FaweRegionExtent implements IBatchProcessor {
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isQueueEnabled() {
|
||||
throw reason;
|
||||
|
@ -2,7 +2,6 @@ package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableVector3;
|
||||
@ -62,11 +61,11 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(0);
|
||||
return super.getBiome(getPos(mutable).toBlockVector2());
|
||||
mutable.mutY(position.getBlockY());
|
||||
return super.getBiome(getPos(mutable));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -81,11 +80,11 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(0);
|
||||
return super.setBiome(getPos(mutable).toBlockVector2(), biome);
|
||||
mutable.mutY(position.getBlockY());
|
||||
return super.setBiome(getPos(mutable), biome);
|
||||
}
|
||||
|
||||
public void setTransform(Transform transform) {
|
||||
|
@ -2,7 +2,6 @@ package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.PassthroughExtent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
@ -69,7 +68,7 @@ public class TemporalExtent extends PassthroughExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
if (position.getX() == bx && position.getZ() == bz) {
|
||||
return biome;
|
||||
}
|
||||
|
@ -3,31 +3,31 @@ package com.boydti.fawe.object.function.block;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector2;
|
||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||
|
||||
public class BiomeCopy implements RegionFunction {
|
||||
|
||||
protected final Extent source;
|
||||
protected final Extent destination;
|
||||
private final MutableBlockVector2 mPos2d;
|
||||
private final MutableBlockVector3 mutableVector;
|
||||
|
||||
public BiomeCopy(Extent source, Extent destination) {
|
||||
this.source = source;
|
||||
this.destination = destination;
|
||||
this.mPos2d = new MutableBlockVector2();
|
||||
this.mPos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
this.mutableVector = new MutableBlockVector3();
|
||||
this.mutableVector.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(BlockVector3 position) throws WorldEditException {
|
||||
int x = position.getBlockX();
|
||||
int y = position.getBlockY();
|
||||
int z = position.getBlockZ();
|
||||
if (x != mPos2d.getBlockX() || z != mPos2d.getBlockZ()) {
|
||||
mPos2d.setComponents(x, z);
|
||||
BlockVector2 bv = mPos2d;
|
||||
return destination.setBiome(bv, source.getBiome(bv));
|
||||
if (x != mutableVector.getBlockX() || z != mutableVector.getBlockZ()|| y != mutableVector
|
||||
.getBlockY()) {
|
||||
mutableVector.setComponents(x, y, z);
|
||||
return destination.setBiome(mutableVector, source.getBiome(mutableVector));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user