aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java
new file mode 100644
index 0000000000..9cf3f796df
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java
@@ -0,0 +1,44 @@
+package gtPlusPlus.core.item.base.itemblock;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemBlockWithMetadata;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class ItemBlockMeta extends ItemBlockWithMetadata
+{
+ private final Block mBlock;
+
+ public ItemBlockMeta(final Block p_i45326_1_)
+ {
+ super(p_i45326_1_, p_i45326_1_);
+ this.mBlock = p_i45326_1_;
+ this.setMaxDamage(0);
+ this.setHasSubtypes(true);
+ }
+
+ /**
+ * Gets an icon index based on an item's damage value
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(final int p_77617_1_)
+ {
+ return this.mBlock.getIcon(2, p_77617_1_);
+ }
+
+ /**
+ * Returns the metadata of the block which this Item (ItemBlock) can place
+ */
+ @Override
+ public int getMetadata(final int p_77647_1_)
+ {
+ return p_77647_1_;
+ }
+
+ @Override
+ public String getUnlocalizedName(final ItemStack stack) {
+ return this.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+} \ No newline at end of file