Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void update() {
- ItemStack input = this.getStackInSlot(0);
- ItemStack output = this.getStackInSlot(1);
- //ItemStacks
- ItemStack CreeperEssence = new ItemStack(ModItems.CreeperEssence);
- ItemStack CreeperSkull = new ItemStack(Items.skull, 1, 4);
- ItemStack Bone = new ItemStack(Items.bone);
- ItemStack Bonemeal = new ItemStack(Items.dye, 5, 15);
- //Running Check
- if(input != null) {
- //SYNTAX FOR NEW COMPRESSOR RECIPES (anything in <> you fill in!)
- //this.checkCompressorRecipes(input, output, <Ingredient>, <Result>, <Power Usage>);
- this.checkCompressorRecipes(input, output, CreeperEssence, CreeperSkull, 2500);
- this.checkCompressorRecipes(input, output, Bone, Bonemeal, 500);
- //this.checkCompressorRecipes(input, output, Bonemeal, Bone, 500);
- }
- }
- public boolean haveEnoughEnergy(int energyUsage) {
- if (EnergyBuffer > energyUsage) {
- return true;
- } else {
- return false;
- }
- }
- public void processCompression(ItemStack parItemStackOutput, int energyUsage) {
- //Consume Power
- int prevEnergyBuffer = EnergyBuffer;
- EnergyBuffer = prevEnergyBuffer - energyUsage;
- //Process Items
- setInventorySlotContents(0, null);
- setInventorySlotContents(1, parItemStackOutput);
- markDirty();
- }
- public void checkCompressorRecipes(ItemStack parItemStackInput, ItemStack parItemStackOutput, ItemStack reqItemStackInput, ItemStack reqItemStackOutput, int energyCost) {
- //Detect if output slot is empty
- if (parItemStackOutput == null) {
- if (parItemStackInput.stackSize > 1) {
- } else {
- //Detect if sufficient power is present
- if (haveEnoughEnergy(energyCost) == true ) {
- //Goes Through lists of items it can craft
- if (parItemStackInput.isItemEqual(reqItemStackInput)) {
- processCompression(reqItemStackOutput, energyCost);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment