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
- Direct Known Subclasses:
BlastFurnaceBlockEntity,FurnaceBlockEntity,SmokerBlockEntity
public abstract class AbstractFurnaceBlockEntity extends LockableContainerBlockEntity implements SidedInventory, RecipeUnlocker, RecipeInputProvider
-
Field Summary
Fields Modifier and Type Field Description private static int[]BOTTOM_SLOTSprivate intburnTimeprivate intcookTimeprivate intcookTimeTotalprivate intfuelTimeprotected DefaultedList<ItemStack>inventoryprotected PropertyDelegatepropertyDelegateprivate Object2IntOpenHashMap<Identifier>recipesUsedprivate 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, BlockPos blockPos, BlockState blockState, 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)private static booleancanAcceptRecipeOutput(Recipe<?> recipe, DefaultedList<ItemStack> defaultedList, int int2)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 static booleancraftRecipe(Recipe<?> recipe, DefaultedList<ItemStack> defaultedList, int int2)static Map<Item,Integer>createFuelTimeMap()voiddropExperience(ServerPlayerEntity serverPlayerEntity)private static voiddropExperience(ServerWorld serverWorld, Vec3d vec3d, int int2, float float2)voidfromTag(CompoundTag tag)int[]getAvailableSlots(Direction side)Gets the available slot positions that are reachable from a given side.private static intgetCookTime(World world, RecipeType<? extends AbstractCookingRecipe> recipeType, Inventory inventory)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(ServerWorld serverWorld, 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()static voidtick(World world, BlockPos blockPos, BlockState blockState, AbstractFurnaceBlockEntity abstractFurnaceBlockEntity)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
cancelRemoval, copyItemDataRequiresOperator, createFromTag, getCachedState, getPos, getSquaredRenderDistance, getType, getWorld, hasWorld, isRemoved, markDirty, markDirty, markRemoved, onSyncedBlockEvent, populateCrashReport, setCachedState, setWorld, 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, BlockPos blockPos, BlockState blockState, RecipeType<? extends AbstractCookingRecipe> recipeType)
-
-
Method Details
-
createFuelTimeMap
-
isNonFlammableWood
-
addFuel
-
addFuel
-
isBurning
private boolean isBurning() -
fromTag
- Overrides:
fromTagin classLockableContainerBlockEntity
-
toTag
- Overrides:
toTagin classLockableContainerBlockEntity
-
tick
public static void tick(World world, BlockPos blockPos, BlockState blockState, AbstractFurnaceBlockEntity abstractFurnaceBlockEntity) -
canAcceptRecipeOutput
private static boolean canAcceptRecipeOutput(@Nullable Recipe<?> recipe, DefaultedList<ItemStack> defaultedList, int int2) -
craftRecipe
private static boolean craftRecipe(@Nullable Recipe<?> recipe, DefaultedList<ItemStack> defaultedList, int int2) -
getFuelTime
-
getCookTime
private static int getCookTime(World world, RecipeType<? extends AbstractCookingRecipe> recipeType, Inventory inventory) -
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
-