Files
BloodMagic/src/main/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentStack.java
T
koolkrafter5andgithub-actions[bot] 3b2b31f733 Spring Cleaning (#127)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-12 20:52:29 +02:00

46 lines
1.2 KiB
Java

package WayofTime.alchemicalWizardry.api.alchemy.energy;
import net.minecraft.nbt.NBTTagCompound;
public class ReagentStack {
public Reagent reagent;
public int amount;
public ReagentStack(Reagent reagent, int amount) {
this.reagent = reagent;
this.amount = amount;
}
public ReagentStack(ReagentStack reagentStack, int amount) {
this(reagentStack.reagent, amount);
}
public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag) {
Reagent reagent = ReagentRegistry.getReagentForKey(tag.getString("Reagent"));
if (reagent == null) {
return null;
}
int amount = tag.getInteger("amount");
return new ReagentStack(reagent, amount);
}
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
tag.setString("Reagent", ReagentRegistry.getKeyForReagent(this.reagent));
tag.setInteger("amount", this.amount);
return tag;
}
public ReagentStack copy() {
return new ReagentStack(this.reagent, this.amount);
}
public boolean isReagentEqual(ReagentStack other) {
return other != null && this.reagent == other.reagent;
}
}