Fixed regression preventing to refill an air canister component

This commit is contained in:
Unknown 2019-02-01 01:08:07 +01:00 committed by unknown
parent f14885ee6c
commit cb8d911cd2
2 changed files with 12 additions and 11 deletions

View file

@ -80,29 +80,30 @@ public class ItemAirTank extends ItemAbstractBase implements IAirContainerItem {
@Override
public int getAirTicksPerConsumption(final ItemStack itemStack) {
if ( itemStack == null
|| itemStack.getItem() != this ) {
if ( itemStack != null
&& itemStack.getItem() != this ) {
return 0;
}
return WarpDriveConfig.BREATHING_AIR_TANK_BREATH_DURATION_TICKS;
}
@SuppressWarnings("deprecation")
@Override
public ItemStack getEmptyAirContainer(final ItemStack itemStack) {
if ( itemStack == null
|| itemStack.getItem() != this ) {
if ( itemStack != null
&& itemStack.getItem() != this ) {
return itemStack;
}
return new ItemStack(itemStack.getItem(), 1, itemStack.getMaxDamage());
return new ItemStack(this, 1, getMaxDamage());
}
@Override
public ItemStack getFullAirContainer(final ItemStack itemStack) {
if ( itemStack == null
|| itemStack.getItem() != this ) {
if ( itemStack != null
&& itemStack.getItem() != this ) {
return itemStack;
}
return new ItemStack(itemStack.getItem(), 1);
return new ItemStack(this, 1);
}
@Override

View file

@ -112,7 +112,7 @@ public class ItemComponent extends ItemAbstractBase implements IAirContainerItem
@Override
public int getAirTicksPerConsumption(final ItemStack itemStack) {
if (canContainAir(itemStack)) {
return WarpDrive.itemAirTanks[0].getAirTicksPerConsumption(itemStack);
return WarpDrive.itemAirTanks[0].getAirTicksPerConsumption(new ItemStack(WarpDrive.itemAirTanks[0]));
} else {
return 0;
}
@ -121,7 +121,7 @@ public class ItemComponent extends ItemAbstractBase implements IAirContainerItem
@Override
public ItemStack getFullAirContainer(final ItemStack itemStack) {
if (canContainAir(itemStack)) {
return WarpDrive.itemAirTanks[0].getFullAirContainer(itemStack);
return WarpDrive.itemAirTanks[0].getFullAirContainer(new ItemStack(WarpDrive.itemAirTanks[0]));
}
return null;
}
@ -129,7 +129,7 @@ public class ItemComponent extends ItemAbstractBase implements IAirContainerItem
@Override
public ItemStack getEmptyAirContainer(final ItemStack itemStack) {
if (canContainAir(itemStack)) {
return WarpDrive.itemAirTanks[0].getEmptyAirContainer(itemStack);
return WarpDrive.itemAirTanks[0].getEmptyAirContainer(new ItemStack(WarpDrive.itemAirTanks[0]));
}
return null;
}