Class OneTimeFemaleItemStackRequirement

java.lang.Object
com.pixelmonmod.pixelmon.api.daycare.impl.requirement.AbstractRequirement
com.pixelmonmod.pixelmon.api.daycare.impl.requirement.OneTimeFemaleItemStackRequirement
All Implemented Interfaces:
DayCareRequirement

public class OneTimeFemaleItemStackRequirement extends AbstractRequirement
Should parse a list of required items following the GiveCommand's item stack format Only costs once
Since:
25/06/2022
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected List<net.minecraft.world.item.ItemStack>
     

    Fields inherited from class com.pixelmonmod.pixelmon.api.daycare.impl.requirement.AbstractRequirement

    error, typeId
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<net.minecraft.world.item.ItemStack>
     
    boolean
    hasMetRequirement(net.minecraft.server.level.ServerPlayer player, DayCareBox box)
    Determines if the player has met the given requirement
    void
    read(com.google.gson.Gson gson, com.google.gson.JsonElement json, net.minecraft.core.HolderLookup.Provider registryAccess)
    Reads the breeding requirement from JSON
    void
    read(net.minecraft.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider registryAccess)
    Reads the requirement from NBT
    void
    takeFrom(net.minecraft.server.level.ServerPlayer player, DayCareBox box)
    The logic for taking the items from the player
    void
    write(net.minecraft.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider registryAccess)
    Writes the requirement to NBT

    Methods inherited from class com.pixelmonmod.pixelmon.api.daycare.impl.requirement.AbstractRequirement

    getError, getTypeId, setError

    Methods inherited from class java.lang.Object

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

    • requiredItems

      protected List<net.minecraft.world.item.ItemStack> requiredItems
  • Constructor Details

    • OneTimeFemaleItemStackRequirement

      public OneTimeFemaleItemStackRequirement()
  • Method Details

    • read

      public void read(com.google.gson.Gson gson, com.google.gson.JsonElement json, net.minecraft.core.HolderLookup.Provider registryAccess) throws RuntimeException
      Description copied from interface: DayCareRequirement
      Reads the breeding requirement from JSON
      Parameters:
      gson - The GSON instance
      json - The JSON element to be parsed
      Throws:
      RuntimeException
    • hasMetRequirement

      public boolean hasMetRequirement(net.minecraft.server.level.ServerPlayer player, DayCareBox box)
      Description copied from interface: DayCareRequirement
      Determines if the player has met the given requirement
      Parameters:
      player - The player
      box - The box in relation to
      Returns:
      True if met, false if not
    • takeFrom

      public void takeFrom(net.minecraft.server.level.ServerPlayer player, DayCareBox box)
      Description copied from interface: DayCareRequirement
      The logic for taking the items from the player
      Parameters:
      player - The player
    • write

      public void write(net.minecraft.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider registryAccess)
      Description copied from interface: DayCareRequirement
      Writes the requirement to NBT
      Parameters:
      nbt - The NBT being written to
    • read

      public void read(net.minecraft.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider registryAccess)
      Description copied from interface: DayCareRequirement
      Reads the requirement from NBT
      Parameters:
      nbt - The NBT being read from
    • getRequiredItems

      public List<net.minecraft.world.item.ItemStack> getRequiredItems()