Class LayerManager
java.lang.Object
fr.rodofire.ewc.shape.block.layer.LayerManager
- All Implemented Interfaces:
Layer
Class to assign BlockStates based on coordinates.
For that, we need a
BlockLayerManager.
It allows us to define which blocks will go where.
This class will choose which block to assign depending on LayerManager.Type.
For example based on this shape:
BlockLayer layer1, layer2, layer3
BlockLayerManager manager = new BlockLayerManager(
List.of(layer1, layer2, layer3),
List.of((short)1, (short)2, (short)5
);
LayerManager layerManager = new LayerManager(Type.SURFACE, manager);
The layer assignement will result on this:
* * * 1 1 1
* * * * * * 1 1 2 2 2 1
* * * * * * * 1 2 2 2 2 2 2
* * * * * * * -> 2 2 2 3 3 3 2
* * * * * * * * 2 3 3 3 3 3 3 1
* * * * * * * * 3 3 3 3 3 3 3 2
Then, after choosing the layer, we choose which block of the layer will be placed.
For more information, see BlockLayer-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.minecraft.world.phys.Vec3protected net.minecraft.core.Vec3i -
Constructor Summary
ConstructorsConstructorDescriptionLayerManager(LayerManager.Type layerType, BlockLayerManager blockLayerManager) LayerManager(LayerManager.Type layerType, BlockLayerManager blockLayerManager, net.minecraft.world.phys.Vec3 centerPos) LayerManager(LayerManager.Type layerType, BlockLayerManager blockLayerManager, net.minecraft.world.phys.Vec3 centerPos, net.minecraft.core.Vec3i directionVector) -
Method Summary
Modifier and TypeMethodDescription<T extends Collection<net.minecraft.core.BlockPos>>
BlockListManagerget(T posList) <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection>
BlockListManagerget(U posList) net.minecraft.world.phys.Vec3net.minecraft.world.phys.Vec3getDivided(Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) <T extends Collection<net.minecraft.core.BlockPos>>
DividedBlockListManagergetDivided(T posList) <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection>
DividedBlockListManagergetDivided(U posList) getVerified(net.minecraft.world.level.WorldGenLevel world, Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) <T extends Collection<net.minecraft.core.BlockPos>>
BlockListManagergetVerified(net.minecraft.world.level.WorldGenLevel world, T posList) <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection>
BlockListManagergetVerified(net.minecraft.world.level.WorldGenLevel world, U posList) getVerifiedDivided(net.minecraft.world.level.WorldGenLevel world, Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) <T extends Collection<net.minecraft.core.BlockPos>>
DividedBlockListManagergetVerifiedDivided(net.minecraft.world.level.WorldGenLevel world, T posList) <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection>
DividedBlockListManagergetVerifiedDivided(net.minecraft.world.level.WorldGenLevel world, U posList) voidplace(net.minecraft.world.level.WorldGenLevel world, Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) <T extends Collection<net.minecraft.core.BlockPos>>
voidplace(net.minecraft.world.level.WorldGenLevel world, T posList) <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection>
voidplace(net.minecraft.world.level.WorldGenLevel world, U posList) voidsetCenterPos(net.minecraft.world.phys.Vec3 centerPos) voidsetDirectionVector(net.minecraft.core.Vec3i directionVector)
-
Field Details
-
centerPos
protected net.minecraft.world.phys.Vec3 centerPos -
directionVector
protected net.minecraft.core.Vec3i directionVector
-
-
Constructor Details
-
LayerManager
-
LayerManager
public LayerManager(LayerManager.Type layerType, BlockLayerManager blockLayerManager, net.minecraft.world.phys.Vec3 centerPos) -
LayerManager
public LayerManager(LayerManager.Type layerType, BlockLayerManager blockLayerManager, net.minecraft.world.phys.Vec3 centerPos, net.minecraft.core.Vec3i directionVector)
-
-
Method Details
-
get
public BlockListManager get(Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) -
place
public void place(net.minecraft.world.level.WorldGenLevel world, Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) -
getVerified
public BlockListManager getVerified(net.minecraft.world.level.WorldGenLevel world, Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) - Specified by:
getVerifiedin interfaceLayer
-
getDivided
public DividedBlockListManager getDivided(Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) - Specified by:
getDividedin interfaceLayer
-
getVerifiedDivided
public DividedBlockListManager getVerifiedDivided(net.minecraft.world.level.WorldGenLevel world, Map<net.minecraft.world.level.ChunkPos, it.unimi.dsi.fastutil.longs.LongOpenHashSet> posMap) - Specified by:
getVerifiedDividedin interfaceLayer
-
get
-
place
public <T extends Collection<net.minecraft.core.BlockPos>> void place(net.minecraft.world.level.WorldGenLevel world, T posList) -
getVerified
public <T extends Collection<net.minecraft.core.BlockPos>> BlockListManager getVerified(net.minecraft.world.level.WorldGenLevel world, T posList) - Specified by:
getVerifiedin interfaceLayer
-
getDivided
public <T extends Collection<net.minecraft.core.BlockPos>> DividedBlockListManager getDivided(T posList) - Specified by:
getDividedin interfaceLayer
-
getVerifiedDivided
public <T extends Collection<net.minecraft.core.BlockPos>> DividedBlockListManager getVerifiedDivided(net.minecraft.world.level.WorldGenLevel world, T posList) - Specified by:
getVerifiedDividedin interfaceLayer
-
get
public <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection> BlockListManager get(U posList) -
place
public <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection> void place(net.minecraft.world.level.WorldGenLevel world, U posList) -
getVerified
public <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection> BlockListManager getVerified(net.minecraft.world.level.WorldGenLevel world, U posList) - Specified by:
getVerifiedin interfaceLayer
-
getDivided
public <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection> DividedBlockListManager getDivided(U posList) - Specified by:
getDividedin interfaceLayer
-
getVerifiedDivided
public <U extends it.unimi.dsi.fastutil.longs.AbstractLongCollection> DividedBlockListManager getVerifiedDivided(net.minecraft.world.level.WorldGenLevel world, U posList) - Specified by:
getVerifiedDividedin interfaceLayer
-
getCenterPos
public net.minecraft.world.phys.Vec3 getCenterPos()- Specified by:
getCenterPosin interfaceLayer
-
setCenterPos
public void setCenterPos(net.minecraft.world.phys.Vec3 centerPos) - Specified by:
setCenterPosin interfaceLayer
-
getDirectionVector
public net.minecraft.world.phys.Vec3 getDirectionVector()- Specified by:
getDirectionVectorin interfaceLayer
-
setDirectionVector
public void setDirectionVector(net.minecraft.core.Vec3i directionVector) - Specified by:
setDirectionVectorin interfaceLayer
-