Class ItemGui

java.lang.Object
net.minecraft.world.item.Item
org.cyclops.cyclopscore.item.ItemGui
All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, net.minecraftforge.common.extensions.IForgeItem

public abstract class ItemGui extends net.minecraft.world.item.Item
Configurable item that can show a GUI on right clicking. Implement getContainer(Level, Player, ItemLocation) and getContainerClass(Level, Player, ItemStack) to specify the gui. Optionally implement getOpenStat() to specify a stat on gui opening.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.item.Item

    net.minecraft.world.item.Item.Properties
  • Field Summary

    Fields inherited from class net.minecraft.world.item.Item

    BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZE

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ItemGui(net.minecraft.world.item.Item.Properties properties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract net.minecraft.world.MenuProvider
    getContainer(net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, ItemLocation itemLocation)
     
    abstract Class<? extends net.minecraft.world.inventory.AbstractContainerMenu>
    getContainerClass(net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack itemStack)
     
    protected net.minecraft.stats.Stat<net.minecraft.resources.ResourceLocation>
     
    boolean
    onDroppedByPlayer(net.minecraft.world.item.ItemStack itemstack, net.minecraft.world.entity.player.Player player)
     
    void
    openGuiForItemIndex(net.minecraft.world.level.Level world, net.minecraft.server.level.ServerPlayer player, ItemLocation itemLocation)
    Open the gui for a certain item index in the player inventory.
    net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack>
    use(net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
     
    void
    writeExtraGuiData(net.minecraft.network.FriendlyByteBuf packetBuffer, net.minecraft.world.level.Level world, net.minecraft.server.level.ServerPlayer player, ItemLocation itemLocation)
    Write additional data to a packet buffer that will be sent to the client when opening the gui.

    Methods inherited from class net.minecraft.world.item.Item

    appendHoverText, asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarColor, getBarWidth, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isFoil, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, shouldOverrideMultiplayerNbt, toString, useOn, useOnRelease, verifyTagAfterLoad

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeItem

    canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, initCapabilities, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onItemUseFirst, onLeftClickEntity, onStopUsing, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
  • Constructor Details

    • ItemGui

      protected ItemGui(net.minecraft.world.item.Item.Properties properties)
  • Method Details

    • getContainer

      @Nullable public abstract net.minecraft.world.MenuProvider getContainer(net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, ItemLocation itemLocation)
    • getContainerClass

      public abstract Class<? extends net.minecraft.world.inventory.AbstractContainerMenu> getContainerClass(net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack itemStack)
    • onDroppedByPlayer

      public boolean onDroppedByPlayer(net.minecraft.world.item.ItemStack itemstack, net.minecraft.world.entity.player.Player player)
    • openGuiForItemIndex

      public void openGuiForItemIndex(net.minecraft.world.level.Level world, net.minecraft.server.level.ServerPlayer player, ItemLocation itemLocation)
      Open the gui for a certain item index in the player inventory.
      Parameters:
      world - The world.
      player - The player.
      itemLocation - The item with its location.
    • writeExtraGuiData

      public void writeExtraGuiData(net.minecraft.network.FriendlyByteBuf packetBuffer, net.minecraft.world.level.Level world, net.minecraft.server.level.ServerPlayer player, ItemLocation itemLocation)
      Write additional data to a packet buffer that will be sent to the client when opening the gui.
      Parameters:
      packetBuffer - A packet buffer to write to.
      world - The world.
      player - The player.
      itemLocation - The item with its location.
    • getOpenStat

      @Nullable protected net.minecraft.stats.Stat<net.minecraft.resources.ResourceLocation> getOpenStat()
      Returns:
      An optional gui opening statistic.
    • use

      public net.minecraft.world.InteractionResultHolder<net.minecraft.world.item.ItemStack> use(net.minecraft.world.level.Level world, net.minecraft.world.entity.player.Player player, net.minecraft.world.InteractionHand hand)
      Overrides:
      use in class net.minecraft.world.item.Item