Class ForgeGameplayHelper

java.lang.Object
net.darkhax.bookshelf.forge.impl.util.ForgeGameplayHelper
All Implemented Interfaces:
IGameplayHelper

public class ForgeGameplayHelper extends Object implements IGameplayHelper
  • Field Summary

    Fields inherited from interface net.darkhax.bookshelf.common.api.util.IGameplayHelper

    RNG
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <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)
    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.ItemStack
    getCraftingRemainder(net.minecraft.world.item.ItemStack input)
    Gets the crafting remainder for a given item.
    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)
    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.Builder
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.darkhax.bookshelf.common.api.util.IGameplayHelper

    addItem, dropRemainders, getContainer
  • Constructor Details

    • ForgeGameplayHelper

      public ForgeGameplayHelper()
  • Method Details

    • getCraftingRemainder

      public net.minecraft.world.item.ItemStack getCraftingRemainder(net.minecraft.world.item.ItemStack input)
      Description copied from interface: IGameplayHelper
      Gets the crafting remainder for a given item. This is required as some platforms have different logic for determining the crafting remainder.
      Specified by:
      getCraftingRemainder in interface IGameplayHelper
      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: IGameplayHelper
      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.
      Specified by:
      inventoryInsert in interface IGameplayHelper
      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: IGameplayHelper
      Creates a new block entity builder using platform specific code. This is required because the underlying block entity factory is not accessible.
      Specified by:
      blockEntityBuilder in interface IGameplayHelper
      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: IGameplayHelper
      Binds a screen to a menu using platform specific code. This is required because the underlying screen factory is not accessible.
      Specified by:
      bindMenu in interface IGameplayHelper
      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:
      tabBuilder in interface IGameplayHelper