Package net.minecraft.block.entity
Class AbstractFurnaceBlockEntity
java.lang.Object
net.minecraft.block.entity.BlockEntity
net.minecraft.block.entity.LockableContainerBlockEntity
net.minecraft.block.entity.AbstractFurnaceBlockEntity
- All Implemented Interfaces:
Inventory,SidedInventory,RecipeInputProvider,RecipeUnlocker,NamedScreenHandlerFactory,ScreenHandlerFactory,Clearable,Nameable,Tickable
- Direct Known Subclasses:
BlastFurnaceBlockEntity,FurnaceBlockEntity,SmokerBlockEntity
public abstract class AbstractFurnaceBlockEntity extends LockableContainerBlockEntity implements SidedInventory, RecipeUnlocker, RecipeInputProvider, Tickable
-
Field Summary
Fields Modifier and Type Field Description private static int[]BOTTOM_SLOTSprivate intburnTimeprivate intcookTimeprivate intcookTimeTotalprivate intfuelTimeprotected DefaultedList<ItemStack>inventoryprotected PropertyDelegatepropertyDelegateprivate Object2IntOpenHashMap<Identifier>recipesUsedprotected RecipeType<? extends AbstractCookingRecipe>recipeTypeprivate static int[]SIDE_SLOTSprivate static int[]TOP_SLOTSFields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, world -
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, RecipeType<? extends AbstractCookingRecipe> recipeType) -
Method Summary
Modifier and Type Method Description private static voidaddFuel(Map<Item,Integer> map, ItemConvertible item, int fuelTime)private static voidaddFuel(Map<Item,Integer> fuelTimes, Tag<Item> tag, int fuelTime)protected booleancanAcceptRecipeOutput(Recipe<?> recipe)booleancanExtract(int slot, ItemStack stack, Direction dir)Determines whether the given stack can be removed from this inventory at the specified slot position from the given direction.booleancanInsert(int slot, ItemStack stack, Direction dir)Determines whether the given stack can be inserted into this inventory at the specified slot position from the given direction.booleancanPlayerUse(PlayerEntity player)static booleancanUseAsFuel(ItemStack stack)voidclear()private voidcraftRecipe(Recipe<?> recipe)static Map<Item,Integer>createFuelTimeMap()voiddropExperience(PlayerEntity player)private static voiddropExperience(World world, Vec3d vec3d, int int2, float float2)voidfromTag(BlockState state, CompoundTag tag)int[]getAvailableSlots(Direction side)Gets the available slot positions that are reachable from a given side.protected intgetCookTime()protected intgetFuelTime(ItemStack fuel)Recipe<?>getLastRecipe()ItemStackgetStack(int slot)Fetches the stack currently stored at the given slot.private booleanisBurning()booleanisEmpty()private static booleanisNonFlammableWood(Item item)booleanisValid(int slot, ItemStack stack)Returns whether the given stack is a valid for the indicated slot position.List<Recipe<?>>method_27354(World world, Vec3d vec3d)voidprovideRecipeInputs(RecipeFinder finder)ItemStackremoveStack(int slot)Removes the stack currently stored at the indicated slot.ItemStackremoveStack(int slot, int amount)Removes a specific number of items from the given slot.voidsetLastRecipe(Recipe<?> recipe)voidsetStack(int slot, ItemStack stack)intsize()voidtick()CompoundTagtoTag(CompoundTag tag)voidunlockLastRecipe(PlayerEntity player)Methods inherited from class net.minecraft.block.entity.LockableContainerBlockEntity
checkUnlocked, checkUnlocked, createMenu, createScreenHandler, getContainerName, getCustomName, getDisplayName, getName, setCustomNameMethods inherited from class net.minecraft.block.entity.BlockEntity
applyMirror, applyRotation, cancelRemoval, copyItemDataRequiresOperator, createFromTag, getCachedState, getPos, getSquaredRenderDistance, getType, getWorld, hasWorld, isRemoved, markDirty, markInvalid, markRemoved, onSyncedBlockEvent, populateCrashReport, resetBlock, setLocation, setPos, toInitialChunkDataTag, toUpdatePacketMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.inventory.Inventory
containsAny, count, getMaxCountPerStack, markDirty, onClose, onOpenMethods inherited from interface net.minecraft.util.Nameable
hasCustomNameMethods inherited from interface net.minecraft.recipe.RecipeUnlocker
shouldCraftRecipe
-
Field Details
-
TOP_SLOTS
private static final int[] TOP_SLOTS -
BOTTOM_SLOTS
private static final int[] BOTTOM_SLOTS -
SIDE_SLOTS
private static final int[] SIDE_SLOTS -
inventory
-
burnTime
private int burnTime -
fuelTime
private int fuelTime -
cookTime
private int cookTime -
cookTimeTotal
private int cookTimeTotal -
propertyDelegate
-
recipesUsed
-
recipeType
-
-
Constructor Details
-
AbstractFurnaceBlockEntity
protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, RecipeType<? extends AbstractCookingRecipe> recipeType)
-
-
Method Details
-
createFuelTimeMap
-
isNonFlammableWood
-
addFuel
-
addFuel
-
isBurning
private boolean isBurning() -
fromTag
- Overrides:
fromTagin classLockableContainerBlockEntity
-
toTag
- Overrides:
toTagin classLockableContainerBlockEntity
-
tick
public void tick() -
canAcceptRecipeOutput
-
craftRecipe
-
getFuelTime
-
getCookTime
protected int getCookTime() -
canUseAsFuel
-
getAvailableSlots
Gets the available slot positions that are reachable from a given side.- Specified by:
getAvailableSlotsin interfaceSidedInventory
-
canInsert
Determines whether the given stack can be inserted into this inventory at the specified slot position from the given direction.- Specified by:
canInsertin interfaceSidedInventory
-
canExtract
Determines whether the given stack can be removed from this inventory at the specified slot position from the given direction.- Specified by:
canExtractin interfaceSidedInventory
-
size
public int size() -
isEmpty
public boolean isEmpty() -
getStack
Fetches the stack currently stored at the given slot. If the slot is empty, or is outside the bounds of this inventory, returns seeItemStack.EMPTY. -
removeStack
Removes a specific number of items from the given slot.- Specified by:
removeStackin interfaceInventory- Returns:
- the removed items as a stack
-
removeStack
Removes the stack currently stored at the indicated slot.- Specified by:
removeStackin interfaceInventory- Returns:
- the stack previously stored at the indicated slot.
-
setStack
-
canPlayerUse
- Specified by:
canPlayerUsein interfaceInventory
-
isValid
Returns whether the given stack is a valid for the indicated slot position. -
clear
public void clear() -
setLastRecipe
- Specified by:
setLastRecipein interfaceRecipeUnlocker
-
getLastRecipe
- Specified by:
getLastRecipein interfaceRecipeUnlocker
-
unlockLastRecipe
- Specified by:
unlockLastRecipein interfaceRecipeUnlocker
-
dropExperience
-
method_27354
-
dropExperience
-
provideRecipeInputs
- Specified by:
provideRecipeInputsin interfaceRecipeInputProvider
-