package zmaster587.advancedRocketry.tile.oxygen;

import net.minecraft.item.ItemStack;
import zmaster587.advancedRocketry.api.AdvancedRocketryItems;
import zmaster587.libVulpes.tile.multiblock.hatch.TileInventoryHatch;

public class TileCO2Scrubber extends TileInventoryHatch {
	public TileCO2Scrubber() {
		super(1);
	}
	
	@Override
	public String getModularInventoryName() {
		return "tile.scrubber.name";
	}
	
	@Override
	public int getInventoryStackLimit() {
		return 1;
	}
	
	public boolean useCharge() {
		ItemStack stack = getStackInSlot(0);
		if(stack != null && stack.getItem() == AdvancedRocketryItems.itemCarbonScrubberCartridge) {
			int newDamage = stack.getItemDamage() + 1;
			if(newDamage != stack.getMaxDamage()) {
				stack.setItemDamage(newDamage);
				//this.markDirty();
				return true;
			}
		}
		return false;
	}
}

@@ -643,24 +643,15 @@
 %0A%09%09%09
-int newDamage = 
+%0A%09%09%09if(
 stac
@@ -671,29 +671,8 @@
 ge()
- + 1;%0A%09%09%09if(newDamage
  != 
@@ -723,17 +723,33 @@
 age(
-newDamage
+stack.getItemDamage() + 1
 );%0A%09

fix off by one with the CO2 cartridge, see #832