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.event.FMLPreInitializationEvent;
|
||||||
import cpw.mods.fml.common.network.NetworkMod;
|
import cpw.mods.fml.common.network.NetworkMod;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.Item;
|
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)
|
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerSilicon.class, clientSideRequired = true, serverSideRequired = true)
|
||||||
public class BuildCraftSilicon {
|
public class BuildCraftSilicon {
|
||||||
|
|
||||||
public static Item redstoneChipset;
|
public static ItemRedstoneChipset redstoneChipset;
|
||||||
public static BlockLaser laserBlock;
|
public static BlockLaser laserBlock;
|
||||||
public static BlockLaserTable assemblyTableBlock;
|
public static BlockLaserTable assemblyTableBlock;
|
||||||
@Instance("BuildCraft|Silicon")
|
@Instance("BuildCraft|Silicon")
|
||||||
|
@ -72,7 +71,7 @@ public class BuildCraftSilicon {
|
||||||
redstoneChipset = new ItemRedstoneChipset(redstoneChipsetId.getInt());
|
redstoneChipset = new ItemRedstoneChipset(redstoneChipsetId.getInt());
|
||||||
redstoneChipset.setUnlocalizedName("redstoneChipset");
|
redstoneChipset.setUnlocalizedName("redstoneChipset");
|
||||||
CoreProxy.proxy.registerItem(redstoneChipset);
|
CoreProxy.proxy.registerItem(redstoneChipset);
|
||||||
|
redstoneChipset.registerItemStacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package buildcraft.core;
|
package buildcraft.core;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -10,8 +11,8 @@ import net.minecraft.util.Icon;
|
||||||
|
|
||||||
public class ItemRedstoneChipset extends ItemBuildCraft {
|
public class ItemRedstoneChipset extends ItemBuildCraft {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private Icon[] icons;
|
private Icon[] icons;
|
||||||
|
|
||||||
public ItemRedstoneChipset(int i) {
|
public ItemRedstoneChipset(int i) {
|
||||||
super(i);
|
super(i);
|
||||||
|
@ -20,10 +21,10 @@ public class ItemRedstoneChipset extends ItemBuildCraft {
|
||||||
setMaxDamage(0);
|
setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "all" })
|
@SuppressWarnings({"all"})
|
||||||
@Override
|
@Override
|
||||||
public Icon getIconFromDamage(int i) {
|
public Icon getIconFromDamage(int i) {
|
||||||
return i < icons.length ? icons[i] : null;
|
return i < icons.length ? icons[i] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,7 +32,7 @@ public class ItemRedstoneChipset extends ItemBuildCraft {
|
||||||
return (new StringBuilder()).append(super.getUnlocalizedName()).append(".").append(itemstack.getItemDamage()).toString();
|
return (new StringBuilder()).append(super.getUnlocalizedName()).append(".").append(itemstack.getItemDamage()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) {
|
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));
|
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
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
public void registerIcons(IconRegister par1IconRegister) {
|
||||||
{
|
icons = new Icon[chipsetNames.length];
|
||||||
icons = new Icon[chipsetNames.length];
|
int i = 0;
|
||||||
int i = 0;
|
for (String csName : chipsetNames) {
|
||||||
for (String csName : chipsetNames) {
|
icons[i++] = par1IconRegister.registerIcon("buildcraft:" + csName + "_chipset");
|
||||||
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