diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r-- | src/Java/gtPlusPlus/core/item/ModItems.java | 5 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java | 34 |
2 files changed, 32 insertions, 7 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index cc9ca0e9e6..f84ebaff05 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -23,6 +23,7 @@ import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.material.*; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.debug.DEBUG_INIT; +import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.*; import net.minecraft.item.Item.ToolMaterial; @@ -348,7 +349,9 @@ public final class ModItems { //FLiBe Fuel Compounds dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Li2BeF4 Fuel Compound", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/FLiBe - + FluidUtils.generateFluid("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}); + + metaItem2 = new BaseEuItem(); metaItem2.registerItem(0, EnumChatFormatting.BLACK+"Test Item 0", 0, 0, "I am 0."); metaItem2.registerItem(1, EnumChatFormatting.GREEN+"Test Item 1", 1006346000, 1, "I Hold EU 1.", 500); diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index ee9d451948..a0216771b9 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -6,6 +6,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.entity.EntityUtils; import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.math.MathUtils; import java.util.List; @@ -23,6 +24,7 @@ public class BaseItemComponent extends Item{ public final String materialName; public final String unlocalName; public final ComponentTypes componentType; + public final int componentColour; public BaseItemComponent(Material material, ComponentTypes componentType) { this.componentMaterial = material; @@ -33,14 +35,32 @@ public class BaseItemComponent extends Item{ this.setUnlocalizedName(unlocalName); this.setMaxStackSize(64); this.setTextureName(CORE.MODID + ":" + "item"+componentType.COMPONENT_NAME); + this.componentColour = material.getRgbAsHex(); GameRegistry.registerItem(this, unlocalName); GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); } + //For Cell Generation + public BaseItemComponent(String unlocalName, String localName, short[] RGBA) { + this.componentMaterial = null; + this.unlocalName = "itemCell"+unlocalName; + this.materialName = localName; + this.componentType = ComponentTypes.CELL; + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName(unlocalName); + this.setMaxStackSize(64); + this.componentColour = MathUtils.getRgbAsHex(RGBA); + this.setTextureName(CORE.MODID + ":" + "item"+ComponentTypes.CELL.COMPONENT_NAME); + GameRegistry.registerItem(this, unlocalName); + GT_OreDictUnificator.registerOre(ComponentTypes.CELL.getOreDictName()+unlocalName, ItemUtils.getSimpleStack(this)); + } + @Override public String getItemStackDisplayName(ItemStack p_77653_1_) { + if (componentMaterial != null) return (componentMaterial.getLocalizedName()+componentType.DISPLAY_NAME); + return materialName+" Cell"; } public final String getMaterialName() { @@ -51,7 +71,7 @@ public class BaseItemComponent extends Item{ @Override public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ + if (materialName != null && materialName != "" && !materialName.equals("") && componentMaterial != null){ if (componentType == ComponentTypes.DUST){ @@ -102,12 +122,14 @@ public class BaseItemComponent extends Item{ @Override public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return componentMaterial.getRgbAsHex(); + return componentColour; } @Override public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(componentMaterial.vRadioationLevel, world, entityHolding); + if (componentMaterial != null){ + EntityUtils.applyRadiationDamageToEntity(componentMaterial.vRadioationLevel, world, entityHolding); + } } @@ -148,11 +170,11 @@ public class BaseItemComponent extends Item{ public String getName(){ return DISPLAY_NAME; } - + public String getOreDictName(){ - return OREDICT_NAME; + return OREDICT_NAME; } - + } } |