mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +00:00
1.6.2 test - Finished liquids, added connected textures on glass
This commit is contained in:
1 parent
40c6f445a2
commit
a80fcbce86
704 files changed
+60909
No files matched your search
@@ -0,0 +1,67 @@
|
||||
package tconstruct.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CraftingItem extends Item
|
||||
{
|
||||
public String[] textureNames;
|
||||
public String[] unlocalizedNames;
|
||||
public String folder;
|
||||
public Icon[] icons;
|
||||
|
||||
public CraftingItem(int id, String[] names, String[] tex, String folder)
|
||||
{
|
||||
super(id);
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
this.textureNames = tex;
|
||||
this.unlocalizedNames = names;
|
||||
this.folder = folder;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage (int meta)
|
||||
{
|
||||
int arr = MathHelper.clamp_int(meta, 0, unlocalizedNames.length);
|
||||
return icons[arr];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IconRegister iconRegister)
|
||||
{
|
||||
this.icons = new Icon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
if (!(textureNames[i].equals("")))
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
|
||||
return getUnlocalizedName() + "." + unlocalizedNames[arr];
|
||||
}
|
||||
|
||||
public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < unlocalizedNames.length; i++)
|
||||
if (!(textureNames[i].equals("")))
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user