Register chipset stacks with FML for good measure

This commit is contained in:
CovertJaguar 2013-10-26 03:14:23 -07:00
parent 9074f10c1d
commit bdf93e12ba
2 changed files with 21 additions and 16 deletions

View file

@ -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

View file

@ -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;
@ -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"};
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
{
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));
}
}
}