Fixed Gas Masks not working
This commit is contained in:
parent
4354357462
commit
62be3523d7
3 changed files with 19 additions and 4 deletions
|
@ -357,7 +357,7 @@ public class ClientTickHandler
|
|||
final int max = 300;
|
||||
|
||||
tank.useGas(mc.thePlayer.getEquipmentInSlot(3));
|
||||
GasStack received = tank.removeGas(mc.thePlayer.getEquipmentInSlot(3), max-mc.thePlayer.getAir());
|
||||
GasStack received = tank.useGas(mc.thePlayer.getEquipmentInSlot(3), max-mc.thePlayer.getAir());
|
||||
|
||||
if(received != null)
|
||||
{
|
||||
|
|
|
@ -102,7 +102,7 @@ public class CommonPlayerTickHandler
|
|||
final int max = 300;
|
||||
|
||||
tank.useGas(player.getEquipmentInSlot(3));
|
||||
GasStack received = tank.removeGas(player.getEquipmentInSlot(3), max-player.getAir());
|
||||
GasStack received = tank.useGas(player.getEquipmentInSlot(3), max-player.getAir());
|
||||
|
||||
if(received != null)
|
||||
{
|
||||
|
|
|
@ -75,9 +75,24 @@ public class ItemScubaTank extends ItemArmor implements IGasItem
|
|||
return model;
|
||||
}
|
||||
|
||||
public void useGas(ItemStack stack)
|
||||
public void useGas(ItemStack itemstack)
|
||||
{
|
||||
setGas(stack, new GasStack(getGas(stack).getGas(), getGas(stack).amount-1));
|
||||
setGas(itemstack, new GasStack(getGas(itemstack).getGas(), getGas(itemstack).amount-1));
|
||||
}
|
||||
|
||||
public GasStack useGas(ItemStack itemstack, int amount)
|
||||
{
|
||||
if(getGas(itemstack) == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Gas type = getGas(itemstack).getGas();
|
||||
|
||||
int gasToUse = Math.min(getStored(itemstack), Math.min(getRate(itemstack), amount));
|
||||
setGas(itemstack, new GasStack(type, getStored(itemstack)-gasToUse));
|
||||
|
||||
return new GasStack(type, gasToUse);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue