Class SpoilHelper

java.lang.Object
com.mrbysco.spoiled.util.SpoilHelper

public class SpoilHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getSpoilRecipe(net.minecraft.world.level.Level level, net.minecraft.world.item.ItemStack stack)
    get the Spoil Recipe for the given stack
    static int
    getSpoilTime(net.minecraft.world.item.ItemStack stack)
    Get the spoil time for a stack
    static boolean
    isSpoiled(net.minecraft.world.item.ItemStack stack)
    Check if a stack is spoiled
    static boolean
    isSpoiling(net.minecraft.world.item.ItemStack stack)
    Check if a stack is spoiling
    static void
    setSpoilTime(net.minecraft.world.item.ItemStack stack, int time)
    Set the spoil time for a stack
    static void
    spoilItemForEntity(net.minecraft.world.Container container, net.minecraft.world.entity.Entity entity, net.minecraft.world.item.ItemStack stack, SpoilRecipe recipe)
    Spoil a stack for a container
    static void
    spoilItemForPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, SpoilRecipe recipe)
    Spoil a stack for a player
    static boolean
    totalUnderMax(net.minecraft.world.item.ItemStack stack1, net.minecraft.world.item.ItemStack stack2)
    Check if merging two stacks will have the total under the max stack size
    static void
    updateSpoilingStack(net.minecraft.world.item.ItemStack stack, SpoilRecipe recipe)
    Update the spoil time for a stack

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpoilHelper

      public SpoilHelper()
  • Method Details

    • getSpoilRecipe

      public static SpoilRecipe getSpoilRecipe(net.minecraft.world.level.Level level, net.minecraft.world.item.ItemStack stack)
      get the Spoil Recipe for the given stack
      Parameters:
      level - The world to get the recipe manager from
      stack - The stack to check against
      Returns:
      The Spoil Recipe matching the stack or null if none found
    • isSpoiling

      public static boolean isSpoiling(net.minecraft.world.item.ItemStack stack)
      Check if a stack is spoiling
      Parameters:
      stack - The stack to check
      Returns:
      true if the stack is spoiling
    • getSpoilTime

      public static int getSpoilTime(net.minecraft.world.item.ItemStack stack)
      Get the spoil time for a stack
      Parameters:
      stack - The stack to check
      Returns:
      The spoil time for the stack
    • setSpoilTime

      public static void setSpoilTime(net.minecraft.world.item.ItemStack stack, int time)
      Set the spoil time for a stack
      Parameters:
      stack - The stack to set the spoil time for
      time - The time to set
    • spoilItemForPlayer

      public static void spoilItemForPlayer(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, SpoilRecipe recipe)
      Spoil a stack for a player
      Parameters:
      player - The player to give the spoiled item to
      stack - The stack to spoil
      recipe - The spoil recipe to use
    • spoilItemForEntity

      public static void spoilItemForEntity(net.minecraft.world.Container container, net.minecraft.world.entity.Entity entity, net.minecraft.world.item.ItemStack stack, SpoilRecipe recipe)
      Spoil a stack for a container
      Parameters:
      container - The container to give the spoiled item to
      entity - The entity to get the world from
      stack - The stack to spoil
      recipe - The spoil recipe to use
    • updateSpoilingStack

      public static void updateSpoilingStack(net.minecraft.world.item.ItemStack stack, SpoilRecipe recipe)
      Update the spoil time for a stack
      Parameters:
      stack - The stack to update
      recipe - The spoil recipe to use
    • isSpoiled

      public static boolean isSpoiled(net.minecraft.world.item.ItemStack stack)
      Check if a stack is spoiled
      Parameters:
      stack - The stack to check
      Returns:
      true if the stack is spoiled
    • totalUnderMax

      public static boolean totalUnderMax(net.minecraft.world.item.ItemStack stack1, net.minecraft.world.item.ItemStack stack2)
      Check if merging two stacks will have the total under the max stack size
      Parameters:
      stack1 - The first stack
      stack2 - The second stack
      Returns:
      true if the total will be under the max stack size