Class GhostControllerItem

java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.BlockItem
com.portingdeadmods.portingdeadlibs.api.ghost.GhostControllerItem
All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, net.neoforged.neoforge.common.extensions.IItemExtension

public abstract class GhostControllerItem extends net.minecraft.world.item.BlockItem
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.item.Item

    net.minecraft.world.item.Item.Properties, net.minecraft.world.item.Item.TooltipContext
  • Field Summary

    Fields inherited from class net.minecraft.world.item.Item

    ABSOLUTE_MAX_STACK_SIZE, BASE_ATTACK_DAMAGE_ID, BASE_ATTACK_SPEED_ID, BY_BLOCK, canRepair, DEFAULT_MAX_STACK_SIZE, MAX_BAR_WIDTH

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Constructor
    Description
    GhostControllerItem(net.minecraft.world.level.block.Block controllerBlock, net.minecraft.world.item.Item.Properties properties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    afterPlacement(@NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.core.BlockPos controllerPos, @NotNull List<net.minecraft.core.BlockPos> allPos, @Nullable net.minecraft.world.entity.player.Player player)
    Called after the multiblock has been placed.
    boolean
    canPlace(@NotNull net.minecraft.world.item.context.BlockPlaceContext context, @NotNull net.minecraft.world.level.block.state.BlockState state)
     
    protected abstract @NotNull GhostMultiblockShape
    Defines the base shape of the multiblock in its default orientation (facing NORTH).
    protected @NotNull net.minecraft.world.phys.AABB
    getMultiblockBounds(@NotNull net.minecraft.world.item.context.BlockPlaceContext context)
    Calculates the world-space AABB for the multiblock.
    protected @NotNull net.minecraft.core.BlockPos
    getOrigin(@NotNull net.minecraft.world.item.context.BlockPlaceContext context)
    Calculates the origin of the multiblock structure in the world.
    protected abstract @NotNull net.minecraft.world.level.block.Block
     
    protected @NotNull GhostMultiblockShape
    getShape(@NotNull net.minecraft.world.item.context.BlockPlaceContext context)
    Gets the shape rotated according to the player's facing direction.
    protected boolean
    placeBlock(@NotNull net.minecraft.world.item.context.BlockPlaceContext context, @NotNull net.minecraft.world.level.block.state.BlockState state)
     

    Methods inherited from class net.minecraft.world.item.BlockItem

    appendHoverText, canFitInsideContainerItems, getBlock, getDescriptionId, getPlacementState, getPlaceSound, getPlaceSound, mustSurvive, onDestroyed, place, registerBlocks, removeFromBlockToItemMap, requiredFeatures, setBlockEntityData, updateCustomBlockEntityTag, updateCustomBlockEntityTag, updatePlacementContext, useOn

    Methods inherited from class net.minecraft.world.item.Item

    asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, components, finishUsingItem, getAttackDamageBonus, getBarColor, getBarWidth, getBreakingSound, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDefaultMaxStackSize, getDescription, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getId, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEnchantable, isFoil, isRepairable, isValidRepairItem, mineBlock, modifyDefaultComponentsFrom, onCraftedBy, onCraftedPostProcess, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, postHurtEnemy, releaseUsing, toString, use, useOnRelease, verifyComponentsAfterLoad

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled

    Methods inherited from interface net.neoforged.neoforge.common.extensions.IItemExtension

    applyEnchantments, canBeHurtBy, canContinueUsing, canDisableShield, canElytraFly, canEquip, canFitInsideContainerItems, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultAttributeModifiers, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, isBookEnchantable, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, isPrimaryItemFor, makesPiglinsNeutral, onAnimalArmorTick, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onEntitySwing, onItemUseFirst, onLeftClickEntity, onStopUsing, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation, supportsEnchantment
  • Constructor Details

    • GhostControllerItem

      public GhostControllerItem(net.minecraft.world.level.block.Block controllerBlock, net.minecraft.world.item.Item.Properties properties)
  • Method Details

    • getPartBlock

      @NotNull protected abstract @NotNull net.minecraft.world.level.block.Block getPartBlock()
      Returns:
      The block to use for the multiblock parts.
    • getBaseShape

      @NotNull protected abstract @NotNull GhostMultiblockShape getBaseShape()
      Defines the base shape of the multiblock in its default orientation (facing NORTH).
      Returns:
      The base GhostMultiblockShape.
    • getShape

      @NotNull protected @NotNull GhostMultiblockShape getShape(@NotNull @NotNull net.minecraft.world.item.context.BlockPlaceContext context)
      Gets the shape rotated according to the player's facing direction.
      Parameters:
      context - The placement context.
      Returns:
      The rotated GhostMultiblockShape.
    • getOrigin

      @NotNull protected @NotNull net.minecraft.core.BlockPos getOrigin(@NotNull @NotNull net.minecraft.world.item.context.BlockPlaceContext context)
      Calculates the origin of the multiblock structure in the world. By default, the controller is placed at the clicked position.
      Parameters:
      context - The placement context.
      Returns:
      The world position of the structure's origin (0,0,0 in relative space).
    • getMultiblockBounds

      @NotNull protected @NotNull net.minecraft.world.phys.AABB getMultiblockBounds(@NotNull @NotNull net.minecraft.world.item.context.BlockPlaceContext context)
      Calculates the world-space AABB for the multiblock.
      Parameters:
      context - The placement context.
      Returns:
      The AABB of the multiblock in the world.
    • canPlace

      public boolean canPlace(@NotNull @NotNull net.minecraft.world.item.context.BlockPlaceContext context, @NotNull @NotNull net.minecraft.world.level.block.state.BlockState state)
      Overrides:
      canPlace in class net.minecraft.world.item.BlockItem
    • placeBlock

      protected boolean placeBlock(@NotNull @NotNull net.minecraft.world.item.context.BlockPlaceContext context, @NotNull @NotNull net.minecraft.world.level.block.state.BlockState state)
      Overrides:
      placeBlock in class net.minecraft.world.item.BlockItem
    • afterPlacement

      protected void afterPlacement(@NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.core.BlockPos controllerPos, @NotNull @NotNull List<net.minecraft.core.BlockPos> allPos, @Nullable @Nullable net.minecraft.world.entity.player.Player player)
      Called after the multiblock has been placed. Override this to add custom data to the block entities, for eg. Researchd: Owner UUIDs.
      Parameters:
      level - The level.
      controllerPos - The position of the controller.
      allPos - A list of all block positions in the multiblock.
      player - The player who placed the multiblock.