Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-17 00:20:09 +01:00
Better chest handling
Dieser Commit ist enthalten in:
Ursprung
b069e07c25
Commit
64da82c985
@ -14,20 +14,21 @@ import net.minecraft.world.phys.Vec3;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
public class PaperweightFaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
|
||||
private static final BlockHitResult DEFAULT_BLOCK_HIT = new BlockHitResult(new Vec3(
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE
|
||||
), Direction.NORTH, BlockPos.ZERO, false);
|
||||
private static final BlockHitResult DEFAULT_BLOCK_HIT = new BlockHitResult(
|
||||
new Vec3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
Direction.NORTH,
|
||||
new BlockPos(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
false
|
||||
);
|
||||
private final ServerLevel level;
|
||||
private BlockHitResult hitResult = null;
|
||||
private Direction direction = null;
|
||||
private BlockPos relativePos;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
public FaweMutableBlockPlaceContext(ServerLevel level) {
|
||||
public PaperweightFaweMutableBlockPlaceContext(ServerLevel level) {
|
||||
super(
|
||||
level,
|
||||
null,
|
||||
@ -40,7 +41,7 @@ public class FaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
this.replaceClicked = false;
|
||||
}
|
||||
|
||||
public FaweMutableBlockPlaceContext withSetting(BlockHitResult hitResult, Direction direction) {
|
||||
public PaperweightFaweMutableBlockPlaceContext withSetting(BlockHitResult hitResult, Direction direction) {
|
||||
this.hitResult = hitResult;
|
||||
this.direction = direction;
|
||||
this.relativePos = hitResult.getBlockPos().relative(hitResult.getDirection());
|
@ -24,13 +24,13 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
private final PaperweightFaweAdapter adapter = ((PaperweightFaweAdapter) WorldEditPlugin
|
||||
.getInstance()
|
||||
.getBukkitImplAdapter());
|
||||
private final FaweMutableBlockPlaceContext mutableBlockPlaceContext;
|
||||
private final PaperweightFaweMutableBlockPlaceContext mutableBlockPlaceContext;
|
||||
private final PaperweightLevelProxy proxyLevel;
|
||||
|
||||
public PaperweightPlacementStateProcessor(Extent extent, BlockTypeMask mask, Region region) {
|
||||
super(extent, mask, region);
|
||||
this.proxyLevel = PaperweightLevelProxy.getInstance(this);
|
||||
this.mutableBlockPlaceContext = new FaweMutableBlockPlaceContext(proxyLevel);
|
||||
this.mutableBlockPlaceContext = new PaperweightFaweMutableBlockPlaceContext(proxyLevel);
|
||||
}
|
||||
|
||||
private PaperweightPlacementStateProcessor(
|
||||
@ -43,7 +43,7 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
) {
|
||||
super(extent, mask, crossChunkSecondPasses, threadProcessors, region, finished);
|
||||
this.proxyLevel = PaperweightLevelProxy.getInstance(this);
|
||||
this.mutableBlockPlaceContext = new FaweMutableBlockPlaceContext(proxyLevel);
|
||||
this.mutableBlockPlaceContext = new PaperweightFaweMutableBlockPlaceContext(proxyLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,33 +14,29 @@ import net.minecraft.world.phys.Vec3;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
public class PaperweightFaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
|
||||
private static final BlockHitResult DEFAULT_BLOCK_HIT = new BlockHitResult(new Vec3(
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE
|
||||
), Direction.NORTH, BlockPos.ZERO, false);
|
||||
private static final BlockHitResult DEFAULT_BLOCK_HIT = new BlockHitResult(
|
||||
new Vec3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
Direction.NORTH,
|
||||
new BlockPos(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
false
|
||||
);
|
||||
private final ServerLevel level;
|
||||
private BlockHitResult hitResult = null;
|
||||
private Direction direction = null;
|
||||
private BlockPos relativePos;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
public FaweMutableBlockPlaceContext(ServerLevel level) {
|
||||
super(
|
||||
level,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DEFAULT_BLOCK_HIT
|
||||
public PaperweightFaweMutableBlockPlaceContext(ServerLevel level) {
|
||||
super(level, null, null, null, DEFAULT_BLOCK_HIT
|
||||
|
||||
);
|
||||
this.level = level;
|
||||
this.replaceClicked = false;
|
||||
}
|
||||
|
||||
public FaweMutableBlockPlaceContext withSetting(BlockHitResult hitResult, Direction direction) {
|
||||
public PaperweightFaweMutableBlockPlaceContext withSetting(BlockHitResult hitResult, Direction direction) {
|
||||
this.hitResult = hitResult;
|
||||
this.direction = direction;
|
||||
this.relativePos = hitResult.getBlockPos().relative(hitResult.getDirection());
|
@ -24,13 +24,13 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
private final PaperweightFaweAdapter adapter = ((PaperweightFaweAdapter) WorldEditPlugin
|
||||
.getInstance()
|
||||
.getBukkitImplAdapter());
|
||||
private final FaweMutableBlockPlaceContext mutableBlockPlaceContext;
|
||||
private final PaperweightFaweMutableBlockPlaceContext mutableBlockPlaceContext;
|
||||
private final PaperweightLevelProxy proxyLevel;
|
||||
|
||||
public PaperweightPlacementStateProcessor(Extent extent, BlockTypeMask mask, Region region) {
|
||||
super(extent, mask, region);
|
||||
this.proxyLevel = PaperweightLevelProxy.getInstance(this);
|
||||
this.mutableBlockPlaceContext = new FaweMutableBlockPlaceContext(proxyLevel);
|
||||
this.mutableBlockPlaceContext = new PaperweightFaweMutableBlockPlaceContext(proxyLevel);
|
||||
}
|
||||
|
||||
private PaperweightPlacementStateProcessor(
|
||||
@ -43,12 +43,18 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
) {
|
||||
super(extent, mask, crossChunkSecondPasses, threadProcessors, region, finished);
|
||||
this.proxyLevel = PaperweightLevelProxy.getInstance(this);
|
||||
this.mutableBlockPlaceContext = new FaweMutableBlockPlaceContext(proxyLevel);
|
||||
this.mutableBlockPlaceContext = new PaperweightFaweMutableBlockPlaceContext(proxyLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char getStateAtFor(
|
||||
int x, int y, int z, BlockState state, Vector3 clickPos, Direction clickedFaceDirection, BlockVector3 clickedBlock
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
BlockState state,
|
||||
Vector3 clickPos,
|
||||
Direction clickedFaceDirection,
|
||||
BlockVector3 clickedBlock
|
||||
) {
|
||||
Block block = ((PaperweightBlockMaterial) state.getMaterial()).getBlock();
|
||||
Vec3 pos = new Vec3(clickPos.x(), clickPos.y(), clickPos.z());
|
||||
|
@ -14,20 +14,21 @@ import net.minecraft.world.phys.Vec3;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
public class PaperweightFaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
|
||||
private static final BlockHitResult DEFAULT_BLOCK_HIT = new BlockHitResult(new Vec3(
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE
|
||||
), Direction.NORTH, BlockPos.ZERO, false);
|
||||
private static final BlockHitResult DEFAULT_BLOCK_HIT = new BlockHitResult(
|
||||
new Vec3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
Direction.NORTH,
|
||||
new BlockPos(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
false
|
||||
);
|
||||
private final ServerLevel level;
|
||||
private BlockHitResult hitResult = null;
|
||||
private Direction direction = null;
|
||||
private BlockPos relativePos;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
public FaweMutableBlockPlaceContext(ServerLevel level) {
|
||||
public PaperweightFaweMutableBlockPlaceContext(ServerLevel level) {
|
||||
super(
|
||||
level,
|
||||
null,
|
||||
@ -40,7 +41,7 @@ public class FaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
this.replaceClicked = false;
|
||||
}
|
||||
|
||||
public FaweMutableBlockPlaceContext withSetting(BlockHitResult hitResult, Direction direction) {
|
||||
public PaperweightFaweMutableBlockPlaceContext withSetting(BlockHitResult hitResult, Direction direction) {
|
||||
this.hitResult = hitResult;
|
||||
this.direction = direction;
|
||||
this.relativePos = hitResult.getBlockPos().relative(hitResult.getDirection());
|
@ -31,7 +31,7 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
.getInstance()
|
||||
.getBukkitImplAdapter());
|
||||
private final PaperweightLevelProxy proxyLevel;
|
||||
private final FaweMutableBlockPlaceContext mutableBlockPlaceContext;
|
||||
private final PaperweightFaweMutableBlockPlaceContext mutableBlockPlaceContext;
|
||||
|
||||
public PaperweightPlacementStateProcessor(Extent extent, BlockTypeMask mask, Region region) {
|
||||
super(extent, mask, region);
|
||||
@ -47,7 +47,7 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
bukkitWorld = (BukkitWorld) world;
|
||||
}
|
||||
this.proxyLevel = PaperweightLevelProxy.getInstance(((CraftWorld) bukkitWorld.getWorld()).getHandle(), this);
|
||||
this.mutableBlockPlaceContext = new FaweMutableBlockPlaceContext(proxyLevel);
|
||||
this.mutableBlockPlaceContext = new PaperweightFaweMutableBlockPlaceContext(proxyLevel);
|
||||
}
|
||||
|
||||
private PaperweightPlacementStateProcessor(
|
||||
@ -61,7 +61,7 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
) {
|
||||
super(extent, mask, crossChunkSecondPasses, threadProcessors, region, finished);
|
||||
this.proxyLevel = PaperweightLevelProxy.getInstance(serverLevel, this);
|
||||
this.mutableBlockPlaceContext = new FaweMutableBlockPlaceContext(proxyLevel);
|
||||
this.mutableBlockPlaceContext = new PaperweightFaweMutableBlockPlaceContext(proxyLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,20 +14,21 @@ import net.minecraft.world.phys.Vec3;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
public class PaperweightFaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
|
||||
private static final BlockHitResult DEFAULT_BLOCK_HIT = new BlockHitResult(new Vec3(
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE,
|
||||
Integer.MAX_VALUE
|
||||
), Direction.NORTH, BlockPos.ZERO, false);
|
||||
private static final BlockHitResult DEFAULT_BLOCK_HIT = new BlockHitResult(
|
||||
new Vec3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
Direction.NORTH,
|
||||
new BlockPos(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE),
|
||||
false
|
||||
);
|
||||
private final ServerLevel level;
|
||||
private BlockHitResult hitResult = null;
|
||||
private Direction direction = null;
|
||||
private BlockPos relativePos;
|
||||
|
||||
@SuppressWarnings("DataFlowIssue")
|
||||
public FaweMutableBlockPlaceContext(ServerLevel level) {
|
||||
public PaperweightFaweMutableBlockPlaceContext(ServerLevel level) {
|
||||
super(
|
||||
level,
|
||||
null,
|
||||
@ -40,7 +41,7 @@ public class FaweMutableBlockPlaceContext extends BlockPlaceContext {
|
||||
this.replaceClicked = false;
|
||||
}
|
||||
|
||||
public FaweMutableBlockPlaceContext withSetting(BlockHitResult hitResult, Direction direction) {
|
||||
public PaperweightFaweMutableBlockPlaceContext withSetting(BlockHitResult hitResult, Direction direction) {
|
||||
this.hitResult = hitResult;
|
||||
this.direction = direction;
|
||||
this.relativePos = hitResult.getBlockPos().relative(hitResult.getDirection());
|
@ -30,7 +30,7 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
private final PaperweightFaweAdapter adapter = ((PaperweightFaweAdapter) WorldEditPlugin
|
||||
.getInstance()
|
||||
.getBukkitImplAdapter());
|
||||
private final FaweMutableBlockPlaceContext mutableBlockPlaceContext;
|
||||
private final PaperweightFaweMutableBlockPlaceContext mutableBlockPlaceContext;
|
||||
private final PaperweightLevelProxy proxyLevel;
|
||||
|
||||
public PaperweightPlacementStateProcessor(Extent extent, BlockTypeMask mask, Region region) {
|
||||
@ -47,7 +47,7 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
bukkitWorld = (BukkitWorld) world;
|
||||
}
|
||||
this.proxyLevel = PaperweightLevelProxy.getInstance(((CraftWorld) bukkitWorld.getWorld()).getHandle(), this);
|
||||
this.mutableBlockPlaceContext = new FaweMutableBlockPlaceContext(proxyLevel);
|
||||
this.mutableBlockPlaceContext = new PaperweightFaweMutableBlockPlaceContext(proxyLevel);
|
||||
}
|
||||
|
||||
private PaperweightPlacementStateProcessor(
|
||||
@ -61,7 +61,7 @@ public class PaperweightPlacementStateProcessor extends PlacementStateProcessor
|
||||
) {
|
||||
super(extent, mask, crossChunkSecondPasses, threadProcessors, region, finished);
|
||||
this.proxyLevel = PaperweightLevelProxy.getInstance(serverLevel, this);
|
||||
this.mutableBlockPlaceContext = new FaweMutableBlockPlaceContext(proxyLevel);
|
||||
this.mutableBlockPlaceContext = new PaperweightFaweMutableBlockPlaceContext(proxyLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.fastasyncworldedit.core.extent.processor;
|
||||
|
||||
import com.fastasyncworldedit.core.configuration.Caption;
|
||||
import com.fastasyncworldedit.core.extent.NullExtent;
|
||||
import com.fastasyncworldedit.core.extent.filter.block.FilterBlock;
|
||||
import com.fastasyncworldedit.core.function.mask.AdjacentAny2DMask;
|
||||
import com.fastasyncworldedit.core.math.BlockVector3ChunkMap;
|
||||
@ -9,11 +11,12 @@ import com.fastasyncworldedit.core.queue.IBatchProcessor;
|
||||
import com.fastasyncworldedit.core.queue.IChunk;
|
||||
import com.fastasyncworldedit.core.queue.IChunkGet;
|
||||
import com.fastasyncworldedit.core.queue.IChunkSet;
|
||||
import com.fastasyncworldedit.core.registry.state.PropertyKey;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.function.mask.BlockCategoryMask;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -48,6 +51,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
|
||||
private static volatile boolean SETUP = false;
|
||||
private static BlockTypeMask DEFAULT_MASK = null;
|
||||
private static BlockTypeMask IN_FIRST_PASS = null;
|
||||
private static BlockTypeMask REQUIRES_SECOND_PASS = null;
|
||||
private static AdjacentAny2DMask ADJACENT_STAIR_MASK = null;
|
||||
|
||||
@ -59,6 +63,7 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
protected final AtomicBoolean finished;
|
||||
private final MutableVector3 clickPos = new MutableVector3();
|
||||
private final MutableBlockVector3 clickedBlock = new MutableBlockVector3();
|
||||
private final MutableBlockVector3 placedBlock = new MutableBlockVector3(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
|
||||
private IChunkGet processChunkGet = null;
|
||||
private IChunkSet processChunkSet = null;
|
||||
@ -109,7 +114,19 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
}
|
||||
|
||||
private static void setup() {
|
||||
REQUIRES_SECOND_PASS = new BlockTypeMask(new NullExtent());
|
||||
NullExtent nullExtent = new NullExtent(
|
||||
com.sk89q.worldedit.extent.NullExtent.INSTANCE,
|
||||
Caption.of("PlacementStateProcessor fell through to null extent")
|
||||
);
|
||||
|
||||
IN_FIRST_PASS = new BlockTypeMask(nullExtent);
|
||||
IN_FIRST_PASS.add(
|
||||
BlockTypes.CHEST,
|
||||
BlockTypes.TRAPPED_CHEST
|
||||
);
|
||||
IN_FIRST_PASS.add(BlockCategories.STAIRS.getAll());
|
||||
|
||||
REQUIRES_SECOND_PASS = new BlockTypeMask(nullExtent);
|
||||
REQUIRES_SECOND_PASS.add(
|
||||
BlockTypes.IRON_BARS,
|
||||
BlockTypes.GLASS_PANE,
|
||||
@ -164,8 +181,8 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
DEFAULT_MASK.add(category.getAll());
|
||||
}
|
||||
}
|
||||
BlockTypeMask stairs = new BlockTypeMask(new NullExtent(), BlockCategories.STAIRS.getAll());
|
||||
ADJACENT_STAIR_MASK = new AdjacentAny2DMask(stairs, false);
|
||||
|
||||
ADJACENT_STAIR_MASK = new AdjacentAny2DMask(new BlockCategoryMask(nullExtent, BlockCategories.STAIRS), false);
|
||||
SETUP = true;
|
||||
}
|
||||
|
||||
@ -225,13 +242,14 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
int blockX = processChunkX + x;
|
||||
char ordinal = set[index];
|
||||
BlockState state = BlockTypesCache.states[ordinal];
|
||||
if (firstPass && !BlockCategories.STAIRS.contains(state)) {
|
||||
if (firstPass && !IN_FIRST_PASS.test(state)) {
|
||||
continue;
|
||||
}
|
||||
if (!mask.test(state)) {
|
||||
continue;
|
||||
}
|
||||
if (!firstPass && REQUIRES_SECOND_PASS.test(state)) {
|
||||
boolean atEdge = x == 0 || x == 15 || z == 0 || z == 15;
|
||||
if (!firstPass && atEdge && REQUIRES_SECOND_PASS.test(state)) {
|
||||
postCompleteSecondPasses.put(new SecondPass(
|
||||
blockX,
|
||||
blockY,
|
||||
@ -241,6 +259,11 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
set[index] = BlockTypesCache.ReservedIDs.__RESERVED__;
|
||||
continue;
|
||||
}
|
||||
if (state.getBlockType().equals(BlockTypes.CHEST) || state.getBlockType().equals(BlockTypes.TRAPPED_CHEST)) {
|
||||
placedBlock.setComponents(blockX, blockY, blockZ);
|
||||
} else {
|
||||
placedBlock.setComponents(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
char newOrdinal = getBlockOrdinal(blockX, blockY, blockZ, state);
|
||||
if (newOrdinal == ordinal) {
|
||||
continue;
|
||||
@ -313,6 +336,28 @@ public abstract class PlacementStateProcessor extends AbstractDelegateExtent imp
|
||||
if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) {
|
||||
return processChunkGet.getBlock(x & 15, y, z & 15);
|
||||
}
|
||||
BlockState state = BlockTypesCache.states[ordinal];
|
||||
// "Hack" for stairs as internal server methods will only accept "single" chests for joining
|
||||
if (state.getBlockType().equals(BlockTypes.CHEST) || state.getBlockType().equals(BlockTypes.TRAPPED_CHEST)) {
|
||||
String shape = state.getState(PropertyKey.TYPE).toString();
|
||||
if (shape.equals("right")) {
|
||||
Direction facing = state.getState(PropertyKey.FACING);
|
||||
Direction left = facing.getLeft();
|
||||
int testX = x + left.getBlockX();
|
||||
int testZ = z + left.getBlockZ();
|
||||
if (placedBlock.isAt(testX, y, testZ)) {
|
||||
return state.with(PropertyKey.TYPE, "single");
|
||||
}
|
||||
} else if(shape.equals("left")) {
|
||||
Direction facing = state.getState(PropertyKey.FACING);
|
||||
Direction right = facing.getRight();
|
||||
int testX = x + right.getBlockX();
|
||||
int testZ = z + right.getBlockZ();
|
||||
if (placedBlock.isAt(testX, y, testZ)) {
|
||||
return state.with(PropertyKey.TYPE, "single");
|
||||
}
|
||||
}
|
||||
}
|
||||
return BlockTypesCache.states[ordinal];
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ package com.sk89q.worldedit.function.mask;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@ -54,6 +55,15 @@ public class BlockCategoryMask extends AbstractExtentMask {
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return category.contains(extent.getBlock(vector));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a specific block against this category mask
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
public <B extends BlockStateHolder<B>> boolean test(B blockStateHolder) {
|
||||
return category.contains(blockStateHolder);
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
@Nullable
|
||||
|
@ -127,6 +127,10 @@ public abstract class BlockVector3 {
|
||||
}
|
||||
|
||||
//FAWE start
|
||||
public boolean isAt(int x, int y, int z) {
|
||||
return x() == x && y() == y && z() == z;
|
||||
}
|
||||
|
||||
public MutableBlockVector3 setComponents(double x, double y, double z) {
|
||||
return new MutableBlockVector3((int) x, (int) y, (int) z);
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.util;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -31,7 +30,12 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class SideEffectSet {
|
||||
|
||||
private static final SideEffectSet DEFAULT = new SideEffectSet();
|
||||
//FAWE start - assign value map
|
||||
private static final SideEffectSet DEFAULT = new SideEffectSet(
|
||||
Arrays.stream(SideEffect.values())
|
||||
.filter(SideEffect::isExposed)
|
||||
.collect(Collectors.toMap(Function.identity(), SideEffect::getDefaultValue)));
|
||||
//FAWE end
|
||||
private static final SideEffectSet NONE = new SideEffectSet(
|
||||
Arrays.stream(SideEffect.values())
|
||||
.filter(SideEffect::isExposed)
|
||||
@ -42,12 +46,6 @@ public class SideEffectSet {
|
||||
private final Set<SideEffect> appliedSideEffects;
|
||||
private final boolean appliesAny;
|
||||
|
||||
//FAWE start
|
||||
private SideEffectSet() {
|
||||
this(ImmutableMap.of());
|
||||
}
|
||||
//FAWE end
|
||||
|
||||
public SideEffectSet(Map<SideEffect, SideEffect.State> sideEffects) {
|
||||
this.sideEffects = Maps.immutableEnumMap(sideEffects);
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren