Advertisement
Guest User

Untitled

a guest
Jan 18th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. package com.TechDweebGaming.MystTech.crafting;
  2.  
  3. import net.minecraft.init.Items;
  4. import net.minecraft.item.ItemStack;
  5.  
  6. import com.TechDweebGaming.MystTech.item.ModItems;
  7. import com.TechDweebGaming.MystTech.tileentity.CompressorTileEntity;
  8.  
  9. public class CompressorRecipes {
  10.  
  11. private static CompressorTileEntity te;
  12. static ItemStack CreeperEssence = new ItemStack(ModItems.CreeperEssence);
  13.  
  14. public static void registerCompressorRecipes(ItemStack parItemStackInput, ItemStack parItemStackOutput) {
  15. //Detect if output slot is empty
  16. if (parItemStackOutput == null) {
  17. if (parItemStackInput.isItemEqual(CreeperEssence)) {
  18. if (haveEnoughEnergy(2500) == true) {
  19. processCompression(new ItemStack(Items.skull, 1, 4), 2500);
  20. }
  21. }
  22. }
  23. }
  24.  
  25. public static boolean haveEnoughEnergy(int energyUsage) {
  26. if (te.EnergyBuffer > energyUsage) {
  27. return true;
  28. } else {
  29. return false;
  30. }
  31. }
  32.  
  33. public static void processCompression(ItemStack parItemStackOutput, int energyUsage) {
  34. //Consume Power
  35. int prevEnergyBuffer = te.EnergyBuffer;
  36. te.EnergyBuffer = prevEnergyBuffer - energyUsage;
  37. //Process Items
  38. te.setInventorySlotContents(0, null);
  39. te.setInventorySlotContents(1, parItemStackOutput);
  40. te.markDirty();
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement