Class Contraption

java.lang.Object
com.simibubi.create.content.contraptions.Contraption
Direct Known Subclasses:
BearingContraption, CarriageContraption, ClockworkContraption, MountedContraption, StabilizedContraption, TranslatingContraption

public abstract class Contraption extends Object
  • Field Details

    • simplifiedEntityColliders

      public CollisionList 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

      protected Map<net.minecraft.core.BlockPos,net.minecraft.nbt.CompoundTag> 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

      protected Map<net.minecraft.core.BlockPos,MovingInteractionBehaviour> interactors
    • disabledActors

      protected List<net.minecraft.world.item.ItemStack> disabledActors
    • superglue

      protected List<net.minecraft.world.phys.AABB> superglue
    • seats

      protected List<net.minecraft.core.BlockPos> seats
    • seatMapping

      protected Map<UUID,Integer> seatMapping
    • stabilizedSubContraptions

      protected Map<UUID,net.createmod.catnip.math.BlockFace> stabilizedSubContraptions
    • storage

      protected MountedStorageManager storage
    • capturedMultiblocks

      protected com.google.common.collect.Multimap<net.minecraft.core.BlockPos,net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo> capturedMultiblocks
    • collisionLevel

      protected ContraptionWorld collisionLevel
  • Constructor Details

    • Contraption

      public Contraption()
  • Method Details

    • getContraptionWorld

      public ContraptionWorld 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

      public abstract ContraptionType 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

      public void onEntityCreated(AbstractContraptionEntity entity)
    • onEntityRemoved

      public void onEntityRemoved(AbstractContraptionEntity entity)
    • 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

      protected void movePistonHead(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)
    • movePistonPole

      protected void movePistonPole(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)
    • moveGantryPinion

      protected void moveGantryPinion(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)
    • moveGantryShaft

      protected void moveGantryShaft(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)
    • 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

      public void addBlocksToWorld(net.minecraft.world.level.Level world, StructureTransform transform)
    • translateMultiblockControllers

      protected void translateMultiblockControllers(StructureTransform transform)
    • 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

      protected void disableActorOnStart(MovementContext context)
    • isActorTypeDisabled

      public boolean isActorTypeDisabled(net.minecraft.world.item.ItemStack filter)
    • setActorsActive

      public void setActorsActive(net.minecraft.world.item.ItemStack referenceStack, boolean enable)
    • getDisabledActors

      public List<net.minecraft.world.item.ItemStack> 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

      public Map<UUID,Integer> getSeatMapping()
    • getSeatOf

      public net.minecraft.core.BlockPos getSeatOf(UUID entityId)
    • getBearingPosOf

      public net.minecraft.core.BlockPos getBearingPosOf(UUID subContraptionEntityId)
    • setSeatMapping

      public void setSeatMapping(Map<UUID,Integer> seatMapping)
    • getSeats

      public List<net.minecraft.core.BlockPos> 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

      public Map<net.minecraft.core.BlockPos,MovingInteractionBehaviour> getInteractors()
    • invalidateColliders

      public void invalidateColliders()
    • getRadius

      public static double getRadius(Iterable<? extends net.minecraft.core.Vec3i> blocks, net.minecraft.core.Direction.Axis axis)
    • getStorage

      public MountedStorageManager getStorage()
    • isHiddenInPortal

      public boolean isHiddenInPortal(net.minecraft.core.BlockPos localPos)
    • getSimplifiedEntityColliders

      public Optional<CollisionList> getSimplifiedEntityColliders()
    • tickStorage

      public void tickStorage(AbstractContraptionEntity entity)
    • containsBlockBreakers

      public boolean containsBlockBreakers()
    • getOrCreateClientContraptionLazy

      public final ClientContraption getOrCreateClientContraptionLazy()
      See the docs on clientContraption.
    • createClientContraption

      @Contract(" -> new") protected ClientContraption createClientContraption()
      Create a new ClientContraption instance. 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)