mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
commanding-pipeline diff
This commit is contained in:
@ -24,6 +24,7 @@ import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.blocks.BaseItem;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.function.mask.BlockMaskBuilder;
|
||||
import com.sk89q.worldedit.function.mask.BlockTypeMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
@ -71,7 +72,7 @@ public abstract class AbstractWorld implements World {
|
||||
|
||||
@Override
|
||||
public Mask createLiquidMask() {
|
||||
return new BlockTypeMask(this, BlockTypes.LAVA, BlockTypes.WATER);
|
||||
return new BlockMaskBuilder().addTypes(BlockTypes.LAVA, BlockTypes.WATER).build(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,6 +27,7 @@ import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.OutputExtent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
@ -230,6 +231,12 @@ public class BaseBlock implements BlockStateHolder<BaseBlock>, TileEntityBlock {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTileEntity(OutputExtent output, int x, int y, int z) {
|
||||
CompoundTag nbt = getNbtData();
|
||||
if (nbt != null) output.setTile(x, y, z, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock withPropertyId(int propertyId) {
|
||||
return getBlockType().withPropertyId(propertyId).toBaseBlock(getNbtData());
|
||||
|
@ -32,7 +32,7 @@ import java.util.Set;
|
||||
* blocks such as wool into separate ids.
|
||||
*/
|
||||
public class BlockCategory extends Category<BlockType> implements Keyed {
|
||||
|
||||
private boolean[] flat_map;
|
||||
public static final NamespacedRegistry<BlockCategory> REGISTRY = new NamespacedRegistry<>("block tag");
|
||||
|
||||
public BlockCategory(final String id) {
|
||||
@ -41,9 +41,19 @@ public class BlockCategory extends Category<BlockType> implements Keyed {
|
||||
|
||||
@Override
|
||||
protected Set<BlockType> load() {
|
||||
return WorldEdit.getInstance().getPlatformManager()
|
||||
Set<BlockType> result = WorldEdit.getInstance().getPlatformManager()
|
||||
.queryCapability(Capability.GAME_HOOKS).getRegistries()
|
||||
.getBlockCategoryRegistry().getAll(this);
|
||||
|
||||
int max = -1;
|
||||
for (BlockType type : result) {
|
||||
max = Math.max(max, type.getInternalId());
|
||||
}
|
||||
this.flat_map = new boolean[max + 1];
|
||||
for (BlockType type : result) {
|
||||
this.flat_map[type.getInternalId()] = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,6 +64,7 @@ public class BlockCategory extends Category<BlockType> implements Keyed {
|
||||
* @return If it's a part of this category
|
||||
*/
|
||||
public <B extends BlockStateHolder<B>> boolean contains(B blockStateHolder) {
|
||||
return this.getAll().contains(blockStateHolder.getBlockType());
|
||||
int typeId = blockStateHolder.getBlockType().getInternalId();
|
||||
return flat_map.length > typeId && flat_map[typeId];
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.OutputExtent;
|
||||
import com.sk89q.worldedit.function.pattern.FawePattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
@ -225,6 +226,11 @@ public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||
return this.toBaseBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTileEntity(OutputExtent output, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The internal id with no type information
|
||||
* @return
|
||||
@ -296,7 +302,7 @@ public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||
BlockType type = this.getBlockType();
|
||||
// Lazily initialize the map
|
||||
Map<? extends Property, Object> map = Maps.asMap(type.getPropertiesSet(), (Function<Property, Object>) this::getState);
|
||||
return (Map<Property<?>, Object>) map;
|
||||
return Collections.unmodifiableMap((Map<Property<?>, Object>) map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.world.block;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
||||
import com.sk89q.worldedit.extent.OutputExtent;
|
||||
import com.sk89q.worldedit.function.pattern.FawePattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
@ -153,6 +154,8 @@ public interface BlockStateHolder<B extends BlockStateHolder<B>> extends FawePat
|
||||
return toBaseBlock();
|
||||
}
|
||||
|
||||
void applyTileEntity(OutputExtent output, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Return the name of the title entity ID.
|
||||
*
|
||||
|
@ -25,6 +25,7 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.NullExtent;
|
||||
import com.sk89q.worldedit.function.mask.SingleBlockTypeMask;
|
||||
import com.sk89q.worldedit.function.pattern.FawePattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
@ -287,6 +288,10 @@ public class BlockType implements FawePattern, Keyed {
|
||||
return this.getDefaultState().toBaseBlock();
|
||||
}
|
||||
|
||||
public SingleBlockTypeMask toMask() {
|
||||
return toMask(new NullExtent());
|
||||
}
|
||||
|
||||
public SingleBlockTypeMask toMask(Extent extent) {
|
||||
return new SingleBlockTypeMask(extent, this);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public final class BlockTypes {
|
||||
// Doesn't really matter what the hardcoded values are, as FAWE will update it on load
|
||||
@Nullable public static final BlockType __RESERVED__ = null;
|
||||
@Nullable public static final BlockType __RESERVED__ = null; // Placeholder for null index (i.e. when block types are represented as primitives)
|
||||
@Nullable public static final BlockType ACACIA_BUTTON = null;
|
||||
@Nullable public static final BlockType ACACIA_DOOR = null;
|
||||
@Nullable public static final BlockType ACACIA_FENCE = null;
|
||||
@ -931,10 +931,6 @@ public final class BlockTypes {
|
||||
}
|
||||
}
|
||||
|
||||
// Add to $Registry
|
||||
// for (BlockType type : values) {
|
||||
// BlockType.REGISTRY.register(type.getId().toLowerCase(Locale.ROOT), type);
|
||||
// }
|
||||
states = stateList.toArray(new BlockState[stateList.size()]);
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.beta.FilterBlock;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.OutputExtent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
|
||||
@ -35,6 +36,11 @@ public final class ImmutableBaseBlock extends BaseBlock {
|
||||
return set.setBlock(extent, toBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTileEntity(OutputExtent output, int x, int y, int z) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V> BaseBlock with(Property<V> property, V value) {
|
||||
return toImmutableState().with(property, value).toBaseBlock();
|
||||
|
Reference in New Issue
Block a user