Class AbstractFurnaceBlockEntity
java.lang.Object
net.neoforged.neoforge.attachment.AttachmentHolder
net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.level.block.entity.BaseContainerBlockEntity
net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity
- All Implemented Interfaces:
Iterable<ItemStack>, TypedInstance<BlockEntityType<?>>, DebugValueSource, Clearable, Container, SlotProvider, MenuConstructor, RecipeCraftingHolder, StackedContentsCompatible, MenuProvider, Nameable, WorldlyContainer, IAttachmentHolder, ContainerExtension, IBlockEntityExtension, IMenuProviderExtension
- Direct Known Subclasses:
BlastFurnaceBlockEntity, FurnaceBlockEntity, SmokerBlockEntity
public abstract class AbstractFurnaceBlockEntity
extends BaseContainerBlockEntity
implements WorldlyContainer, StackedContentsCompatible, RecipeCraftingHolder
-
Nested Class Summary
Nested classes/interfaces inherited from class AttachmentHolder
AttachmentHolder.AsFieldNested classes/interfaces inherited from interface Container
Container.ContainerIteratorNested classes/interfaces inherited from interface DebugValueSource
DebugValueSource.Registration, DebugValueSource.ValueGetter<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intprivate final SnapshotJournal<Boolean> private intprivate intstatic final intstatic final intstatic final intstatic final intprotected final ContainerDataprivate static final shortprivate static final shortprivate static final shortprivate static final shortprotected NonNullList<ItemStack> private intprivate intprivate booleanstatic final intprivate final RecipeManager.CachedCheck<SingleRecipeInput, ? extends AbstractCookingRecipe> private static final com.mojang.serialization.Codec<Map<ResourceKey<Recipe<?>>, Integer>> private final it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap<ResourceKey<Recipe<?>>> private final RecipeType<? extends AbstractCookingRecipe> protected static final intprotected static final intprotected static final intprivate static final int[]private static final int[]private static final int[]Fields inherited from class BlockEntity
level, remove, worldPositionFields inherited from class AttachmentHolder
ATTACHMENTS_NBT_KEYFields inherited from interface Container
DEFAULT_DISTANCE_BUFFER -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFurnaceBlockEntity(BlockEntityType<?> type, BlockPos worldPosition, BlockState blockState, RecipeType<? extends AbstractCookingRecipe> recipeType) -
Method Summary
Modifier and TypeMethodDescriptionvoidawardUsedRecipes(Player player, List<ItemStack> itemStacks) voidprivate static booleanburn(@Nullable RecipeHolder<? extends AbstractCookingRecipe> recipe, SingleRecipeInput input, NonNullList<ItemStack> items, int maxStackSize) private static booleancanBurn(@Nullable RecipeHolder<? extends AbstractCookingRecipe> recipe, SingleRecipeInput input, NonNullList<ItemStack> items, int maxStackSize) booleancanPlaceItem(int slot, ItemStack itemStack) booleancanPlaceItemThroughFace(int slot, ItemStack itemStack, @Nullable Direction direction) booleancanTakeItemThroughFace(int slot, ItemStack itemStack, Direction direction) private static voidcreateExperience(ServerLevel level, Vec3 position, int amount, float value) voidfillStackedContents(StackedItemContents contents) protected intgetBurnDuration(FuelValues fuelValues, ItemStack itemStack) intprotected NonNullList<ItemStack> getItems()List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(ServerLevel level, Vec3 position) @Nullable RecipeHolder<?> int[]getSlotsForFace(Direction direction) private static intgetTotalCookTime(ServerLevel level, AbstractFurnaceBlockEntity entity) private booleanisLit()protected voidloadAdditional(ValueInput input) voidonTransfer(int slot, int amountChange, TransactionContext transaction) Perform additional logic during the transaction, immediately after a successful transfer (i.e.voidpreRemoveSideEffects(BlockPos pos, BlockState state) protected voidsaveAdditional(ValueOutput output) static voidserverTick(ServerLevel level, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity entity) voidvoidAn extension ofContainer.setItem(int, ItemStack)that allows non-transactional side-effects to be skipped.protected voidsetItems(NonNullList<ItemStack> items) voidsetRecipeUsed(@Nullable RecipeHolder<?> recipeUsed) Methods inherited from class BaseContainerBlockEntity
applyImplicitComponents, canOpen, clearContent, collectImplicitComponents, createMenu, createMenu, getCustomName, getDefaultName, getDisplayName, getItem, getName, isEmpty, isLocked, removeComponentsFromTag, removeItem, removeItemNoUpdate, sendChestLockedNotifications, stillValidMethods inherited from class BlockEntity
addEntityType, applyComponents, applyComponentsFromItemStack, clearRemoved, collectComponents, components, fillCrashReportCategory, getAndClearAttachmentTypesToSync, getBlockPos, getBlockState, getLevel, getNameForReporting, getPersistentData, getPosFromTag, getType, getUpdatePacket, getUpdateTag, hasLevel, isRemoved, isValidBlockState, loadCustomOnly, loadStatic, loadWithComponents, parseCustomNameSafe, problemPath, registerDebugValues, removeData, saveCustomOnly, saveCustomOnly, saveWithFullMetadata, saveWithFullMetadata, saveWithId, saveWithoutMetadata, saveWithoutMetadata, setBlockState, setChanged, setChanged, setComponents, setData, setLevel, setRemoved, syncData, triggerEvent, typeHolderMethods inherited from class AttachmentHolder
deserializeAttachments, getData, getExistingDataOrNull, hasAttachments, hasData, serializeAttachmentsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Clearable
clearContentMethods inherited from interface Container
canTakeItem, countItem, getEntitiesWithContainerOpen, getItem, getMaxStackSize, getMaxStackSize, getSlot, hasAnyMatching, hasAnyOf, isEmpty, iterator, removeItem, removeItemNoUpdate, setChanged, startOpen, stillValid, stopOpenMethods inherited from interface IAttachmentHolder
getData, getExistingData, getExistingData, getExistingDataOrNull, hasData, removeData, setData, syncDataMethods inherited from interface IBlockEntityExtension
getModelData, handleUpdateTag, hasCustomOutlineRendering, invalidateCapabilities, onChunkUnloaded, onDataPacket, onLoad, requestModelDataUpdateMethods inherited from interface IMenuProviderExtension
shouldTriggerClientSideContainerClosingOnOpen, writeClientSideDataMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Nameable
getPlainTextName, hasCustomNameMethods inherited from interface RecipeCraftingHolder
setRecipeUsedMethods inherited from interface SlotProvider
getSlotsFromRange
-
Field Details
-
SLOT_INPUT
protected static final int SLOT_INPUT- See Also:
-
SLOT_FUEL
protected static final int SLOT_FUEL- See Also:
-
SLOT_RESULT
protected static final int SLOT_RESULT- See Also:
-
DATA_LIT_TIME
public static final int DATA_LIT_TIME- See Also:
-
SLOTS_FOR_UP
private static final int[] SLOTS_FOR_UP -
SLOTS_FOR_DOWN
private static final int[] SLOTS_FOR_DOWN -
SLOTS_FOR_SIDES
private static final int[] SLOTS_FOR_SIDES -
DATA_LIT_DURATION
public static final int DATA_LIT_DURATION- See Also:
-
DATA_COOKING_PROGRESS
public static final int DATA_COOKING_PROGRESS- See Also:
-
DATA_COOKING_TOTAL_TIME
public static final int DATA_COOKING_TOTAL_TIME- See Also:
-
NUM_DATA_VALUES
public static final int NUM_DATA_VALUES- See Also:
-
BURN_TIME_STANDARD
public static final int BURN_TIME_STANDARD- See Also:
-
BURN_COOL_SPEED
public static final int BURN_COOL_SPEED- See Also:
-
RECIPES_USED_CODEC
private static final com.mojang.serialization.Codec<Map<ResourceKey<Recipe<?>>, Integer>> RECIPES_USED_CODEC -
DEFAULT_COOKING_TIMER
private static final short DEFAULT_COOKING_TIMER- See Also:
-
DEFAULT_COOKING_TOTAL_TIME
private static final short DEFAULT_COOKING_TOTAL_TIME- See Also:
-
DEFAULT_LIT_TIME_REMAINING
private static final short DEFAULT_LIT_TIME_REMAINING- See Also:
-
DEFAULT_LIT_TOTAL_TIME
private static final short DEFAULT_LIT_TOTAL_TIME- See Also:
-
items
-
litTimeRemaining
private int litTimeRemaining -
litTotalTime
private int litTotalTime -
cookingTimer
private int cookingTimer -
cookingTotalTime
private int cookingTotalTime -
dataAccess
-
recipesUsed
private final it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap<ResourceKey<Recipe<?>>> recipesUsed -
quickCheck
private final RecipeManager.CachedCheck<SingleRecipeInput, ? extends AbstractCookingRecipe> quickCheck -
recipeType
-
needsCookingReset
private boolean needsCookingReset -
cookingResetJournal
-
-
Constructor Details
-
AbstractFurnaceBlockEntity
protected AbstractFurnaceBlockEntity(BlockEntityType<?> type, BlockPos worldPosition, BlockState blockState, RecipeType<? extends AbstractCookingRecipe> recipeType)
-
-
Method Details
-
isLit
private boolean isLit() -
loadAdditional
- Overrides:
loadAdditionalin classBaseContainerBlockEntity
-
saveAdditional
- Overrides:
saveAdditionalin classBaseContainerBlockEntity
-
serverTick
public static void serverTick(ServerLevel level, BlockPos pos, BlockState state, AbstractFurnaceBlockEntity entity) -
canBurn
private static boolean canBurn(@Nullable RecipeHolder<? extends AbstractCookingRecipe> recipe, SingleRecipeInput input, NonNullList<ItemStack> items, int maxStackSize) -
burn
private static boolean burn(@Nullable RecipeHolder<? extends AbstractCookingRecipe> recipe, SingleRecipeInput input, NonNullList<ItemStack> items, int maxStackSize) -
getBurnDuration
-
getTotalCookTime
-
getSlotsForFace
- Specified by:
getSlotsForFacein interfaceWorldlyContainer
-
canPlaceItemThroughFace
public boolean canPlaceItemThroughFace(int slot, ItemStack itemStack, @Nullable Direction direction) - Specified by:
canPlaceItemThroughFacein interfaceWorldlyContainer
-
canTakeItemThroughFace
- Specified by:
canTakeItemThroughFacein interfaceWorldlyContainer
-
getContainerSize
public int getContainerSize()- Specified by:
getContainerSizein interfaceContainer
-
getItems
- Specified by:
getItemsin classBaseContainerBlockEntity
-
setItems
- Specified by:
setItemsin classBaseContainerBlockEntity
-
setItem
- Specified by:
setItemin interfaceContainer- Overrides:
setItemin classBaseContainerBlockEntity
-
setItem
Description copied from interface:ContainerExtensionAn extension ofContainer.setItem(int, ItemStack)that allows non-transactional side-effects to be skipped. Non-transactional side-effects include for example callingsetChangedor making changes to the world.- Specified by:
setItemin interfaceContainerExtension- Overrides:
setItemin classBaseContainerBlockEntity- Parameters:
insideTransaction- Whentrue, non-transactional actions should be deferred. Whenfalse, non-transactional actions can be performed immediately.- See Also:
-
onTransfer
Description copied from interface:ContainerExtensionPerform additional logic during the transaction, immediately after a successful transfer (i.e. insert or extract with result > 0). Any logic performed by this method should be fully transactional, and support being rolled back. In other words, the transaction is still ongoing.- Specified by:
onTransferin interfaceContainerExtension- Parameters:
amountChange- If positive, the amount of items that were just inserted into this slot. If negative, minus the amount of items that were just extracted from this slot.
-
canPlaceItem
- Specified by:
canPlaceItemin interfaceContainer
-
setRecipeUsed
- Specified by:
setRecipeUsedin interfaceRecipeCraftingHolder
-
getRecipeUsed
- Specified by:
getRecipeUsedin interfaceRecipeCraftingHolder
-
awardUsedRecipes
- Specified by:
awardUsedRecipesin interfaceRecipeCraftingHolder
-
awardUsedRecipesAndPopExperience
-
getRecipesToAwardAndPopExperience
-
createExperience
-
fillStackedContents
- Specified by:
fillStackedContentsin interfaceStackedContentsCompatible
-
preRemoveSideEffects
- Overrides:
preRemoveSideEffectsin classBlockEntity
-