Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getX()
- getY()
- getZ()
- getAnchorX()
- getAnchorY()
- getAnchorZ()
- getSelectionMin()
- getSelectionMax()
- hasSelectionBounds()
- getBlockCount()
- getFluidCount()
- getTintCount()
- getSelectionVolume()
- getEntityCount()
- setPosition(int, int, int)
- setAnchorAtWorldPos(int, int, int)
- setAnchor(int, int, int)
- setSelectionArea(Vector3ic, Vector3ic)
- setPrefabId(int)
- getPrefabId()
- copyPropertiesFrom(BlockSelection)
- compare(BlockSelection.BlockComparingIterator)
- hasBlockAtWorldPos(int, int, int)
- hasBlockAtLocalPos(int, int, int)
- getBlockAtWorldPos(int, int, int)
- getBlockHolderAtWorldPos(int, int, int)
- getFluidAtWorldPos(int, int, int)
- getFluidLevelAtWorldPos(int, int, int)
- getSupportValueAtWorldPos(int, int, int)
- getStateAtWorldPos(int, int, int)
- forEachBlock(BlockSelection.BlockIterator)
- addTintAtLocalPos(int, int, int)
- addTintAtWorldPos(int, int, int)
- getTintAtWorldPos(int, int)
- hasTintAtWorldPos(int, int)
- forEachTint(BlockSelection.TintIterator)
- forEachFluid(BlockSelection.FluidIterator)
- forEachEntity(Consumer)
- addEmptyAtWorldPos(int, int, int)
- addBlockAtWorldPos(int, int, int, int, int, int, int)
- addBlockAtWorldPos(int, int, int, int, int, int, int, Holder)
- addBlockAtLocalPos(int, int, int, int, int, int, int)
- addBlockAtLocalPos(int, int, int, int, int, int, int, Holder)
- beginHolderInterning()
- endHolderInterning()
- trimToSize()
- addFluidAtWorldPos(int, int, int, int, byte)
- addFluidAtLocalPos(int, int, int, int, byte)
- reserializeBlockStates(ChunkStore, boolean)
- clearAllSupportValues()
- setAllSupportValues(int)
- setSupportValueAtLocalPos(int, int, int, int)
- addEntityFromWorld(Holder)
- addEntityHolderRaw(Holder)
- sortEntitiesByPosition()
- placeNoReturn(World, Vector3i, ComponentAccessor)
- placeNoReturn(String, CommandSender, World, ComponentAccessor)
- placeNoReturn(String, CommandSender, FeedbackConsumer, World, ComponentAccessor)
- placeNoReturn(String, CommandSender, FeedbackConsumer, World, Vector3ic, BlockMask, ComponentAccessor)
- computePlacementBounds(Vector3ic, Vector3i, Vector3i)
- place(CommandSender, World)
- place(CommandSender, World, BlockMask)
- place(CommandSender, World, Vector3ic, BlockMask)
- place(CommandSender, World, Vector3ic, BlockMask, Consumer)
- place(CommandSender, World, Vector3ic, BlockMask, Consumer, boolean)
- place(CommandSender, World, Vector3ic, BlockMask, Consumer, boolean, IntUnaryOperator)
- place(CommandSender, World, Vector3ic, BlockMask, Consumer, boolean, IntUnaryOperator, boolean)
- rotate(Axis, int)
- rotate(Axis, int, RotateBlockMode)
- rotate(Axis, int, Vector3d)
- rotateArbitrary(float, float, float)
- flip(Axis)
- relativize()
- relativize(int, int, int)
- relativizeInPlace()
- relativizeInPlace(int, int, int)
- cloneSelection()
- add(BlockSelection)
- toMetricResults()
- toPacket()
- toClipboardEntityChange(Holder, double, double, double)
- toEditorSelectionBounds()
- toSelectionPacket()
- toBoundsOnlyPacket()
- toShapePacket(int)
- toPacketWithSelection()
- tryFixFiller(boolean)
- reserializeEntities(Store, boolean)
- toString()
Class BlockSelection
java.lang.Object
com.hypixel.hytale.server.core.prefab.selection.standard.BlockSelection
- All Implemented Interfaces:
MetricProvider, NetworkSerializable<EditorBlocksChange>
public class BlockSelection
extends Object
implements NetworkSerializable<EditorBlocksChange>, MetricProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final recordstatic interfacestatic enumstatic final recordstatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Consumer<Ref<EntityStore>> static final MetricsRegistry<BlockSelection> -
Constructor Summary
ConstructorsConstructorDescriptionBlockSelection(int initialBlockCapacity, int initialEntityCapacity) BlockSelection(BlockSelection other) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(BlockSelection other) voidaddBlockAtLocalPos(int x, int y, int z, int block, int rotation, int filler, int supportValue) voidaddBlockAtLocalPos(int x, int y, int z, int block, int rotation, int filler, int supportValue, Holder<ChunkStore> state) voidaddBlockAtWorldPos(int x, int y, int z, int block, int rotation, int filler, int supportValue) voidaddBlockAtWorldPos(int x, int y, int z, int block, int rotation, int filler, int supportValue, Holder<ChunkStore> state) voidaddEmptyAtWorldPos(int x, int y, int z) voidaddEntityFromWorld(Holder<EntityStore> entityHolder) voidaddEntityHolderRaw(Holder<EntityStore> entityHolder) voidaddFluidAtLocalPos(int x, int y, int z, int fluidId, byte fluidLevel) voidaddFluidAtWorldPos(int x, int y, int z, int fluidId, byte fluidLevel) voidaddTintAtLocalPos(int x, int z, int color) voidaddTintAtWorldPos(int worldX, int worldZ, int color) voidvoidbooleancompare(BlockSelection.BlockComparingIterator iterator) booleancomputePlacementBounds(org.joml.Vector3ic position, org.joml.Vector3i minOut, org.joml.Vector3i maxOut) Computes the world bounds thatplace(CommandSender, World)writes to.voidcopyPropertiesFrom(BlockSelection other) voidvoidforEachBlock(BlockSelection.BlockIterator iterator) voidforEachEntity(Consumer<Holder<EntityStore>> consumer) voidforEachFluid(BlockSelection.FluidIterator iterator) voidforEachTint(BlockSelection.TintIterator iterator) intintintintgetBlockAtWorldPos(int x, int y, int z) intgetBlockHolderAtWorldPos(int x, int y, int z) intintgetFluidAtWorldPos(int x, int y, int z) intbytegetFluidLevelAtWorldPos(int x, int y, int z) intorg.joml.Vector3iorg.joml.Vector3ilonggetStateAtWorldPos(int x, int y, int z) intgetSupportValueAtWorldPos(int x, int y, int z) intgetTintAtWorldPos(int worldX, int worldZ) intintgetX()intgetY()intgetZ()booleanhasBlockAtLocalPos(int x, int y, int z) booleanhasBlockAtWorldPos(int x, int y, int z) booleanbooleanhasTintAtWorldPos(int worldX, int worldZ) place(CommandSender feedback, World outerWorld) place(CommandSender feedback, World outerWorld, BlockMask blockMask) place(CommandSender feedback, World outerWorld, org.joml.Vector3ic position, BlockMask blockMask) place(CommandSender feedback, World outerWorld, org.joml.Vector3ic position, BlockMask blockMask, Consumer<Ref<EntityStore>> entityConsumer) place(CommandSender feedback, World outerWorld, org.joml.Vector3ic position, BlockMask blockMask, Consumer<Ref<EntityStore>> entityConsumer, boolean skipEmptyBlocks) place(CommandSender feedback, World outerWorld, org.joml.Vector3ic position, BlockMask blockMask, Consumer<Ref<EntityStore>> entityConsumer, boolean skipEmptyBlocks, IntUnaryOperator blockIdMapper) place(CommandSender feedback, World outerWorld, org.joml.Vector3ic position, BlockMask blockMask, Consumer<Ref<EntityStore>> entityConsumer, boolean skipEmptyBlocks, IntUnaryOperator blockIdMapper, boolean skipEmptyBlocksBeforeMapping) voidplaceNoReturn(World world, org.joml.Vector3i position, ComponentAccessor<EntityStore> componentAccessor) voidplaceNoReturn(String feedbackKey, CommandSender feedback, FeedbackConsumer feedbackConsumer, World outerWorld, ComponentAccessor<EntityStore> componentAccessor) voidplaceNoReturn(String feedbackKey, CommandSender feedback, FeedbackConsumer feedbackConsumer, World outerWorld, org.joml.Vector3ic position, BlockMask blockMask, ComponentAccessor<EntityStore> componentAccessor) voidplaceNoReturn(String feedbackKey, CommandSender feedback, World outerWorld, ComponentAccessor<EntityStore> componentAccessor) relativize(int originX, int originY, int originZ) voidRelativizes this selection against its anchor in place.voidrelativizeInPlace(int originX, int originY, int originZ) voidreserializeBlockStates(ChunkStore store, boolean destructive) voidreserializeEntities(Store<EntityStore> store, boolean destructive) rotate(Axis axis, int angle, RotateBlockMode rotateBlockMode) Rotates the selection by the given angle around the given axis.rotateArbitrary(float yawDegrees, float pitchDegrees, float rollDegrees) Rotates the selection by arbitrary yaw, pitch, and roll angles in degrees.voidsetAllSupportValues(int supportValue) voidsetAnchor(int anchorX, int anchorY, int anchorZ) voidsetAnchorAtWorldPos(int anchorX, int anchorY, int anchorZ) voidsetPosition(int x, int y, int z) voidsetPrefabId(int id) voidsetSelectionArea(org.joml.Vector3ic min, org.joml.Vector3ic max) voidsetSupportValueAtLocalPos(int x, int y, int z, int supportValue) voidstatic ClipboardEntityChangetoClipboardEntityChange(Holder<EntityStore> holder, double anchorX, double anchorY, double anchorZ) toPacket()toShapePacket(int maxVolume) toString()voidvoidtryFixFiller(boolean allowDestructive)
-
Field Details
-
DEFAULT_ENTITY_CONSUMER
-
METRICS_REGISTRY
-
-
Constructor Details
-
BlockSelection
public BlockSelection() -
BlockSelection
public BlockSelection(int initialBlockCapacity, int initialEntityCapacity) -
BlockSelection
-
-
Method Details
-
getX
public int getX() -
getY
public int getY() -
getZ
public int getZ() -
getAnchorX
public int getAnchorX() -
getAnchorY
public int getAnchorY() -
getAnchorZ
public int getAnchorZ() -
getSelectionMin
@Nonnull public org.joml.Vector3i getSelectionMin() -
getSelectionMax
@Nonnull public org.joml.Vector3i getSelectionMax() -
hasSelectionBounds
public boolean hasSelectionBounds() -
getBlockCount
public int getBlockCount() -
getFluidCount
public int getFluidCount() -
getTintCount
public int getTintCount() -
getSelectionVolume
public long getSelectionVolume() -
getEntityCount
public int getEntityCount() -
setPosition
public void setPosition(int x, int y, int z) -
setAnchorAtWorldPos
public void setAnchorAtWorldPos(int anchorX, int anchorY, int anchorZ) -
setAnchor
public void setAnchor(int anchorX, int anchorY, int anchorZ) -
setSelectionArea
public void setSelectionArea(@Nonnull org.joml.Vector3ic min, @Nonnull org.joml.Vector3ic max) -
setPrefabId
public void setPrefabId(int id) -
getPrefabId
public int getPrefabId() -
copyPropertiesFrom
-
compare
-
hasBlockAtWorldPos
public boolean hasBlockAtWorldPos(int x, int y, int z) -
hasBlockAtLocalPos
public boolean hasBlockAtLocalPos(int x, int y, int z) -
getBlockAtWorldPos
public int getBlockAtWorldPos(int x, int y, int z) -
getBlockHolderAtWorldPos
-
getFluidAtWorldPos
public int getFluidAtWorldPos(int x, int y, int z) -
getFluidLevelAtWorldPos
public byte getFluidLevelAtWorldPos(int x, int y, int z) -
getSupportValueAtWorldPos
public int getSupportValueAtWorldPos(int x, int y, int z) -
getStateAtWorldPos
-
forEachBlock
-
addTintAtLocalPos
public void addTintAtLocalPos(int x, int z, int color) -
addTintAtWorldPos
public void addTintAtWorldPos(int worldX, int worldZ, int color) -
getTintAtWorldPos
public int getTintAtWorldPos(int worldX, int worldZ) -
hasTintAtWorldPos
public boolean hasTintAtWorldPos(int worldX, int worldZ) -
forEachTint
-
forEachFluid
-
forEachEntity
-
addEmptyAtWorldPos
public void addEmptyAtWorldPos(int x, int y, int z) -
addBlockAtWorldPos
public void addBlockAtWorldPos(int x, int y, int z, int block, int rotation, int filler, int supportValue) -
addBlockAtWorldPos
public void addBlockAtWorldPos(int x, int y, int z, int block, int rotation, int filler, int supportValue, Holder<ChunkStore> state) -
addBlockAtLocalPos
public void addBlockAtLocalPos(int x, int y, int z, int block, int rotation, int filler, int supportValue) -
addBlockAtLocalPos
public void addBlockAtLocalPos(int x, int y, int z, int block, int rotation, int filler, int supportValue, Holder<ChunkStore> state) -
beginHolderInterning
public void beginHolderInterning() -
endHolderInterning
public void endHolderInterning() -
trimToSize
public void trimToSize() -
addFluidAtWorldPos
public void addFluidAtWorldPos(int x, int y, int z, int fluidId, byte fluidLevel) -
addFluidAtLocalPos
public void addFluidAtLocalPos(int x, int y, int z, int fluidId, byte fluidLevel) -
reserializeBlockStates
-
clearAllSupportValues
public void clearAllSupportValues() -
setAllSupportValues
public void setAllSupportValues(int supportValue) -
setSupportValueAtLocalPos
public void setSupportValueAtLocalPos(int x, int y, int z, int supportValue) -
addEntityFromWorld
-
addEntityHolderRaw
-
sortEntitiesByPosition
public void sortEntitiesByPosition() -
placeNoReturn
public void placeNoReturn(@Nonnull World world, org.joml.Vector3i position, ComponentAccessor<EntityStore> componentAccessor) -
placeNoReturn
public void placeNoReturn(String feedbackKey, CommandSender feedback, @Nonnull World outerWorld, ComponentAccessor<EntityStore> componentAccessor) -
placeNoReturn
public void placeNoReturn(String feedbackKey, CommandSender feedback, @Nonnull FeedbackConsumer feedbackConsumer, @Nonnull World outerWorld, ComponentAccessor<EntityStore> componentAccessor) -
placeNoReturn
public void placeNoReturn(@Nullable String feedbackKey, @Nullable CommandSender feedback, @Nonnull FeedbackConsumer feedbackConsumer, @Nonnull World outerWorld, @Nullable org.joml.Vector3ic position, @Nullable BlockMask blockMask, ComponentAccessor<EntityStore> componentAccessor) -
computePlacementBounds
public boolean computePlacementBounds(@Nullable org.joml.Vector3ic position, @Nonnull org.joml.Vector3i minOut, @Nonnull org.joml.Vector3i maxOut) Computes the world bounds thatplace(CommandSender, World)writes to. Blocks and fluids move by the position and the anchor. Tints move by the selection position only.- Returns:
- false if the selection holds no cells. The output vectors then stay unchanged.
-
place
-
place
@Nonnull public BlockSelection place(CommandSender feedback, @Nonnull World outerWorld, BlockMask blockMask) -
place
@Nonnull public BlockSelection place(CommandSender feedback, @Nonnull World outerWorld, org.joml.Vector3ic position, BlockMask blockMask) -
place
@Nonnull public BlockSelection place(CommandSender feedback, @Nonnull World outerWorld, @Nullable org.joml.Vector3ic position, @Nullable BlockMask blockMask, @Nonnull Consumer<Ref<EntityStore>> entityConsumer) -
place
@Nonnull public BlockSelection place(CommandSender feedback, @Nonnull World outerWorld, @Nullable org.joml.Vector3ic position, @Nullable BlockMask blockMask, @Nonnull Consumer<Ref<EntityStore>> entityConsumer, boolean skipEmptyBlocks) -
place
@Nonnull public BlockSelection place(CommandSender feedback, @Nonnull World outerWorld, @Nullable org.joml.Vector3ic position, @Nullable BlockMask blockMask, @Nonnull Consumer<Ref<EntityStore>> entityConsumer, boolean skipEmptyBlocks, @Nullable IntUnaryOperator blockIdMapper) -
place
@Nonnull public BlockSelection place(CommandSender feedback, @Nonnull World outerWorld, @Nullable org.joml.Vector3ic position, @Nullable BlockMask blockMask, @Nonnull Consumer<Ref<EntityStore>> entityConsumer, boolean skipEmptyBlocks, @Nullable IntUnaryOperator blockIdMapper, boolean skipEmptyBlocksBeforeMapping) -
rotate
-
rotate
@Nonnull public BlockSelection rotate(@Nonnull Axis axis, int angle, @Nonnull RotateBlockMode rotateBlockMode) Rotates the selection by the given angle around the given axis.- Parameters:
rotateBlockMode- controls which blocks have their orientation rotated:"All"– all blocks usecomposeOnAxis(default);"NonFullBlocks"– only blocks whose hitbox is not"Full"are rotated;"NonUniform"– only blocks with non-uniform cube textures are rotated (i.e. blocks that look different from different angles); uniform blocks like cobblestone or gravel keep their orientation while directional blocks like logs and grass do rotate;"Nothing"– block positions move but all orientations are preserved.
-
rotate
@Nonnull public BlockSelection rotate(@Nonnull Axis axis, int angle, @Nonnull org.joml.Vector3d originOfRotation) -
rotateArbitrary
@Nonnull public BlockSelection rotateArbitrary(float yawDegrees, float pitchDegrees, float rollDegrees) Rotates the selection by arbitrary yaw, pitch, and roll angles in degrees.This method uses inverse mapping (destination-to-source) to ensure no gaps in the output. For each position in the destination bounding box, the inverse rotation is applied to find the corresponding source position, then the nearest source block is sampled.
Block-level rotation metadata is snapped to the nearest 90-degree increments since individual blocks only support 90-degree rotation steps.
- Parameters:
yawDegrees- Rotation around the Y-axis (vertical) in degreespitchDegrees- Rotation around the X-axis in degreesrollDegrees- Rotation around the Z-axis in degrees- Returns:
- A new BlockSelection containing the rotated blocks
-
flip
-
relativize
-
relativize
-
relativizeInPlace
public void relativizeInPlace()Relativizes this selection against its anchor in place. Unlikerelativize()this mutates the selection and reuses its holders instead of allocating a full copy, so it must only be called on a selection that is not shared with anything else. -
relativizeInPlace
public void relativizeInPlace(int originX, int originY, int originZ) -
cloneSelection
-
add
-
toMetricResults
- Specified by:
toMetricResultsin interfaceMetricProvider
-
toPacket
- Specified by:
toPacketin interfaceNetworkSerializable<EditorBlocksChange>
-
toClipboardEntityChange
@Nullable public static ClipboardEntityChange toClipboardEntityChange(@Nonnull Holder<EntityStore> holder, double anchorX, double anchorY, double anchorZ) -
toEditorSelectionBounds
-
toSelectionPacket
-
toBoundsOnlyPacket
-
toShapePacket
-
toPacketWithSelection
-
tryFixFiller
public void tryFixFiller(boolean allowDestructive) -
reserializeEntities
public void reserializeEntities(@Nonnull Store<EntityStore> store, boolean destructive) throws IOException - Throws:
IOException
-
toString
-