PrefabBuffer

public class PrefabBuffer

Class PrefabBuffer. Provides prefabbuffer functionality for the Hytale server.

java.lang.Object > PrefabBuffer

Field Summary

buf

private ByteBuf buf

Field buf.

anchor

private Vector3i anchor

Field anchor.

columnIndex

final int columnIndex

Field columnIndex.

blockCount

final int blockCount

Field blockCount.

readerIndex

final int readerIndex

Field readerIndex.

offset

final int offset

Field offset.

entry

final PrefabBufferBlockEntry entry

Field entry.

y

final int y

Field y.

blockId

final int blockId

Field blockId.

chance

final float chance

Field chance.

holder

final Holder holder

Field holder.

fluidId

final int fluidId

Field fluidId.

fluidLevel

final byte fluidLevel

Field fluidLevel.

offset2

final int offset2

Field offset2.

hasChance

final boolean hasChance

Field hasChance.

blockBytes

final int blockBytes

Field blockBytes.

offsetBytes

final int offsetBytes

Field offsetBytes.

fluidBytes

final int fluidBytes

Field fluidBytes.

mask

final int mask

Field mask.

column

final PrefabBufferColumn column

Field column.

spawnerState

final PrefabSpawnerState spawnerState

Field spawnerState.

path

final String path

Field path.

weights

final PrefabWeights weights

Field weights.

rotation

final PrefabRotation rotation

Field rotation.

buffer

final ByteBuf buffer

Field buffer.

childPrefabArray

final ChildPrefab[] childPrefabArray

Field childPrefabArray.

rotatedX

final int rotatedX

Field rotatedX.

rotatedZ

final int rotatedZ

Field rotatedZ.

columnData

final PrefabBufferColumn columnData

Field columnData.

cx

final int cx

Field cx.

cz

final int cz

Field cz.

x2

final int x2

Field x2.

z2

final int z2

Field z2.

supportValue

final int supportValue

Field supportValue.

rotation2

final int rotation2

Field rotation2.

entityHolders

final Holder[] entityHolders

Field entityHolders.

x

final int x

Field x.

z

final int z

Field z.

position

final int position

Field position.

position2

final int position2

Field position2.

filler

final int filler

Field filler.

secondPrefabColumns

final Int2ObjectMap secondPrefabColumns

Field secondPrefabColumns.

columnIndexes

final IntOpenHashSet columnIndexes

Field columnIndexes.

columnIterator

final IntIterator columnIterator

Field columnIterator.

firstColumn

final PrefabBufferColumn firstColumn

Field firstColumn.

secondColumn

final PrefabBufferColumn secondColumn

Field secondColumn.

firstColumnBlockCount

final int firstColumnBlockCount

Field firstColumnBlockCount.

secondColumnBlockCount

final int secondColumnBlockCount

Field secondColumnBlockCount.

oldFirstColumnY

final int oldFirstColumnY

Field oldFirstColumnY.

oldSecondColumnY

final int oldSecondColumnY

Field oldSecondColumnY.

oldFirstColumnReaderIndex

final int oldFirstColumnReaderIndex

Field oldFirstColumnReaderIndex.

oldSecondColumnReaderIndex

final int oldSecondColumnReaderIndex

Field oldSecondColumnReaderIndex.

test

final boolean test

Field test.

Method Detail

PrefabBuffer

public private PrefabBuffer (@Nonnull final ByteBuf buf, @Nonnull final Vector3i anchor, @Nonnull final Vector3i min, @Nonnull final Vector3i max, @Nonnull final Int2ObjectMap columns, @Nonnull final ChildPrefab[] childPrefabs)

Method PrefabBuffer.

Parameters:
@Nonnull final ByteBuf buf
@Nonnull final Vector3i anchor
@Nonnull final Vector3i min
@Nonnull final Vector3i max
@Nonnull final Int2ObjectMap columns
@Nonnull final ChildPrefab[] childPrefabs

newBuilder

static Builder newBuilder ()

Method newBuilder.

getAnchorX

public int getAnchorX ()

Method getAnchorX.

getAnchorY

public int getAnchorY ()

Method getAnchorY.

getAnchorZ

public int getAnchorZ ()

