-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Mordenkainen/0.3_Dev
0.3 dev
- Loading branch information
Showing
15 changed files
with
309 additions
and
31 deletions.
There are no files selected for viewing
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
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
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
46 changes: 46 additions & 0 deletions
46
src/main/java/com/mordenkainen/equivalentenergistics/items/ItemPattern.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.mordenkainen.equivalentenergistics.items; | ||
|
||
import com.mordenkainen.equivalentenergistics.EquivalentEnergistics; | ||
import com.mordenkainen.equivalentenergistics.lib.Ref; | ||
import com.mordenkainen.equivalentenergistics.util.CrystalCraftingPattern; | ||
import com.mordenkainen.equivalentenergistics.util.EMCCraftingPattern; | ||
|
||
import net.minecraft.client.renderer.texture.IIconRegister; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.world.World; | ||
import appeng.api.implementations.ICraftingPatternItem; | ||
import appeng.api.networking.crafting.ICraftingPatternDetails; | ||
|
||
public class ItemPattern extends Item implements ICraftingPatternItem { | ||
|
||
public ItemPattern() { | ||
super(); | ||
setMaxStackSize(1); | ||
setUnlocalizedName(Ref.getId("EMCPattern")); | ||
} | ||
|
||
@Override | ||
public ICraftingPatternDetails getPatternForItem(ItemStack paramItemStack, World paramWorld) { | ||
ItemStack target = ItemStack.loadItemStackFromNBT(paramItemStack.getTagCompound()); | ||
if(target.getItem() == EquivalentEnergistics.itemEMCCrystal) { | ||
return new CrystalCraftingPattern(target.getItemDamage()); | ||
} else { | ||
return new EMCCraftingPattern(target); | ||
} | ||
} | ||
|
||
public void setTargetItem(ItemStack pattern, ItemStack target) { | ||
if(!pattern.hasTagCompound()) { | ||
pattern.stackTagCompound = new NBTTagCompound(); | ||
} | ||
target.writeToNBT(pattern.getTagCompound()); | ||
} | ||
|
||
@Override | ||
public void registerIcons(IIconRegister reg) { | ||
itemIcon = reg.registerIcon(Ref.TEXTURE_PREFIX + "EMCPattern"); | ||
} | ||
|
||
} |
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
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
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
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
Oops, something went wrong.