Class Contraption
java.lang.Object
com.simibubi.create.content.contraptions.Contraption
- Direct Known Subclasses:
BearingContraption,CarriageContraption,ClockworkContraption,MountedContraption,StabilizedContraption,TranslatingContraption
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<org.apache.commons.lang3.tuple.MutablePair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo, MovementContext>> net.minecraft.core.BlockPosprotected Map<net.minecraft.core.BlockPos, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo> net.minecraft.world.phys.AABBprotected com.google.common.collect.Multimap<net.minecraft.core.BlockPos, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo> protected ContraptionWorldprotected List<net.minecraft.world.item.ItemStack> booleanbooleanprotected Map<net.minecraft.core.BlockPos, MovingInteractionBehaviour> it.unimi.dsi.fastutil.objects.Object2BooleanMap<net.minecraft.core.BlockPos> protected List<net.minecraft.core.BlockPos> booleanprotected MountedStorageManagerprotected List<net.minecraft.world.phys.AABB> protected Map<net.minecraft.core.BlockPos, net.minecraft.nbt.CompoundTag> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddBlock(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, org.apache.commons.lang3.tuple.Pair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo, net.minecraft.world.level.block.entity.BlockEntity> pair) voidaddBlocksToWorld(net.minecraft.world.level.Level world, StructureTransform transform) voidaddPassengersToWorld(net.minecraft.world.level.Level world, StructureTransform transform, List<net.minecraft.world.entity.Entity> seatedEntities) protected booleanaddToInitialFrontier(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction forcedDirection, Queue<net.minecraft.core.BlockPos> frontier) abstract booleanassemble(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) abstract booleancanBeStabilized(net.minecraft.core.Direction facing, net.minecraft.core.BlockPos localPos) protected org.apache.commons.lang3.tuple.Pair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo, net.minecraft.world.level.block.entity.BlockEntity> capture(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) protected voidcaptureMultiblock(net.minecraft.core.BlockPos localPos, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo structureBlockInfo, net.minecraft.world.level.block.entity.BlockEntity be) booleanprotected ClientContraptionCreate a newClientContraptioninstance.protected booleancustomBlockPlacement(net.minecraft.world.level.LevelAccessor world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) protected booleancustomBlockRemoval(net.minecraft.world.level.LevelAccessor world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) protected voiddisableActorOnStart(MovementContext context) voidexpandBoundsAroundAxis(net.minecraft.core.Direction.Axis axis) voidforEachActor(net.minecraft.world.level.Level world, BiConsumer<MovementBehaviour, MovementContext> callBack) static ContraptionfromNBT(net.minecraft.world.level.Level world, net.minecraft.nbt.CompoundTag nbt, boolean spawnData) @Nullable org.apache.commons.lang3.tuple.MutablePair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo, MovementContext> getActorAt(net.minecraft.core.BlockPos localPos) List<org.apache.commons.lang3.tuple.MutablePair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo, MovementContext>> net.minecraft.core.BlockPosgetBearingPosOf(UUID subContraptionEntityId) @Nullable net.minecraft.world.level.block.entity.BlockEntitygetBlockEntityClientSide(net.minecraft.core.BlockPos localPos) protected @Nullable net.minecraft.nbt.CompoundTaggetBlockEntityNBT(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) Map<net.minecraft.core.BlockPos, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo> List<net.minecraft.world.item.ItemStack> Map<net.minecraft.core.BlockPos, MovingInteractionBehaviour> it.unimi.dsi.fastutil.objects.Object2BooleanMap<net.minecraft.core.BlockPos> final ClientContraptionSee the docs onclientContraption.static doublegetRadius(Iterable<? extends net.minecraft.core.Vec3i> blocks, net.minecraft.core.Direction.Axis axis) net.minecraft.core.BlockPosList<net.minecraft.core.BlockPos> getSeats()abstract ContraptionTypegetType()voidInvalidate the children of the client contraption, triggering a rebuild of all child visuals.voidInvalidate the structure of the client contraption, triggering a rebuild of the main mesh.voidbooleanisActorTypeDisabled(net.minecraft.world.item.ItemStack filter) protected booleanisAnchoringBlockAt(net.minecraft.core.BlockPos pos) booleanisHiddenInPortal(net.minecraft.core.BlockPos localPos) protected booleanmoveBlock(net.minecraft.world.level.Level world, @Nullable net.minecraft.core.Direction forcedDirection, Queue<net.minecraft.core.BlockPos> frontier, Set<net.minecraft.core.BlockPos> visited) move the first block in frontier queueprotected voidmoveGantryPinion(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, Queue<net.minecraft.core.BlockPos> frontier, Set<net.minecraft.core.BlockPos> visited, net.minecraft.world.level.block.state.BlockState state) protected voidmoveGantryShaft(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, Queue<net.minecraft.core.BlockPos> frontier, Set<net.minecraft.core.BlockPos> visited, net.minecraft.world.level.block.state.BlockState state) protected booleanmovementAllowed(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) protected voidmovePistonHead(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, Queue<net.minecraft.core.BlockPos> frontier, Set<net.minecraft.core.BlockPos> visited, net.minecraft.world.level.block.state.BlockState state) protected voidmovePistonPole(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, Queue<net.minecraft.core.BlockPos> frontier, Set<net.minecraft.core.BlockPos> visited, net.minecraft.world.level.block.state.BlockState state) voidvoidonEntityInitialize(net.minecraft.world.level.Level world, AbstractContraptionEntity contraptionEntity) voidvoidreadNBT(net.minecraft.world.level.Level world, net.minecraft.nbt.CompoundTag nbt, boolean spawnData) voidremoveBlocksFromWorld(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos offset) voidEntirely reset the client contraption, rebuilding the client level and re-running light updates.booleansearchMovedStructure(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.core.Direction forcedDirection) voidsetActorsActive(net.minecraft.world.item.ItemStack referenceStack, boolean enable) voidsetSeatMapping(Map<UUID, Integer> seatMapping) protected booleanshouldUpdateAfterMovement(net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo info) voidstartMoving(net.minecraft.world.level.Level world) voidstop(net.minecraft.world.level.Level world) voidtickStorage(AbstractContraptionEntity entity) protected net.minecraft.core.BlockPostoLocalPos(net.minecraft.core.BlockPos globalPos) protected voidtranslateMultiblockControllers(StructureTransform transform) net.minecraft.nbt.CompoundTagwriteNBT(net.minecraft.core.HolderLookup.Provider registries, boolean spawnPacket) voidwriteStorage(net.minecraft.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider registries, boolean spawnPacket)
-
Field Details
-
simplifiedEntityColliders
-
entity
-
bounds
public net.minecraft.world.phys.AABB bounds -
anchor
public net.minecraft.core.BlockPos anchor -
stalled
public boolean stalled -
hasUniversalCreativeCrate
public boolean hasUniversalCreativeCrate -
disassembled
public boolean disassembled -
blocks
protected Map<net.minecraft.core.BlockPos,net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo> blocks -
updateTags
-
isLegacy
public it.unimi.dsi.fastutil.objects.Object2BooleanMap<net.minecraft.core.BlockPos> isLegacy -
actors
protected List<org.apache.commons.lang3.tuple.MutablePair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo,MovementContext>> actors -
interactors
-
disabledActors
-
superglue
-
seats
-
seatMapping
-
stabilizedSubContraptions
-
storage
-
capturedMultiblocks
protected com.google.common.collect.Multimap<net.minecraft.core.BlockPos,net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo> capturedMultiblocks -
collisionLevel
-
-
Constructor Details
-
Contraption
public Contraption()
-
-
Method Details
-
getContraptionWorld
-
assemble
public abstract boolean assemble(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) throws AssemblyException - Throws:
AssemblyException
-
canBeStabilized
public abstract boolean canBeStabilized(net.minecraft.core.Direction facing, net.minecraft.core.BlockPos localPos) -
getType
-
customBlockPlacement
protected boolean customBlockPlacement(net.minecraft.world.level.LevelAccessor world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
customBlockRemoval
protected boolean customBlockRemoval(net.minecraft.world.level.LevelAccessor world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
addToInitialFrontier
protected boolean addToInitialFrontier(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction forcedDirection, Queue<net.minecraft.core.BlockPos> frontier) throws AssemblyException - Throws:
AssemblyException
-
fromNBT
public static Contraption fromNBT(net.minecraft.world.level.Level world, net.minecraft.nbt.CompoundTag nbt, boolean spawnData) -
searchMovedStructure
public boolean searchMovedStructure(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.core.Direction forcedDirection) throws AssemblyException - Throws:
AssemblyException
-
onEntityCreated
-
onEntityRemoved
-
onEntityInitialize
public void onEntityInitialize(net.minecraft.world.level.Level world, AbstractContraptionEntity contraptionEntity) -
moveBlock
protected boolean moveBlock(net.minecraft.world.level.Level world, @Nullable @Nullable net.minecraft.core.Direction forcedDirection, Queue<net.minecraft.core.BlockPos> frontier, Set<net.minecraft.core.BlockPos> visited) throws AssemblyException move the first block in frontier queue- Throws:
AssemblyException
-
movePistonHead
-
movePistonPole
-
moveGantryPinion
-
moveGantryShaft
-
capture
protected org.apache.commons.lang3.tuple.Pair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo,net.minecraft.world.level.block.entity.BlockEntity> capture(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) -
addBlock
protected void addBlock(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, org.apache.commons.lang3.tuple.Pair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo, net.minecraft.world.level.block.entity.BlockEntity> pair) -
captureMultiblock
protected void captureMultiblock(net.minecraft.core.BlockPos localPos, net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo structureBlockInfo, net.minecraft.world.level.block.entity.BlockEntity be) -
getBlockEntityNBT
@Nullable protected @Nullable net.minecraft.nbt.CompoundTag getBlockEntityNBT(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) -
toLocalPos
protected net.minecraft.core.BlockPos toLocalPos(net.minecraft.core.BlockPos globalPos) -
movementAllowed
protected boolean movementAllowed(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos) -
isAnchoringBlockAt
protected boolean isAnchoringBlockAt(net.minecraft.core.BlockPos pos) -
readNBT
public void readNBT(net.minecraft.world.level.Level world, net.minecraft.nbt.CompoundTag nbt, boolean spawnData) -
writeNBT
public net.minecraft.nbt.CompoundTag writeNBT(net.minecraft.core.HolderLookup.Provider registries, boolean spawnPacket) -
writeStorage
public void writeStorage(net.minecraft.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider registries, boolean spawnPacket) -
removeBlocksFromWorld
public void removeBlocksFromWorld(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos offset) -
addBlocksToWorld
-
translateMultiblockControllers
-
addPassengersToWorld
public void addPassengersToWorld(net.minecraft.world.level.Level world, StructureTransform transform, List<net.minecraft.world.entity.Entity> seatedEntities) -
startMoving
public void startMoving(net.minecraft.world.level.Level world) -
disableActorOnStart
-
isActorTypeDisabled
public boolean isActorTypeDisabled(net.minecraft.world.item.ItemStack filter) -
setActorsActive
public void setActorsActive(net.minecraft.world.item.ItemStack referenceStack, boolean enable) -
getDisabledActors
-
stop
public void stop(net.minecraft.world.level.Level world) -
forEachActor
public void forEachActor(net.minecraft.world.level.Level world, BiConsumer<MovementBehaviour, MovementContext> callBack) -
shouldUpdateAfterMovement
protected boolean shouldUpdateAfterMovement(net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo info) -
expandBoundsAroundAxis
public void expandBoundsAroundAxis(net.minecraft.core.Direction.Axis axis) -
getSeatMapping
-
getSeatOf
-
getBearingPosOf
-
setSeatMapping
-
getSeats
-
getBlocks
public Map<net.minecraft.core.BlockPos,net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo> getBlocks() -
getIsLegacy
public it.unimi.dsi.fastutil.objects.Object2BooleanMap<net.minecraft.core.BlockPos> getIsLegacy() -
getActors
public List<org.apache.commons.lang3.tuple.MutablePair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo,MovementContext>> getActors() -
getActorAt
@Nullable public @Nullable org.apache.commons.lang3.tuple.MutablePair<net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo,MovementContext> getActorAt(net.minecraft.core.BlockPos localPos) -
getInteractors
-
invalidateColliders
public void invalidateColliders() -
getRadius
public static double getRadius(Iterable<? extends net.minecraft.core.Vec3i> blocks, net.minecraft.core.Direction.Axis axis) -
getStorage
-
isHiddenInPortal
public boolean isHiddenInPortal(net.minecraft.core.BlockPos localPos) -
getSimplifiedEntityColliders
-
tickStorage
-
containsBlockBreakers
public boolean containsBlockBreakers() -
getOrCreateClientContraptionLazy
See the docs onclientContraption. -
createClientContraption
Create a newClientContraptioninstance. This will only be called once, when the contraption first has its animation processed by either the render thread or a flywheel executor thread.Most contraptions will not need to implement this.
- Returns:
- A new ClientContraption instance.
-
resetClientContraption
public void resetClientContraption()Entirely reset the client contraption, rebuilding the client level and re-running light updates. -
invalidateClientContraptionStructure
public void invalidateClientContraptionStructure()Invalidate the structure of the client contraption, triggering a rebuild of the main mesh. -
invalidateClientContraptionChildren
public void invalidateClientContraptionChildren()Invalidate the children of the client contraption, triggering a rebuild of all child visuals. -
getBlockEntityClientSide
@Nullable public @Nullable net.minecraft.world.level.block.entity.BlockEntity getBlockEntityClientSide(net.minecraft.core.BlockPos localPos)
-