diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2018-05-14 00:50:21 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2018-05-14 00:50:21 +1000 |
commit | 033e0873de4ff7a3646c76bfcc03447047b3f05b (patch) | |
tree | b6e15e033e1cbe494e38f30a269309b373416668 /src/Java/gtPlusPlus/core/item | |
parent | 8381aaa4973f893ea7d3210dfe0720d20d011295 (diff) | |
download | GT5-Unofficial-033e0873de4ff7a3646c76bfcc03447047b3f05b.tar.gz GT5-Unofficial-033e0873de4ff7a3646c76bfcc03447047b3f05b.tar.bz2 GT5-Unofficial-033e0873de4ff7a3646c76bfcc03447047b3f05b.zip |
+ Added better processing for LFTR Molten Salts.
% Cleaned up material generation slightly.
$ Rewrote Dust base item class, old items will automatically swap into their new form upon world load.
$ Added MissingMappingsEvent handler to try handle dust transition.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
4 files changed, 137 insertions, 8 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 0f7c28d98d..e90fff3b89 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -380,7 +380,7 @@ public final class ModItems { //MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().RADON, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().FRANCIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().RADIUM, false); - //MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROMETHIUM, false); + MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROMETHIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().ACTINIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROTACTINIUM, false); MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().NEPTUNIUM, false); //LFTR byproduct @@ -449,9 +449,9 @@ public final class ModItems { MaterialGenerator.generateNuclearMaterial(FLUORIDES.SELENIUM_HEXAFLUORIDE); //Generate Reactor Fuel Salts - MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ZrF4U235); - MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ZrF4UF4); - MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ThF4UF4); + MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ZrF4U235, false); + MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ZrF4UF4, false); + MaterialGenerator.generateNuclearMaterial(NUCLIDE.LiFBeF2ThF4UF4, false); //Generate some Alloys diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 4a1bafb251..558a0605fe 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -54,6 +54,7 @@ public class BaseItemComponent extends Item{ //this.setTextureName(this.getCorrectTextures()); this.componentColour = material.getRgbAsHex(); GameRegistry.registerItem(this, this.unlocalName); + if (componentType != ComponentTypes.DUST) GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); if (LoadedMods.Thaumcraft) { ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.METALLUM, 1); @@ -224,6 +225,8 @@ public class BaseItemComponent extends Item{ public static enum ComponentTypes { DUST("Dust", " Dust", "dust"), + DUSTSMALL("DustSmall", " Dust", "dustSmall"), + DUSTTINY("DustTiny", " Dust", "dustTiny"), INGOT("Ingot", " Ingot", "ingot"), HOTINGOT("HotIngot", " Hot Ingot", "ingotHot"), PLATE("Plate", " Plate", "plate"), diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 59d97c306d..10f5e0165e 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -17,6 +17,7 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.math.MathUtils; @@ -38,7 +39,6 @@ public class BaseItemDust extends Item{ public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, int sRadioactivity, boolean addRecipes) { this.setUnlocalizedName(unlocalizedName); - this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(64); this.setTextureName(this.getCorrectTexture(pileSize)); @@ -238,7 +238,7 @@ public class BaseItemDust extends Item{ Logger.WARNING("Adding recipe for Hot "+this.materialName+" Ingots in a Blast furnace."); final String tempIngot = temp.replace("ingot", "ingotHot"); final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack){ + if (null != tempOutputStack && tempOutputStack != ItemUtils.getSimpleStack(ModItems.AAA_Broken)){ Logger.WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot); this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*this.mTier); } @@ -247,7 +247,7 @@ public class BaseItemDust extends Item{ Logger.WARNING("Adding recipe for "+this.materialName+" Ingots in a furnace."); final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); //Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp); - if (null != tempOutputStack){ + if (null != tempOutputStack && tempOutputStack != ItemUtils.getSimpleStack(ModItems.AAA_Broken)){ if ((this.mTier < 5) || !this.dustInfo.requiresBlastFurnace()){ if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), tempOutputStack)){ Logger.WARNING("Successfully added a furnace recipe for "+this.materialName); @@ -259,7 +259,7 @@ public class BaseItemDust extends Item{ else if ((this.mTier >= 5) || this.dustInfo.requiresBlastFurnace()){ Logger.WARNING("Adding recipe for "+this.materialName+" Ingots in a Blast furnace."); Logger.WARNING("This will produce "+tempOutputStack.getDisplayName()); - if (null != tempOutputStack){ + if (null != tempOutputStack && tempOutputStack != ItemUtils.getSimpleStack(ModItems.AAA_Broken)){ this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*this.mTier); } return; diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java new file mode 100644 index 0000000000..0757177e58 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java @@ -0,0 +1,126 @@ +package gtPlusPlus.core.item.base.dusts; + +import java.util.*; + +import org.apache.commons.lang3.StringUtils; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import gregtech.api.enums.TextureSet; +import gregtech.api.util.GT_OreDictUnificator; + +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.minecraft.ItemUtils; + +public class BaseItemDustEx extends BaseItemComponent{ + + public static Map<String, String> mCachedPileLinkages = new HashMap<String, String>(); + + protected IIcon[] baseAr = new IIcon[3]; + protected IIcon[] overlayAr = new IIcon[3]; + public final static ComponentTypes[] componentTypeAr = new ComponentTypes[] {ComponentTypes.DUST, ComponentTypes.DUSTSMALL, ComponentTypes.DUSTTINY}; + + public BaseItemDustEx(final Material material) { + super(material, componentTypeAr[0]); + //OreDict this beauty + GT_OreDictUnificator.registerOre(componentTypeAr[0].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1)); + GT_OreDictUnificator.registerOre(componentTypeAr[1].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1)); + GT_OreDictUnificator.registerOre(componentTypeAr[2].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1)); + bakeRegistry(); + } + + private void bakeRegistry() { + String unlocalName = getUnlocalizedName(); + if (unlocalName.contains("item.")) { + unlocalName = StringUtils.remove(unlocalName, "item."); + } + if (unlocalName.contains("itemDust")) { + unlocalName = StringUtils.remove(unlocalName, "itemDust"); + } + mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDust"+unlocalName); + mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDustSmall"+unlocalName); + mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDustTiny"+unlocalName); + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 3; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public IIcon getIconFromDamageForRenderPass(int meta, int pass) { + if (CORE.ConfigSwitches.useGregtechTextures) { + if (meta == 0) { + if (pass == 0) { + return this.baseAr[0]; + } + else { + return this.overlayAr[0]; + } + } + else if (meta == 1) { + if (pass == 0) { + return this.baseAr[1]; + } + else { + return this.overlayAr[1]; + } + } + else { + if (pass == 0) { + return this.baseAr[2]; + } + else { + return this.overlayAr[2]; + } + } + } + else { + return this.baseAr[meta]; + } + } + + @Override + public void registerIcons(final IIconRegister i) { + if (CORE.ConfigSwitches.useGregtechTextures){ + this.baseAr[0] = i.registerIcon(getCorrectTextures()); + this.overlayAr[0] = i.registerIcon(getCorrectTextures() + "_OVERLAY"); + this.baseAr[1] = i.registerIcon(getCorrectTextures()+"Small"); + this.overlayAr[1] = i.registerIcon(getCorrectTextures() + "Small_OVERLAY"); + this.baseAr[2] = i.registerIcon(getCorrectTextures()+"Tiny"); + this.overlayAr[2] = i.registerIcon(getCorrectTextures() + "Tiny_OVERLAY"); + } + else { + this.baseAr[0] = i.registerIcon(getCorrectTextures()); + this.baseAr[1] = i.registerIcon(getCorrectTextures()+"Small"); + this.baseAr[2] = i.registerIcon(getCorrectTextures()+"Tiny"); + } + } + + @Override + public String getCorrectTextures(){ + if (!CORE.ConfigSwitches.useGregtechTextures){ + return CORE.MODID + ":" + "item"+this.componentType.getComponent(); + } + String metType = "9j4852jyo3rjmh3owlhw9oe"; + if (this.componentMaterial != null) { + TextureSet u = this.componentMaterial.getTextureSet(); + if (u != null) { + metType = u.mSetName; + } + } + metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType); + return "gregtech" + ":" + "materialicons/"+metType+"/" + this.componentType.getOreDictName(); + } + + +} |