mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 23:03:01 +00:00
Fixed Gas Masks not working
This commit is contained in:
1 parent
4354357462
commit
62be3523d7
3 files changed
+19
-4
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user