use of com.cjm721.overloaded.storage.stacks.bigint.BigIntItemStack 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 com.cjm721.overloaded.storage.stacks.bigint.BigIntItemStack in project Overloaded by CJ-MC-Mods.
the class BigIntItemStorage method give.
@Nonnull
@Override
public LongItemStack give(@Nonnull LongItemStack stack, boolean doAction) {
if (storedItem.itemStack.isEmpty()) {
if (doAction) {
storedItem = new BigIntItemStack(stack.getItemStack(), BigInteger.valueOf(stack.getAmount()));
dataUpdate.dataUpdated();
}
return LongItemStack.EMPTY_STACK;
}
if (ItemHandlerHelper.canItemStacksStack(storedItem.itemStack, stack.getItemStack())) {
if (doAction) {
storedItem.amount = storedItem.amount.add(BigInteger.valueOf(stack.getAmount()));
dataUpdate.dataUpdated();
}
return LongItemStack.EMPTY_STACK;
}
return stack;
}
Aggregations