Method getAnchorZ.

newAccess

public PrefabBufferAccessor newAccess ()

Method newAccess.

release

public void release ()

Method release.

checkReleased

private void checkReleased ()

Method checkReleased.

getBlockMask

public int getBlockMask (final int blockBytes, final int fluidBytes, final boolean chance, final int offsetBytes, @Nullable final Holder holder, final byte supportValue, final int rotation, final int filler)

Method getBlockMask.

Parameters:
final int blockBytes
final int fluidBytes
final boolean chance
final int offsetBytes
@Nullable final Holder holder
final byte supportValue
final int rotation
final int filler

IllegalArgumentException

public new IllegalArgumentException ("Unsupported amount of bytes for blocks (0, 1, 2, 4)

Method IllegalArgumentException.

Parameters:
"Unsupported amount of bytes for blocks (0
1 1
2 2
4 4

getSkipBytes

public int getSkipBytes (final int mask)

Method getSkipBytes.

Parameters:
final int mask

hasChance

public boolean hasChance (final int mask)

Method hasChance.

Parameters:
final int mask

hasFiller

public boolean hasFiller (final int mask)

Method hasFiller.

Parameters:
final int mask

hasRotation

public boolean hasRotation (final int mask)

Method hasRotation.

Parameters:
final int mask

getBlockBytes

public int getBlockBytes (final int mask)

Method getBlockBytes.

Parameters:
final int mask

switch

public return switch (mask & 0x3)

Method switch.

Parameters:
mask & 0x3

getOffsetBytes

public int getOffsetBytes (final int mask)

Method getOffsetBytes.

Parameters:
final int mask

getFluidBytes

public int getFluidBytes (final int mask)

Method getFluidBytes.

Parameters:
final int mask

getSupportValue

public int getSupportValue (final int mask)

Method getSupportValue.

Parameters:
final int mask

hasComponents

public boolean hasComponents (final int mask)

Method hasComponents.

Parameters:
final int mask

ChildPrefab

public private ChildPrefab (final int x, final int y, final int z, @Nonnull final String path, final boolean fitHeightmap, final boolean inheritSeed, final boolean inheritHeightCondition, @Nonnull final PrefabWeights weights, @Nonnull final PrefabRotation rotation)

Method ChildPrefab.

Parameters:
final int x
final int y
final int z
@Nonnull final String path
final boolean fitHeightmap
final boolean inheritSeed
final boolean inheritHeightCondition
@Nonnull final PrefabWeights weights
@Nonnull final PrefabRotation rotation

getX

public int getX ()

Method getX.

getY

public int getY ()

Method getY.

getZ

public int getZ ()

Method getZ.

getPath

public String getPath ()

Method getPath.

isFitHeightmap

public boolean isFitHeightmap ()

Method isFitHeightmap.

isInheritSeed

public boolean isInheritSeed ()

Method isInheritSeed.

isInheritHeightCondition

public boolean isInheritHeightCondition ()

Method isInheritHeightCondition.

getWeights

public PrefabWeights getWeights ()

Method getWeights.

getRotation

public PrefabRotation getRotation ()

Method getRotation.

setAnchor

public void setAnchor (@Nonnull final Vector3i anchor)

Method setAnchor.

Parameters:
@Nonnull final Vector3i anchor

addColumn

public void addColumn (final int x, final int z, @Nonnull final PrefabBufferBlockEntry[] entries, @Nullable final Holder[] entityHolders)

Method addColumn.

Parameters:
final int x
final int z
@Nonnull final PrefabBufferBlockEntry[] entries
@Nullable final Holder[] entityHolders

handleBlockComponents

private void handleBlockComponents (final int blockRotation, final int x, final int y, final int z, @Nonnull final Holder holder)

Method handleBlockComponents.

Parameters:
final int blockRotation
final int x
final int y
final int z
@Nonnull final Holder holder

addChildPrefab

public void addChildPrefab (final int x, final int y, final int z, @Nonnull final String path, final boolean fitHeightmap, final boolean inheritSeed, final boolean inheritHeightCondition, @Nullable final PrefabWeights weights, @Nonnull final PrefabRotation rotation)

Method addChildPrefab.

Parameters:
final int x
final int y
final int z
@Nonnull final String path
final boolean fitHeightmap
final boolean inheritSeed
final boolean inheritHeightCondition
@Nullable final PrefabWeights weights
@Nonnull final PrefabRotation rotation

newBlockEntry

public PrefabBufferBlockEntry newBlockEntry (final int y)

Method newBlockEntry.

Parameters:
final int y

build

public PrefabBuffer build ()

Method build.

getMinX

public int getMinX (@Nonnull final PrefabRotation rotation)

Method getMinX.

Parameters:
@Nonnull final PrefabRotation rotation

getMinY

public int getMinY ()

Method getMinY.

getMinZ

public int getMinZ (@Nonnull final PrefabRotation rotation)

Method getMinZ.

Parameters:
@Nonnull final PrefabRotation rotation

getMaxX

public int getMaxX (@Nonnull final PrefabRotation rotation)

Method getMaxX.

Parameters:
@Nonnull final PrefabRotation rotation

getMaxY

public int getMaxY ()

Method getMaxY.

getMaxZ

public int getMaxZ (@Nonnull final PrefabRotation rotation)

Method getMaxZ.

Parameters:
@Nonnull final PrefabRotation rotation

getColumnCount

public int getColumnCount ()

Method getColumnCount.

getChildPrefabs

public ChildPrefab[] getChildPrefabs ()

Method getChildPrefabs.

getMinYAt

public int getMinYAt (@Nonnull final PrefabRotation rotation, final int x, final int z)

Method getMinYAt.

Parameters:
@Nonnull final PrefabRotation rotation
final int x
final int z

getMaxYAt

public int getMaxYAt (@Nonnull final PrefabRotation rotation, final int x, final int z)

Method getMaxYAt.

Parameters:
@Nonnull final PrefabRotation rotation
final int x
final int z

forEach

public void forEach (@Nonnull final ColumnPredicate columnPredicate, @Nonnull final BlockConsumer blockConsumer, @Nullable final EntityConsumer entityConsumer, @Nullable final ChildConsumer childConsumer, @Nonnull final T t)

Method forEach.

Parameters:
@Nonnull final ColumnPredicate columnPredicate
@Nonnull final BlockConsumer blockConsumer
@Nullable final EntityConsumer entityConsumer
@Nullable final ChildConsumer childConsumer
@Nonnull final T t

forEachRaw

public void forEachRaw (@Nonnull final ColumnPredicate columnPredicate, @Nonnull final RawBlockConsumer blockConsumer, @Nonnull final FluidConsumer fluidConsumer, @Nullable final EntityConsumer entityConsumer, @Nullable final T t)

Method forEachRaw.

Parameters:
@Nonnull final ColumnPredicate columnPredicate
@Nonnull final RawBlockConsumer blockConsumer
@Nonnull final FluidConsumer fluidConsumer
@Nullable final EntityConsumer entityConsumer
@Nullable final T t

compare

public boolean compare (@Nonnull final BlockComparingPrefabPredicate blockComparingIterator, @Nonnull final T t, @Nonnull final IPrefabBuffer otherPrefab)

Method compare.

Parameters:
@Nonnull final BlockComparingPrefabPredicate blockComparingIterator
@Nonnull final T t
@Nonnull final IPrefabBuffer otherPrefab

IntOpenHashSet

public new IntOpenHashSet (this.prefabBuffer.columns.size()

Method IntOpenHashSet.

Parameters:
this.prefabBuffer.columns.size( this.prefabBuffer.columns.size(

if

public else if ((firstColumnY < secondColumnY && firstColumnBlocksRead < firstColumnBlockCount)

Method if.

Parameters:
(firstColumnY < secondColumnY && firstColumnBlocksRead < firstColumnBlockCount

getBlockId

public int getBlockId (final int x, final int y, final int z)

Method getBlockId.

Parameters:
final int x
final int y
final int z

getFiller

public int getFiller (final int x, final int y, final int z)

Method getFiller.

Parameters:
final int x
final int y
final int z

getRotationIndex

public int getRotationIndex (final int x, final int y, final int z)

Method getRotationIndex.

Parameters:
final int x
final int y
final int z