Class NeoForgeGameplayHelper
java.lang.Object
net.darkhax.bookshelf.neoforge.impl.util.NeoForgeGameplayHelper
- All Implemented Interfaces:
IGameplayHelper
-
Field Summary
Fields inherited from interface net.darkhax.bookshelf.common.api.util.IGameplayHelper
RNG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<M extends net.minecraft.world.inventory.AbstractContainerMenu,U extends net.minecraft.client.gui.screens.Screen & net.minecraft.client.gui.screens.inventory.MenuAccess<M>>
voidbindMenu(net.minecraft.world.inventory.MenuType<? extends M> type, RegisterMenuScreen.ScreenFactory<M, U> factory) Binds a screen to a menu using platform specific code.<T extends net.minecraft.world.level.block.entity.BlockEntity>
net.minecraft.world.level.block.entity.BlockEntityType.Builder<T> blockEntityBuilder(BiFunction<net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState, T> factory, net.minecraft.world.level.block.Block... validBlocks) Creates a new block entity builder using platform specific code.net.minecraft.world.item.ItemStackgetCraftingRemainder(net.minecraft.world.item.ItemStack input) Gets the crafting remainder for a given item.net.minecraft.world.item.ItemStackinventoryInsert(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, net.minecraft.world.item.ItemStack stack) If an inventory exists at the specified position, attempt to insert the item into all available slots until the item has been fully inserted or no more slots are available.net.minecraft.world.item.CreativeModeTab.BuilderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.darkhax.bookshelf.common.api.util.IGameplayHelper
addItem, dropRemainders, getContainer
-
Constructor Details
-
NeoForgeGameplayHelper
public NeoForgeGameplayHelper()
-
-
Method Details
-
getCraftingRemainder
public net.minecraft.world.item.ItemStack getCraftingRemainder(net.minecraft.world.item.ItemStack input) Description copied from interface:IGameplayHelperGets the crafting remainder for a given item. This is required as some platforms have different logic for determining the crafting remainder.- Specified by:
getCraftingRemainderin interfaceIGameplayHelper- Parameters:
input- The input item.- Returns:
- The crafting remainder, or empty if none.
-
inventoryInsert
public net.minecraft.world.item.ItemStack inventoryInsert(net.minecraft.server.level.ServerLevel level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, net.minecraft.world.item.ItemStack stack) Description copied from interface:IGameplayHelperIf an inventory exists at the specified position, attempt to insert the item into all available slots until the item has been fully inserted or no more slots are available.- Specified by:
inventoryInsertin interfaceIGameplayHelper- Parameters:
level- The world instance.pos- The position of the block.side- The side you are accessing the inventory from. This is from the perspective of the inventory, not your block. For example a hopper on top of a chest is inserting downwards but would use the upwards face because that is the side of the chest being accessed.stack- The item to try inserting.- Returns:
- The remaining items that were not inserted.
-
blockEntityBuilder
public <T extends net.minecraft.world.level.block.entity.BlockEntity> net.minecraft.world.level.block.entity.BlockEntityType.Builder<T> blockEntityBuilder(BiFunction<net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState, T> factory, net.minecraft.world.level.block.Block... validBlocks) Description copied from interface:IGameplayHelperCreates a new block entity builder using platform specific code. This is required because the underlying block entity factory is not accessible.- Specified by:
blockEntityBuilderin interfaceIGameplayHelper- Type Parameters:
T- The type of the block entity.- Parameters:
factory- A factory that creates a new block entity instance.validBlocks- The array of valid blocks for the block entity.- Returns:
- A new builder for your block entity type.
-
bindMenu
public <M extends net.minecraft.world.inventory.AbstractContainerMenu,U extends net.minecraft.client.gui.screens.Screen & net.minecraft.client.gui.screens.inventory.MenuAccess<M>> void bindMenu(net.minecraft.world.inventory.MenuType<? extends M> type, RegisterMenuScreen.ScreenFactory<M, U> factory) Description copied from interface:IGameplayHelperBinds a screen to a menu using platform specific code. This is required because the underlying screen factory is not accessible.- Specified by:
bindMenuin interfaceIGameplayHelper- Type Parameters:
M- The type of the menu.U- The type of the screen.- Parameters:
type- The menu type to bind the screen to.factory- A factory that constructs the screen instance.
-
tabBuilder
public net.minecraft.world.item.CreativeModeTab.Builder tabBuilder()- Specified by:
tabBuilderin interfaceIGameplayHelper
-