Register chipset stacks with FML for good measure
This commit is contained in:
parent
9074f10c1d
commit
bdf93e12ba
2 changed files with 21 additions and 16 deletions
|
@ -32,7 +32,6 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
|||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -43,7 +42,7 @@ import net.minecraftforge.common.Property;
|
|||
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerSilicon.class, clientSideRequired = true, serverSideRequired = true)
|
||||
public class BuildCraftSilicon {
|
||||
|
||||
public static Item redstoneChipset;
|
||||
public static ItemRedstoneChipset redstoneChipset;
|
||||
public static BlockLaser laserBlock;
|
||||
public static BlockLaserTable assemblyTableBlock;
|
||||
@Instance("BuildCraft|Silicon")
|
||||
|
@ -72,7 +71,7 @@ public class BuildCraftSilicon {
|
|||
redstoneChipset = new ItemRedstoneChipset(redstoneChipsetId.getInt());
|
||||
redstoneChipset.setUnlocalizedName("redstoneChipset");
|
||||
CoreProxy.proxy.registerItem(redstoneChipset);
|
||||
|
||||
redstoneChipset.registerItemStacks();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package buildcraft.core;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
@ -10,8 +11,8 @@ import net.minecraft.util.Icon;
|
|||
|
||||
public class ItemRedstoneChipset extends ItemBuildCraft {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[] icons;
|
||||
@SideOnly(Side.CLIENT)
|
||||
private Icon[] icons;
|
||||
|
||||
public ItemRedstoneChipset(int i) {
|
||||
super(i);
|
||||
|
@ -20,10 +21,10 @@ public class ItemRedstoneChipset extends ItemBuildCraft {
|
|||
setMaxDamage(0);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
@SuppressWarnings({"all"})
|
||||
@Override
|
||||
public Icon getIconFromDamage(int i) {
|
||||
return i < icons.length ? icons[i] : null;
|
||||
return i < icons.length ? icons[i] : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -31,7 +32,7 @@ public class ItemRedstoneChipset extends ItemBuildCraft {
|
|||
return (new StringBuilder()).append(super.getUnlocalizedName()).append(".").append(itemstack.getItemDamage()).toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
|
@ -39,16 +40,21 @@ public class ItemRedstoneChipset extends ItemBuildCraft {
|
|||
itemList.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
private static String[] chipsetNames = {"redstone_red", "redstone_iron", "redstone_gold", "redstone_diamond", "redstone_pulsating"};
|
||||
|
||||
private static String[] chipsetNames = { "redstone_red", "redstone_iron", "redstone_gold", "redstone_diamond", "redstone_pulsating" };
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
icons = new Icon[chipsetNames.length];
|
||||
int i = 0;
|
||||
for (String csName : chipsetNames) {
|
||||
icons[i++] = par1IconRegister.registerIcon("buildcraft:"+csName+"_chipset");
|
||||
}
|
||||
public void registerIcons(IconRegister par1IconRegister) {
|
||||
icons = new Icon[chipsetNames.length];
|
||||
int i = 0;
|
||||
for (String csName : chipsetNames) {
|
||||
icons[i++] = par1IconRegister.registerIcon("buildcraft:" + csName + "_chipset");
|
||||
}
|
||||
}
|
||||
|
||||
public void registerItemStacks() {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
GameRegistry.registerCustomItemStack(chipsetNames[i] + "_chipset", new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue