Class AmmunitionTableBlockEntity

java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BaseContainerBlockEntity
tech.anonymoushacker1279.immersiveweapons.blockentity.AmmunitionTableBlockEntity
All Implemented Interfaces:
Iterable<net.minecraft.world.item.ItemStack>, net.minecraft.core.TypedInstance<net.minecraft.world.level.block.entity.BlockEntityType<?>>, net.minecraft.util.debug.DebugValueSource, net.minecraft.world.Clearable, net.minecraft.world.Container, net.minecraft.world.entity.SlotProvider, net.minecraft.world.inventory.MenuConstructor, net.minecraft.world.level.block.EntityBlock, net.minecraft.world.MenuProvider, net.minecraft.world.Nameable, net.neoforged.neoforge.attachment.IAttachmentHolder, net.neoforged.neoforge.common.extensions.ContainerExtension, net.neoforged.neoforge.common.extensions.IBlockEntityExtension, net.neoforged.neoforge.common.extensions.IMenuProviderExtension

public class AmmunitionTableBlockEntity extends net.minecraft.world.level.block.entity.BaseContainerBlockEntity implements net.minecraft.world.level.block.EntityBlock
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    net.neoforged.neoforge.attachment.AttachmentHolder.AsField

    Nested classes/interfaces inherited from interface net.minecraft.world.Container

    net.minecraft.world.Container.ContainerIterator

    Nested classes/interfaces inherited from interface net.minecraft.util.debug.DebugValueSource

    net.minecraft.util.debug.DebugValueSource.Registration, net.minecraft.util.debug.DebugValueSource.ValueGetter<T>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final net.minecraft.world.inventory.ContainerData
     
    protected float
     
    net.minecraft.world.item.ItemStack
     
    int
     
    protected final net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>
     
    protected final net.minecraft.core.NonNullList<Integer>
     

    Fields inherited from class net.minecraft.world.level.block.entity.BlockEntity

    level, remove, worldPosition

    Fields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    ATTACHMENTS_NBT_KEY

    Fields inherited from interface net.minecraft.world.Container

    DEFAULT_DISTANCE_BUFFER
  • Constructor Summary

    Constructors
    Constructor
    Description
    AmmunitionTableBlockEntity(net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    calculateOutput(boolean didCraft)
    Calculate the output item based on the given inputs.
    void
    Clear the inventory.
    protected net.minecraft.world.inventory.AbstractContainerMenu
    createMenu(int id, net.minecraft.world.entity.player.Inventory inventory)
     
    void
    Runs after a result ingredient has been taken.
    int
    Get the number of slots in the inventory.
    protected net.minecraft.network.chat.Component
     
    net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>
     
    net.minecraft.world.item.ItemStack
    getItem(int index)
    Get the ingredient in the given slot.
    protected net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>
     
    net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket
     
    net.minecraft.nbt.CompoundTag
    getUpdateTag(net.minecraft.core.HolderLookup.Provider registries)
     
    void
    Handle excess output that cannot fit in the output slot.
    boolean
    Checks if there are no materials present (first six slots)
    boolean
    Check if the inventory is empty.
    void
    loadAdditional(net.minecraft.world.level.storage.ValueInput valueInput)
     
    @Nullable net.minecraft.world.level.block.entity.BlockEntity
    newBlockEntity(net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState)
     
    void
    preRemoveSideEffects(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
     
    net.minecraft.world.item.ItemStack
    removeItem(int index, int count)
    Removes up to a specified number of items from an inventory slot and returns them in a new ingredient.
    net.minecraft.world.item.ItemStack
    removeItemNoUpdate(int index)
    Removes a ingredient from the given slot and returns it.
    protected void
    saveAdditional(net.minecraft.world.level.storage.ValueOutput valueOutput)
     
    void
     
    void
    setItem(int index, net.minecraft.world.item.ItemStack stack)
    Sets the given item ingredient to the specified slot in the inventory.
    protected void
    setItems(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks)
     
    boolean
    stillValid(net.minecraft.world.entity.player.Player player)
     

    Methods inherited from class net.minecraft.world.level.block.entity.BaseContainerBlockEntity

    applyImplicitComponents, canOpen, collectImplicitComponents, createMenu, getCustomName, getDisplayName, getName, isLocked, removeComponentsFromTag, sendChestLockedNotifications, setItem

    Methods inherited from class net.minecraft.world.level.block.entity.BlockEntity

    addEntityType, applyComponents, applyComponentsFromItemStack, clearRemoved, collectComponents, components, fillCrashReportCategory, getAndClearAttachmentTypesToSync, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, problemPath, registerDebugValues, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setComponents, setData, setLevel, setRemoved, syncData, triggerEvent, typeHolder

    Methods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder

    deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachments

    Methods inherited from class Object

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

    Methods inherited from interface net.minecraft.world.Container

    canPlaceItem, canTakeItem, countItem, getEntitiesWithContainerOpen, getMaxStackSize, getMaxStackSize, getSlot, hasAnyMatching, hasAnyOf, iterator, startOpen, stopOpen

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

    onTransfer

    Methods inherited from interface net.minecraft.world.level.block.EntityBlock

    getListener, getTicker

    Methods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder

    getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncData

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

    applyStructureRotation, getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdate

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

    shouldTriggerClientSideContainerClosingOnOpen, writeClientSideData

    Methods inherited from interface Iterable

    forEach, spliterator

    Methods inherited from interface net.minecraft.world.Nameable

    getPlainTextName, hasCustomName

    Methods inherited from interface net.minecraft.world.entity.SlotProvider

    getSlotsFromRange

    Methods inherited from interface net.minecraft.core.TypedInstance

    is, is, is, is, is, tags
  • Field Details

    • inventory

      protected final net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> inventory
    • slotCosts

      protected final net.minecraft.core.NonNullList<Integer> slotCosts
    • excessStackSize

      public int excessStackSize
    • excessStack

      public net.minecraft.world.item.ItemStack excessStack
    • densityModifier

      protected float densityModifier
    • containerData

      public final net.minecraft.world.inventory.ContainerData containerData
  • Constructor Details

    • AmmunitionTableBlockEntity

      public AmmunitionTableBlockEntity(net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState)
  • Method Details

    • getDefaultName

      protected net.minecraft.network.chat.Component getDefaultName()
      Specified by:
      getDefaultName in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
    • getItems

      protected net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getItems()
      Specified by:
      getItems in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
    • setItems

      protected void setItems(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks)
      Specified by:
      setItems in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
    • createMenu

      protected net.minecraft.world.inventory.AbstractContainerMenu createMenu(int id, net.minecraft.world.entity.player.Inventory inventory)
      Specified by:
      createMenu in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
    • newBlockEntity

      @Nullable public @Nullable net.minecraft.world.level.block.entity.BlockEntity newBlockEntity(net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState)
      Specified by:
      newBlockEntity in interface net.minecraft.world.level.block.EntityBlock
    • loadAdditional

      public void loadAdditional(net.minecraft.world.level.storage.ValueInput valueInput)
      Overrides:
      loadAdditional in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
    • saveAdditional

      protected void saveAdditional(net.minecraft.world.level.storage.ValueOutput valueOutput)
      Overrides:
      saveAdditional in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
    • getContainerSize

      public int getContainerSize()
      Get the number of slots in the inventory.
      Specified by:
      getContainerSize in interface net.minecraft.world.Container
      Returns:
      int
    • isEmpty

      public boolean isEmpty()
      Check if the inventory is empty.
      Specified by:
      isEmpty in interface net.minecraft.world.Container
      Overrides:
      isEmpty in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
      Returns:
      boolean
    • getItem

      public net.minecraft.world.item.ItemStack getItem(int index)
      Get the ingredient in the given slot.
      Specified by:
      getItem in interface net.minecraft.world.Container
      Overrides:
      getItem in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
      Parameters:
      index - the slot index
      Returns:
      ItemStack
    • removeItem

      public net.minecraft.world.item.ItemStack removeItem(int index, int count)
      Removes up to a specified number of items from an inventory slot and returns them in a new ingredient.
      Specified by:
      removeItem in interface net.minecraft.world.Container
      Overrides:
      removeItem in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
      Parameters:
      index - the slot index
      count - the number to remove
      Returns:
      ItemStack
    • removeItemNoUpdate

      public net.minecraft.world.item.ItemStack removeItemNoUpdate(int index)
      Removes a ingredient from the given slot and returns it.
      Specified by:
      removeItemNoUpdate in interface net.minecraft.world.Container
      Overrides:
      removeItemNoUpdate in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
      Parameters:
      index - the slot index
      Returns:
      ItemStack
    • setItem

      public void setItem(int index, net.minecraft.world.item.ItemStack stack)
      Sets the given item ingredient to the specified slot in the inventory.
      Specified by:
      setItem in interface net.minecraft.world.Container
      Overrides:
      setItem in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
      Parameters:
      index - the slot index
      stack - the ItemStack to set
    • setChanged

      public void setChanged()
      Specified by:
      setChanged in interface net.minecraft.world.Container
      Overrides:
      setChanged in class net.minecraft.world.level.block.entity.BlockEntity
    • getInventory

      public net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getInventory()
    • getUpdatePacket

      public net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket getUpdatePacket()
      Overrides:
      getUpdatePacket in class net.minecraft.world.level.block.entity.BlockEntity
    • getUpdateTag

      public net.minecraft.nbt.CompoundTag getUpdateTag(net.minecraft.core.HolderLookup.Provider registries)
      Overrides:
      getUpdateTag in class net.minecraft.world.level.block.entity.BlockEntity
    • stillValid

      public boolean stillValid(net.minecraft.world.entity.player.Player player)
      Specified by:
      stillValid in interface net.minecraft.world.Container
      Overrides:
      stillValid in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
    • clearContent

      public void clearContent()
      Clear the inventory.
      Specified by:
      clearContent in interface net.minecraft.world.Clearable
      Overrides:
      clearContent in class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
    • calculateOutput

      public void calculateOutput(boolean didCraft)
      Calculate the output item based on the given inputs.
    • depleteMaterials

      public void depleteMaterials()
      Runs after a result ingredient has been taken. Decreases the ingredient size of each input item by the amount specified in the slotCosts list.
    • handleExcess

      public void handleExcess()
      Handle excess output that cannot fit in the output slot.
    • hasNoMaterials

      public boolean hasNoMaterials()
      Checks if there are no materials present (first six slots)
      Returns:
      boolean
    • preRemoveSideEffects

      public void preRemoveSideEffects(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Overrides:
      preRemoveSideEffects in class net.minecraft.world.level.block.entity.BlockEntity