use of net.minecraft.nbt.CompoundNBT in project Overloaded by CJ-MC-Mods.
the class BigIntItemStorage method deserializeNBT.
@Override
public void deserializeNBT(CompoundNBT compound) {
ItemStack itemStack = compound.contains("Stack") ? ItemStack.of((CompoundNBT) compound.get("Stack")) : ItemStack.EMPTY;
BigInteger amount = compound.contains("Count") ? new BigInteger(compound.getByteArray("Count")) : BigInteger.ZERO;
this.storedItem = new BigIntItemStack(itemStack, amount);
}
use of net.minecraft.nbt.CompoundNBT in project Overloaded by CJ-MC-Mods.
the class TileItemInterface method getUpdatePacket.
@Nullable
@Override
public SUpdateTileEntityPacket getUpdatePacket() {
CompoundNBT tag = new CompoundNBT();
save(tag);
return new SUpdateTileEntityPacket(getBlockPos(), 1, tag);
}
use of net.minecraft.nbt.CompoundNBT in project Overloaded by CJ-MC-Mods.
the class LongItemStorage method serializeNBT.
@Override
public CompoundNBT serializeNBT() {
CompoundNBT compound = new CompoundNBT();
if (!longItemStack.getItemStack().isEmpty()) {
ItemStack stack = longItemStack.getItemStack();
stack.setCount(1);
compound.put("Item", stack.serializeNBT());
compound.putLong("Count", longItemStack.getAmount());
}
return compound;
}
use of net.minecraft.nbt.CompoundNBT in project Overloaded by CJ-MC-Mods.
the class LongItemStorage method deserializeNBT.
@Override
public void deserializeNBT(CompoundNBT compound) {
ItemStack storedItem = compound.contains("Item") ? ItemStack.of((CompoundNBT) compound.get("Item")) : null;
if (storedItem != null) {
long storedAmount = compound.contains("Count") ? compound.getLong("Count") : 0L;
longItemStack = new LongItemStack(storedItem, storedAmount);
}
}
use of net.minecraft.nbt.CompoundNBT in project Overloaded by CJ-MC-Mods.
the class IntEnergyWrapper method getStorage.
@Nonnull
private EnergyStorage getStorage() {
if (stack.getTag() == null) {
Overloaded.logger.error((CharSequence) "Something has changed private internal state in an invalid way. Resetting State.", new IllegalStateException("private internal state changed. Stack's Tag Compound is null"));
stack.setTag(new CompoundNBT());
}
int energy = stack.getTag().getInt("IntEnergyStorage");
return new EnergyStorage(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, energy);
}
Aggregations