Class ItemStackRequirement
java.lang.Object
com.pixelmonmod.pixelmon.api.daycare.impl.requirement.AbstractRequirement
com.pixelmonmod.pixelmon.api.daycare.impl.requirement.ItemStackRequirement
- All Implemented Interfaces:
DayCareRequirement
Should parse a list of required items following the
GiveCommand
's item stack
format- Since:
- 25/06/2022
-
Field Summary
Fields inherited from class com.pixelmonmod.pixelmon.api.daycare.impl.requirement.AbstractRequirement
error, typeId
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList<net.minecraft.world.item.ItemStack>
boolean
hasMetRequirement
(net.minecraft.server.level.ServerPlayer player, DayCareBox box) Determines if the player has met the given requirementvoid
read
(com.google.gson.Gson gson, com.google.gson.JsonElement json) Reads the breeding requirement from JSONvoid
read
(net.minecraft.nbt.CompoundTag nbt) Reads the requirement from NBTvoid
takeFrom
(net.minecraft.server.level.ServerPlayer player, DayCareBox box) The logic for taking the items from the playervoid
write
(net.minecraft.nbt.CompoundTag nbt) Writes the requirement to NBTMethods inherited from class com.pixelmonmod.pixelmon.api.daycare.impl.requirement.AbstractRequirement
getError, getTypeId, setError
-
Field Details
-
requiredItems
-
-
Constructor Details
-
ItemStackRequirement
public ItemStackRequirement()
-
-
Method Details
-
read
public void read(com.google.gson.Gson gson, com.google.gson.JsonElement json) throws RuntimeException Description copied from interface:DayCareRequirement
Reads the breeding requirement from JSON- Parameters:
gson
- The GSON instancejson
- The JSON element to be parsed- Throws:
RuntimeException
-
hasMetRequirement
Description copied from interface:DayCareRequirement
Determines if the player has met the given requirement- Parameters:
player
- The playerbox
- The box in relation to- Returns:
- True if met, false if not
-
takeFrom
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) 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) Description copied from interface:DayCareRequirement
Reads the requirement from NBT- Parameters:
nbt
- The NBT being read from
-
getRequiredItems
-