Last active
September 19, 2019 13:57
-
-
Save matyklug18/6974328a415d1a9352ae749158d1f75d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package matyk.aqarium2.recipes; | |
import matyk.aqarium2.eventHandler.EventHandler; | |
import net.minecraft.inventory.InventoryCrafting; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.item.crafting.IRecipe; | |
import net.minecraft.nbt.NBTTagCompound; | |
import net.minecraft.util.ResourceLocation; | |
import net.minecraft.world.World; | |
import net.minecraftforge.registries.IForgeRegistryEntry; | |
public class GemRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe { | |
@Override | |
public boolean matches(InventoryCrafting inv, World worldIn) { | |
inv.getStackInSlot(0).getItem().equals(EventHandler.gem); | |
return true; | |
} | |
@Override | |
public ItemStack getCraftingResult(InventoryCrafting inv) { | |
ItemStack result = new ItemStack(EventHandler.gem); | |
NBTTagCompound cmpd = new NBTTagCompound(); | |
cmpd.setInteger("red", inv.getStackInSlot(0).getTagCompound().getInteger("red")); | |
cmpd.setInteger("green", inv.getStackInSlot(0).getTagCompound().getInteger("green")); | |
cmpd.setInteger("blue", inv.getStackInSlot(0).getTagCompound().getInteger("blue")); | |
result.setTagCompound(cmpd); | |
//result.setTagCompound(inv.getStackInSlot(0).getTagCompound()); | |
return result; | |
} | |
@Override | |
public boolean canFit(int width, int height) { | |
return width >= 1 && height >= 1; | |
} | |
@Override | |
public ItemStack getRecipeOutput() { | |
ItemStack stack = new ItemStack(EventHandler.gem); | |
NBTTagCompound cmpd = new NBTTagCompound(); | |
cmpd.setInteger("red", 0); | |
cmpd.setInteger("green", 0); | |
cmpd.setInteger("blue", 0); | |
stack.setTagCompound(cmpd); | |
return stack; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment