Fixed item and fluid storage stored count having incorrect values, fixes #283

This commit is contained in:
Raoul Van den Berge
2016-08-30 02:30:39 +02:00
parent 4a750c3352
commit c4c54d6648
3 changed files with 5 additions and 4 deletions

View File

@@ -78,7 +78,7 @@ public abstract class FluidStorageNBT implements IFluidStorage {
}
@Override
public FluidStack insertFluid(FluidStack stack, int size, boolean simulate) {
public synchronized FluidStack insertFluid(FluidStack stack, int size, boolean simulate) {
for (FluidStack otherStack : stacks) {
if (otherStack.isFluidEqual(stack)) {
if (getCapacity() != -1 && getStored() + size > getCapacity()) {
@@ -141,7 +141,7 @@ public abstract class FluidStorageNBT implements IFluidStorage {
}
@Override
public FluidStack extractFluid(FluidStack stack, int size, int flags) {
public synchronized FluidStack extractFluid(FluidStack stack, int size, int flags) {
for (FluidStack otherStack : stacks) {
if (CompareUtils.compareStack(otherStack, stack, flags)) {
if (size > otherStack.amount) {

View File

@@ -115,7 +115,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
}
@Override
public ItemStack insertItem(ItemStack stack, int size, boolean simulate) {
public synchronized ItemStack insertItem(ItemStack stack, int size, boolean simulate) {
for (ItemStack otherStack : stacks) {
if (CompareUtils.compareStackNoQuantity(otherStack, stack)) {
if (getCapacity() != -1 && getStored() + size > getCapacity()) {
@@ -178,7 +178,7 @@ public abstract class ItemStorageNBT implements IItemStorage {
}
@Override
public ItemStack extractItem(ItemStack stack, int size, int flags) {
public synchronized ItemStack extractItem(ItemStack stack, int size, int flags) {
for (ItemStack otherStack : stacks) {
if (CompareUtils.compareStack(otherStack, stack, flags)) {
if (size > otherStack.stackSize) {