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_SLOTS
private int
burnTime
private int
cookTime
private int
cookTimeTotal
private int
fuelTime
protected DefaultedList<ItemStack>
inventory
protected PropertyDelegate
propertyDelegate
private Object2IntOpenHashMap<Identifier>
recipesUsed
protected RecipeType<? extends AbstractCookingRecipe>
recipeType
private static int[]
SIDE_SLOTS
private static int[]
TOP_SLOTS
Fields inherited from class net.minecraft.block.entity.BlockEntity
pos, removed, world
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, RecipeType<? extends AbstractCookingRecipe> recipeType)
-
Method Summary
Modifier and Type Method Description private static void
addFuel(Map<Item,Integer> map, ItemConvertible item, int fuelTime)
private static void
addFuel(Map<Item,Integer> fuelTimes, Tag<Item> tag, int fuelTime)
protected boolean
canAcceptRecipeOutput(Recipe<?> recipe)
boolean
canExtract(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.boolean
canInsert(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.boolean
canPlayerUse(PlayerEntity player)
static boolean
canUseAsFuel(ItemStack stack)
void
clear()
private void
craftRecipe(Recipe<?> recipe)
static Map<Item,Integer>
createFuelTimeMap()
void
dropExperience(PlayerEntity player)
private static void
dropExperience(World world, Vec3d vec3d, int int2, float float2)
void
fromTag(BlockState state, CompoundTag tag)
int[]
getAvailableSlots(Direction side)
Gets the available slot positions that are reachable from a given side.protected int
getCookTime()
protected int
getFuelTime(ItemStack fuel)
Recipe<?>
getLastRecipe()
ItemStack
getStack(int slot)
Fetches the stack currently stored at the given slot.private boolean
isBurning()
boolean
isEmpty()
private static boolean
isNonFlammableWood(Item item)
boolean
isValid(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)
void
provideRecipeInputs(RecipeFinder finder)
ItemStack
removeStack(int slot)
Removes the stack currently stored at the indicated slot.ItemStack
removeStack(int slot, int amount)
Removes a specific number of items from the given slot.void
setLastRecipe(Recipe<?> recipe)
void
setStack(int slot, ItemStack stack)
int
size()
void
tick()
CompoundTag
toTag(CompoundTag tag)
void
unlockLastRecipe(PlayerEntity player)
Methods inherited from class net.minecraft.block.entity.LockableContainerBlockEntity
checkUnlocked, checkUnlocked, createMenu, createScreenHandler, getContainerName, getCustomName, getDisplayName, getName, setCustomName
Methods 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, toUpdatePacket
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.inventory.Inventory
containsAny, count, getMaxCountPerStack, markDirty, onClose, onOpen
Methods inherited from interface net.minecraft.util.Nameable
hasCustomName
Methods 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:
fromTag
in classLockableContainerBlockEntity
-
toTag
- Overrides:
toTag
in 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:
getAvailableSlots
in interfaceSidedInventory
-
canInsert
Determines whether the given stack can be inserted into this inventory at the specified slot position from the given direction.- Specified by:
canInsert
in interfaceSidedInventory
-
canExtract
Determines whether the given stack can be removed from this inventory at the specified slot position from the given direction.- Specified by:
canExtract
in 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:
removeStack
in interfaceInventory
- Returns:
- the removed items as a stack
-
removeStack
Removes the stack currently stored at the indicated slot.- Specified by:
removeStack
in interfaceInventory
- Returns:
- the stack previously stored at the indicated slot.
-
setStack
-
canPlayerUse
- Specified by:
canPlayerUse
in interfaceInventory
-
isValid
Returns whether the given stack is a valid for the indicated slot position. -
clear
public void clear() -
setLastRecipe
- Specified by:
setLastRecipe
in interfaceRecipeUnlocker
-
getLastRecipe
- Specified by:
getLastRecipe
in interfaceRecipeUnlocker
-
unlockLastRecipe
- Specified by:
unlockLastRecipe
in interfaceRecipeUnlocker
-
dropExperience
-
method_27354
-
dropExperience
-
provideRecipeInputs
- Specified by:
provideRecipeInputs
in interfaceRecipeInputProvider
-