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.util.debug.DebugValueSource,net.minecraft.world.Clearable,net.minecraft.world.Container,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.AsFieldNested classes/interfaces inherited from interface net.minecraft.world.Container
net.minecraft.world.Container.ContainerIteratorNested 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
FieldsModifier and TypeFieldDescriptionfinal net.minecraft.world.inventory.ContainerDataprotected floatnet.minecraft.world.item.ItemStackintprotected 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, worldPositionFields inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface net.minecraft.world.Container
DEFAULT_DISTANCE_BUFFER -
Constructor Summary
ConstructorsConstructorDescriptionAmmunitionTableBlockEntity(net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState) -
Method Summary
Modifier and TypeMethodDescriptionvoidcalculateOutput(boolean didCraft) Calculate the output item based on the given inputs.voidClear the inventory.protected net.minecraft.world.inventory.AbstractContainerMenucreateMenu(int id, net.minecraft.world.entity.player.Inventory inventory) voidRuns after a result ingredient has been taken.intGet the number of slots in the inventory.protected net.minecraft.network.chat.Componentnet.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> net.minecraft.world.item.ItemStackgetItem(int index) Get the ingredient in the given slot.protected net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getItems()net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacketnet.minecraft.nbt.CompoundTaggetUpdateTag(net.minecraft.core.HolderLookup.Provider registries) voidHandle excess output that cannot fit in the output slot.booleanChecks if there are no materials present (first six slots)booleanisEmpty()Check if the inventory is empty.voidloadAdditional(net.minecraft.world.level.storage.ValueInput valueInput) @Nullable net.minecraft.world.level.block.entity.BlockEntitynewBlockEntity(net.minecraft.core.BlockPos blockPos, net.minecraft.world.level.block.state.BlockState blockState) voidpreRemoveSideEffects(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) net.minecraft.world.item.ItemStackremoveItem(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.ItemStackremoveItemNoUpdate(int index) Removes a ingredient from the given slot and returns it.protected voidsaveAdditional(net.minecraft.world.level.storage.ValueOutput valueOutput) voidvoidsetItem(int index, net.minecraft.world.item.ItemStack stack) Sets the given item ingredient to the specified slot in the inventory.protected voidsetItems(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks) booleanstillValid(net.minecraft.world.entity.player.Player player) Methods inherited from class net.minecraft.world.level.block.entity.BaseContainerBlockEntity
applyImplicitComponents, canOpen, canUnlock, collectImplicitComponents, createMenu, getCustomName, getDisplayName, getName, isLocked, removeComponentsFromTag, setItemMethods inherited from class net.minecraft.world.level.block.entity.BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, clearRemoved, collectComponents, components, fillCrashReportCategory, 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, triggerEventMethods inherited from class net.neoforged.neoforge.attachment.AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.Container
canPlaceItem, canTakeItem, countItem, getEntitiesWithContainerOpen, getMaxStackSize, getMaxStackSize, hasAnyMatching, hasAnyOf, iterator, startOpen, stopOpenMethods inherited from interface net.neoforged.neoforge.common.extensions.ContainerExtension
onTransferMethods inherited from interface net.minecraft.world.level.block.EntityBlock
getListener, getTickerMethods inherited from interface net.neoforged.neoforge.attachment.IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface net.neoforged.neoforge.common.extensions.IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface net.neoforged.neoforge.common.extensions.IMenuProviderExtension
shouldTriggerClientSideContainerClosingOnOpen, writeClientSideDataMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface net.minecraft.world.Nameable
getPlainTextName, hasCustomName
-
Field Details
-
inventory
protected final net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> inventory -
densityModifier
protected float densityModifier -
excessStackSize
public int excessStackSize -
excessStack
public net.minecraft.world.item.ItemStack excessStack -
slotCosts
-
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:
getDefaultNamein classnet.minecraft.world.level.block.entity.BaseContainerBlockEntity
-
getItems
protected net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getItems()- Specified by:
getItemsin classnet.minecraft.world.level.block.entity.BaseContainerBlockEntity
-
setItems
protected void setItems(net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> stacks) - Specified by:
setItemsin classnet.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:
createMenuin classnet.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:
newBlockEntityin interfacenet.minecraft.world.level.block.EntityBlock
-
loadAdditional
public void loadAdditional(net.minecraft.world.level.storage.ValueInput valueInput) - Overrides:
loadAdditionalin classnet.minecraft.world.level.block.entity.BaseContainerBlockEntity
-
saveAdditional
protected void saveAdditional(net.minecraft.world.level.storage.ValueOutput valueOutput) - Overrides:
saveAdditionalin classnet.minecraft.world.level.block.entity.BaseContainerBlockEntity
-
getContainerSize
public int getContainerSize()Get the number of slots in the inventory.- Specified by:
getContainerSizein interfacenet.minecraft.world.Container- Returns:
- int
-
isEmpty
public boolean isEmpty()Check if the inventory is empty.- Specified by:
isEmptyin interfacenet.minecraft.world.Container- Overrides:
isEmptyin classnet.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:
getItemin interfacenet.minecraft.world.Container- Overrides:
getItemin classnet.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:
removeItemin interfacenet.minecraft.world.Container- Overrides:
removeItemin classnet.minecraft.world.level.block.entity.BaseContainerBlockEntity- Parameters:
index- the slot indexcount- 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:
removeItemNoUpdatein interfacenet.minecraft.world.Container- Overrides:
removeItemNoUpdatein classnet.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:
setItemin interfacenet.minecraft.world.Container- Overrides:
setItemin classnet.minecraft.world.level.block.entity.BaseContainerBlockEntity- Parameters:
index- the slot indexstack- theItemStackto set
-
setChanged
public void setChanged()- Specified by:
setChangedin interfacenet.minecraft.world.Container- Overrides:
setChangedin classnet.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:
getUpdatePacketin classnet.minecraft.world.level.block.entity.BlockEntity
-
getUpdateTag
public net.minecraft.nbt.CompoundTag getUpdateTag(net.minecraft.core.HolderLookup.Provider registries) - Overrides:
getUpdateTagin classnet.minecraft.world.level.block.entity.BlockEntity
-
stillValid
public boolean stillValid(net.minecraft.world.entity.player.Player player) - Specified by:
stillValidin interfacenet.minecraft.world.Container- Overrides:
stillValidin classnet.minecraft.world.level.block.entity.BaseContainerBlockEntity
-
clearContent
public void clearContent()Clear the inventory.- Specified by:
clearContentin interfacenet.minecraft.world.Clearable- Overrides:
clearContentin classnet.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:
preRemoveSideEffectsin classnet.minecraft.world.level.block.entity.BlockEntity
-