Guest User

Untitled

a guest
Jan 21st, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. @Override
  2. public void update() {
  3. ItemStack input = this.getStackInSlot(0);
  4. ItemStack output = this.getStackInSlot(1);
  5. //ItemStacks
  6. ItemStack CreeperEssence = new ItemStack(ModItems.CreeperEssence);
  7. ItemStack CreeperSkull = new ItemStack(Items.skull, 1, 4);
  8. ItemStack Bone = new ItemStack(Items.bone);
  9. ItemStack Bonemeal = new ItemStack(Items.dye, 5, 15);
  10. //Running Check
  11. if(input != null) {
  12. //SYNTAX FOR NEW COMPRESSOR RECIPES (anything in <> you fill in!)
  13. //this.checkCompressorRecipes(input, output, <Ingredient>, <Result>, <Power Usage>);
  14. this.checkCompressorRecipes(input, output, CreeperEssence, CreeperSkull, 2500);
  15. this.checkCompressorRecipes(input, output, Bone, Bonemeal, 500);
  16. //this.checkCompressorRecipes(input, output, Bonemeal, Bone, 500);
  17. }
  18. }
  19.  
  20. public boolean haveEnoughEnergy(int energyUsage) {
  21. if (EnergyBuffer > energyUsage) {
  22. return true;
  23. } else {
  24. return false;
  25. }
  26. }
  27.  
  28. public void processCompression(ItemStack parItemStackOutput, int energyUsage) {
  29. //Consume Power
  30. int prevEnergyBuffer = EnergyBuffer;
  31. EnergyBuffer = prevEnergyBuffer - energyUsage;
  32. //Process Items
  33. setInventorySlotContents(0, null);
  34. setInventorySlotContents(1, parItemStackOutput);
  35. markDirty();
  36. }
  37.  
  38. public void checkCompressorRecipes(ItemStack parItemStackInput, ItemStack parItemStackOutput, ItemStack reqItemStackInput, ItemStack reqItemStackOutput, int energyCost) {
  39. //Detect if output slot is empty
  40. if (parItemStackOutput == null) {
  41. if (parItemStackInput.stackSize > 1) {
  42. } else {
  43. //Detect if sufficient power is present
  44. if (haveEnoughEnergy(energyCost) == true ) {
  45. //Goes Through lists of items it can craft
  46. if (parItemStackInput.isItemEqual(reqItemStackInput)) {
  47. processCompression(reqItemStackOutput, energyCost);
  48. }
  49. }
  50. }
  51. }
  52. }
Add Comment
Please, Sign In to add comment