diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-29 05:09:01 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-29 05:09:01 +0000 |
commit | 6205a2088bbbc31a09d0a2a3d460add1a7622801 (patch) | |
tree | 497380cea05b2a394fe303e8fcc2d688bed6f6d1 /src/Java/gtPlusPlus/core/item | |
parent | 7f2c38ccc6fb2734ac6655b9dd7003c4b6dee4a3 (diff) | |
download | GT5-Unofficial-6205a2088bbbc31a09d0a2a3d460add1a7622801.tar.gz GT5-Unofficial-6205a2088bbbc31a09d0a2a3d460add1a7622801.tar.bz2 GT5-Unofficial-6205a2088bbbc31a09d0a2a3d460add1a7622801.zip |
+ Added recipe for heating Titanium Ingots, required for Krypton processing.
+ Added custom GT TextureSets.
$ Lots of small fixes to Material, Material Generation & Recipe Generation.
$ Lots of small fixes to Fluids, Fluid Generation and Fluid Cell Generation.
$ Fixed Creative Tabs.
$ Possibly fixed issue where tickable items would instantly tick to 0.
$ Fixed display names of Throwable Potions.
$ Fixed NPE in removeCrudeTurbineRotors().
% Adjusted lots of textures.
% Adjusted handling of Thermal Foundation Fluids.
% Moved Furnace/EBF and Maceration recipes out of BaseItemDust.java.
% Made Tooltips of GT++ Material Blocks, Frames and ores more informational.
% Made Bromine a Fluid Material, this will remove all Bromine solid material items from the world. (Ingots, Blocks, etc.)
% Increased cost of GT++ Ores in processing.
- Broke lots of recipes.
> EBF/ABS & All Table Crafting. TBA~
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
8 files changed, 415 insertions, 191 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 5b8e8ab2a1..0e21e9b154 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -22,10 +22,12 @@ import gtPlusPlus.core.common.compat.COMPAT_Baubles; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.handler.OldCircuitHandler; import gtPlusPlus.core.item.base.*; +import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes; import gtPlusPlus.core.item.base.foil.BaseItemFoil; import gtPlusPlus.core.item.base.foods.BaseItemFood; import gtPlusPlus.core.item.base.foods.BaseItemHotFood; import gtPlusPlus.core.item.base.gears.BaseItemSmallGear; +import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.ingots.BaseItemIngot_OLD; import gtPlusPlus.core.item.base.misc.BaseItemMisc; import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes; @@ -56,6 +58,7 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.*; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.material.nuclear.NUCLIDE; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.StringUtils; import gtPlusPlus.core.util.debug.DEBUG_INIT; @@ -275,6 +278,8 @@ public final class ModItems { public static Item itemControlCore; + public static ItemStack itemHotTitaniumIngot; + static { Logger.INFO("Items!"); //Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon. @@ -347,7 +352,7 @@ public final class ModItems { itemGemShards = new ItemGemShards("itemGemShards", "Gem Shards", AddToCreativeTab.tabMisc, 32, 0, "They glitter in the light", EnumRarity.rare, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(182, 114, 18)).setTextureName(CORE.MODID + ":itemHeliumBlob"); itemHalfCompleteCasings = new ItemHalfCompleteCasings("itemHalfCompleteCasings", AddToCreativeTab.tabMisc, 32, 0, "This isn't quite finished yet.", EnumRarity.common, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(255, 255, 255)).setTextureName("gregtech" + ":" + "gt.metaitem.01/" + "761"); itemSulfuricPotion = new ItemSulfuricAcidPotion("itemSulfuricPotion", "Throwable Vial of Sulfuric Acid", "Burn your foes alive!").setTextureName(CORE.MODID + ":itemSulfuricAcidPotion"); - itemHydrofluoricPotion = new ItemHydrofluoricAcidPotion("itemHydrofluoricPotion", "Thowable Vial of Hydrofluoric Acid", "They won't see this coming, nor anything after!").setTextureName(CORE.MODID + ":itemPotion"); + itemHydrofluoricPotion = new ItemHydrofluoricAcidPotion("itemHydrofluoricPotion", "Throwable Vial of Hydrofluoric Acid", "They won't see this coming, nor anything after!").setTextureName(CORE.MODID + ":itemPotion"); //Start meta Item Generation ItemsFoods.load(); @@ -599,7 +604,8 @@ public final class ModItems { //FLiBe Fuel Compounds dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Li2BeF4 Fuel Compound", "Li2BeF4", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/FLiBe - fluidFLiBeSalt = FluidUtils.generateFluid("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}); + //fluidFLiBeSalt = ("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}, 0); + fluidFLiBeSalt = FluidUtils.addGTFluidNoPrefix("Li2BeF4", "Li2BeF4", new short[]{255, 255, 255, 100}, 0, 743, null, CI.emptyCells(1), 1000, true); //LFTR Control Circuit itemCircuitLFTR = new CoreItem("itemCircuitLFTR", ""+EnumChatFormatting.GREEN+"Control Circuit", AddToCreativeTab.tabMisc, 1, 0, new String[] {"Keeps Multiblocks Stable"}, EnumRarity.epic, EnumChatFormatting.DARK_GREEN, false, null); @@ -637,10 +643,10 @@ public final class ModItems { temp2 = ItemUtils.getCorrectStacktype("Forestry:fertilizerCompound", 1); } if (temp1 != null){ - FluidUtils.generateFluidNonMolten("Fertiliser", "Fertiliser", 32, new short[]{45, 170, 45, 100}, temp1, temp2); + FluidUtils.generateFluidNonMolten("Fertiliser", "Fertiliser", 32, new short[]{45, 170, 45, 100}, temp1, temp2, true); } - FluidUtils.generateFluidNonMolten("UN32Fertiliser", "UN-32 Fertiliser", 24, new short[]{55, 190, 55, 100}, null, null); - FluidUtils.generateFluidNonMolten("UN18Fertiliser", "UN-18 Fertiliser", 22, new short[]{60, 155, 60, 100}, null, null); + FluidUtils.generateFluidNonMolten("UN32Fertiliser", "UN-32 Fertiliser", 24, new short[]{55, 190, 55, 100}, null, null, true); + FluidUtils.generateFluidNonMolten("UN18Fertiliser", "UN-18 Fertiliser", 22, new short[]{60, 155, 60, 100}, null, null, true); /*GT_Values.RA.addMixerRecipe( arg0, //Item In @@ -657,7 +663,7 @@ public final class ModItems { } //Juice - FluidUtils.generateFluidNonMolten("RaisinJuice", "Raisin Juice", 2, new short[]{51, 0, 51, 100}, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foodRaisins", 1), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("fruitRaisins", 1), 50); + FluidUtils.generateFluidNonMolten("RaisinJuice", "Raisin Juice", 2, new short[]{51, 0, 51, 100}, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foodRaisins", 1), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("fruitRaisins", 1), 50, true); //Test items @@ -688,10 +694,10 @@ public final class ModItems { //Just an unusual plate needed for some black magic. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateClay", 1) == null){ - itemPlateClay = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Clay)); + itemPlateClay = new BaseItemPlate(NONMATERIAL.CLAY); } if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDoubleClay", 1) == null){ - itemDoublePlateClay = new BaseItemPlateDouble(MaterialUtils.generateMaterialFromGtENUM(Materials.Clay)); + itemDoublePlateClay = new BaseItemPlateDouble(NONMATERIAL.CLAY); } //Need this for Mutagenic Frames @@ -701,18 +707,25 @@ public final class ModItems { //A small gear needed for wizardry. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("gearGtSmallWroughtIron", 1) == null){ - itemSmallWroughtIronGear = new BaseItemSmallGear(MaterialUtils.generateMaterialFromGtENUM(Materials.WroughtIron)); + itemSmallWroughtIronGear = new BaseItemSmallGear(NONMATERIAL.WROUGHT_IRON); + } + //Krypton Processing + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1) == null){ + itemHotTitaniumIngot = ItemUtils.getSimpleStack(new BaseItemIngot(ELEMENT.getInstance().TITANIUM, ComponentTypes.HOTINGOT)); + } + else { + itemHotTitaniumIngot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1); } + GT_Values.RA.addBlastRecipe(ELEMENT.getInstance().TITANIUM.getIngot(1), null, itemHotTitaniumIngot, null, 10 * 20, 512, Materials.Titanium.mBlastFurnaceTemp); //Special Sillyness if (true) { if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateSodium", 1) == null){ - new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Sodium)); + new BaseItemPlate(ELEMENT.getInstance().SODIUM); } - Material meatRaw = MaterialUtils.generateMaterialFromGtENUM(Materials.MeatRaw); - meatRaw.setTextureSet(TextureSet.SET_ROUGH); + Material meatRaw = NONMATERIAL.MEAT; // A plate of Meat. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateMeatRaw", 1) == null){ itemPlateRawMeat = new BaseItemPlate(meatRaw); @@ -721,7 +734,7 @@ public final class ModItems { } // A Block of Meat. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("blockMeatRaw", 1) == null){ - blockRawMeat = new BlockBaseModular(meatRaw.getUnlocalizedName(), meatRaw.getLocalizedName(), BlockTypes.STANDARD, meatRaw.getRgbAsHex()); + blockRawMeat = new BlockBaseModular(meatRaw, BlockTypes.STANDARD); ItemUtils.registerFuel(ItemUtils.getSimpleStack(blockRawMeat), 900); } } @@ -734,15 +747,15 @@ public final class ModItems { //A plate of Lithium. if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateLithium", 1) == null){ - itemPlateLithium = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Lithium)); + itemPlateLithium = new BaseItemPlate(ELEMENT.getInstance().LITHIUM); } //A plate of Europium. if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateEuropium", 1) == null) && CORE.ConfigSwitches.enableCustom_Pipes){ - itemPlateEuropium = new BaseItemPlate(MaterialUtils.generateMaterialFromGtENUM(Materials.Europium)); + itemPlateEuropium = new BaseItemPlate(ELEMENT.getInstance().EUROPIUM); } if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDoubleEuropium", 1) == null) && CORE.ConfigSwitches.enableCustom_Pipes){ - itemDoublePlateEuropium = new BaseItemPlateDouble(MaterialUtils.generateMaterialFromGtENUM(Materials.Europium)); + itemDoublePlateEuropium = new BaseItemPlateDouble(ELEMENT.getInstance().EUROPIUM); } dustNeptunium238 = new DustDecayable("dustNeptunium238", Utils.rgbtoHexValue(175, 240, 75), 50640, new String[] {""+StringUtils.superscript("238Np"), "Result: Plutonium 238 ("+StringUtils.superscript("238Pu")+")"}, ELEMENT.getInstance().PLUTONIUM238.getDust(1).getItem(), 5); diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index 558a0605fe..ea0a2bb5eb 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -1,6 +1,8 @@ package gtPlusPlus.core.item.base; +import java.util.HashMap; import java.util.List; +import java.util.Map; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; @@ -14,10 +16,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.world.World; - +import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TextureSet; import gregtech.api.util.GT_OreDictUnificator; - +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; @@ -33,6 +35,12 @@ import gtPlusPlus.xmod.thaumcraft.util.ThaumcraftUtils; public class BaseItemComponent extends Item{ + private final static Class<TextureSet> mTextureSetPreload; + + static { + mTextureSetPreload = TextureSet.class; + } + public final Material componentMaterial; public final String materialName; public final String unlocalName; @@ -54,7 +62,9 @@ public class BaseItemComponent extends Item{ //this.setTextureName(this.getCorrectTextures()); this.componentColour = material.getRgbAsHex(); GameRegistry.registerItem(this, this.unlocalName); - if (componentType != ComponentTypes.DUST) + + //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); @@ -62,6 +72,7 @@ public class BaseItemComponent extends Item{ ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.RADIO, 2); } } + registerComponent(); } //For Cell Generation @@ -78,6 +89,30 @@ public class BaseItemComponent extends Item{ this.setTextureName(CORE.MODID + ":" + "item"+ComponentTypes.CELL.COMPONENT_NAME); GameRegistry.registerItem(this, unlocalName); GT_OreDictUnificator.registerOre(ComponentTypes.CELL.getOreDictName()+unlocalName, ItemUtils.getSimpleStack(this)); + registerComponent(); + } + + public boolean registerComponent() { + if (this.componentMaterial == null) { + return false; + } + //Register Component + Map<String, BaseItemComponent> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName()); + if (aMap == null) { + aMap = new HashMap<String, BaseItemComponent>(); + } + String aKey = componentType.getGtOrePrefix().name(); + BaseItemComponent x = aMap.get(aKey); + if (x == null) { + aMap.put(aKey, this); + Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap); + return true; + } + else { + //Bad + Logger.MATERIALS("Tried to double register a material component. "); + return false; + } } public String getCorrectTextures(){ @@ -224,34 +259,36 @@ 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"), - PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble"), - ROD("Rod", " Rod", "stick"), - RODLONG("RodLong", " Long Rod", "stickLong"), - GEAR("Gear", " Gear", "gearGt"), - SMALLGEAR("SmallGear", " Gear", "gearGtSmall"), //TODO - SCREW("Screw", " Screw", "screw"), - BOLT("Bolt", " Bolt", "bolt"), - ROTOR("Rotor", " Rotor", "rotor"), - RING("Ring", " Ring", "ring"), - FOIL("Foil", " Foil", "foil"), - PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma"), - CELL("Cell", " Cell", "cell"), - NUGGET("Nugget", " Nugget", "nugget"), - PLATEHEAVY("HeavyPlate", " Heavy Plate", "plateHeavy"); + DUST("Dust", " Dust", "dust", OrePrefixes.dust), + DUSTSMALL("DustSmall", " Dust", "dustSmall", OrePrefixes.dustSmall), + DUSTTINY("DustTiny", " Dust", "dustTiny", OrePrefixes.dustTiny), + INGOT("Ingot", " Ingot", "ingot", OrePrefixes.ingot), + HOTINGOT("HotIngot", " Hot Ingot", "ingotHot", OrePrefixes.ingotHot), + PLATE("Plate", " Plate", "plate", OrePrefixes.plate), + PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble", OrePrefixes.plateDouble), + ROD("Rod", " Rod", "stick", OrePrefixes.stick), + RODLONG("RodLong", " Long Rod", "stickLong", OrePrefixes.stickLong), + GEAR("Gear", " Gear", "gearGt", OrePrefixes.gearGt), + SMALLGEAR("SmallGear", " Gear", "gearGtSmall", OrePrefixes.gearGtSmall), //TODO + SCREW("Screw", " Screw", "screw", OrePrefixes.screw), + BOLT("Bolt", " Bolt", "bolt", OrePrefixes.bolt), + ROTOR("Rotor", " Rotor", "rotor", OrePrefixes.rotor), + RING("Ring", " Ring", "ring", OrePrefixes.ring), + FOIL("Foil", " Foil", "foil", OrePrefixes.foil), + PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma", OrePrefixes.cellPlasma), + CELL("Cell", " Cell", "cell", OrePrefixes.cell), + NUGGET("Nugget", " Nugget", "nugget", OrePrefixes.nugget), + PLATEHEAVY("HeavyPlate", " Heavy Plate", "plateHeavy", OrePrefixes.plateDense); private String COMPONENT_NAME; private String DISPLAY_NAME; private String OREDICT_NAME; - private ComponentTypes (final String LocalName, final String DisplayName, final String OreDictName){ + private OrePrefixes a_GT_EQUAL; + private ComponentTypes (final String LocalName, final String DisplayName, final String OreDictName, final OrePrefixes aPrefix){ this.COMPONENT_NAME = LocalName; this.DISPLAY_NAME = DisplayName; this.OREDICT_NAME = OreDictName; + this.a_GT_EQUAL = aPrefix; } public String getComponent(){ @@ -266,6 +303,10 @@ public class BaseItemComponent extends Item{ return this.OREDICT_NAME; } + public OrePrefixes getGtOrePrefix() { + return this.a_GT_EQUAL; + } + } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java index d5b44db9f5..78c2724ea8 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java @@ -52,7 +52,13 @@ public class BaseItemTickable extends CoreItem { if (world == null || iStack == null) { return; } - tickItemTag(world, iStack); + + + boolean active = getIsActive(world, iStack); + if (active) { + tickItemTag(world, iStack); + } + } /*private final boolean setGregtechItemList() { @@ -160,7 +166,7 @@ public class BaseItemTickable extends CoreItem { } } else { - createNBT(world, aStack); + return createNBT(world, aStack); } return true; } @@ -266,10 +272,7 @@ public class BaseItemTickable extends CoreItem { } } } - else { - createNBT(world, aStack); - } - return false; + return createNBT(world, aStack); } @Override diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 909d87fe57..afc4b17354 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -1,44 +1,46 @@ package gtPlusPlus.core.item.base.dusts; -import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; -import java.util.List; +public class BaseItemDust extends BaseItemComponent { -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; + private Material dustInfo; + private BaseItemComponent[] mSizedDusts = new BaseItemComponent[2]; -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; -import gtPlusPlus.core.util.minecraft.EntityUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; + public BaseItemDust(Material aMat) { + this(aMat, true); + } -public class BaseItemDust extends Item{ + public BaseItemDust(Material aMat, boolean generateSmallDusts) { + super(aMat, ComponentTypes.DUST); + if (generateSmallDusts) { + mSizedDusts[0] = new BaseItemComponent(aMat, ComponentTypes.DUSTSMALL); + mSizedDusts[1] = new BaseItemComponent(aMat, ComponentTypes.DUSTTINY); + } + } - protected int colour; - protected String materialName; - protected String pileType; - String name = ""; - private int mTier; - private Material dustInfo; + public BaseItemDust(DustState aState, Material aMat) { + super(aMat, ComponentTypes.DUST); + if (aState.generatesSmallDust()) { + mSizedDusts[0] = new BaseItemComponent(aMat, ComponentTypes.DUSTSMALL); + } + if (aState.generatesTinyDust()) { + mSizedDusts[1] = new BaseItemComponent(aMat, ComponentTypes.DUSTTINY); + } + } - public BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier){ + private BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, final int colour, final String pileSize, final int tier){ this(unlocalizedName, materialName, matInfo, colour, pileSize, tier, true); } - public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) { - try { + private BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) { + super(matInfo, ComponentTypes.DUST); + + try {/* this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(64); @@ -78,14 +80,15 @@ public class BaseItemDust extends Item{ this.addFurnaceRecipe(); this.addMacerationRecipe(); } - } + */} catch (Throwable t) { t.printStackTrace(); } } private String getCorrectTexture(final String pileSize){ - if (!CORE.ConfigSwitches.useGregtechTextures){ + + if (!CORE.ConfigSwitches.useGregtechTextures || this.dustInfo.getTextureSet() == null){ if ((pileSize == "dust") || (pileSize == "Dust")){ this.setTextureName(CORE.MODID + ":" + "dust");} else{ @@ -103,7 +106,7 @@ public class BaseItemDust extends Item{ return "gregtech" + ":" + "materialicons/"+this.dustInfo.getTextureSet().mSetName+"/dust"; } - @Override + /* @Override public String getItemStackDisplayName(final ItemStack iStack) { String unlocal = super.getItemStackDisplayName(iStack); @@ -114,11 +117,10 @@ public class BaseItemDust extends Item{ return unlocal; } - } + }*/ - @Override + /* @Override public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - try { if (this.dustInfo != null){ if (entityHolding instanceof EntityPlayer){ @@ -131,10 +133,9 @@ public class BaseItemDust extends Item{ catch (Throwable t) { t.printStackTrace(); } + }*/ - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) + /*@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { @@ -151,101 +152,116 @@ public class BaseItemDust extends Item{ //} super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return this.materialName; - } - - @Override - public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { - if (this.colour == 0){ - return MathUtils.generateSingularRandomHexValue(); + }*/ + + public static class DustState { + static final int NORMAL = (1); + static final int SMALL = (10); + static final int TINY = (100); + final int MIXTURE; + final boolean[] doesThings = new boolean[3]; + + public DustState (boolean genDust, boolean genSmallDust, boolean genDustTiny){ + int aTotal = 0; + if (genDust) { + aTotal += NORMAL; + doesThings[0] = true; + } + else { + doesThings[0] = false; + } + if (genSmallDust) { + aTotal += SMALL; + doesThings[1] = true; + } + else { + doesThings[1] = false; + } + if (genDustTiny) { + aTotal += TINY; + doesThings[2] = true; + } + else { + doesThings[2] = false; + } + MIXTURE = aTotal; } - return this.colour; - - } - private void addMacerationRecipe(){ - - try { - Logger.MATERIALS("Adding Maceration recipe for "+this.materialName+" Ingot -> Dusts"); - final int chance = (this.mTier*10)/MathUtils.randInt(10, 20); - GT_ModHandler.addPulverisationRecipe(dustInfo.getIngot(1), dustInfo.getDust(1), null, chance); + public boolean generatesDust() { + return doesThings[0]; } - catch (Throwable t) { - t.printStackTrace(); + public boolean generatesSmallDust() { + return doesThings[1]; + } + public boolean generatesTinyDust() { + return doesThings[2]; } - } - - private void addFurnaceRecipe(){ - - ItemStack aDust = dustInfo.getDust(1); - ItemStack aOutput; - try { - if (this.dustInfo.requiresBlastFurnace()) { - aOutput = dustInfo.getHotIngot(1); - if (aOutput != null) { - if (addBlastFurnaceRecipe(aDust, null, aOutput, null, dustInfo.getMeltingPointK())){ - Logger.MATERIALS("Successfully added a blast furnace recipe for "+this.materialName); - } - else { - Logger.MATERIALS("Failed to add a blast furnace recipe for "+this.materialName); - } - } - else { - Logger.MATERIALS("Failed to add a blast furnace recipe for "+this.materialName); - } + private DustState(int amount) { + + if (amount == 1) { + doesThings[0] = true; + doesThings[1] = false; + doesThings[2] = false; + + } + else if (amount == 10) { + doesThings[0] = false; + doesThings[1] = true; + doesThings[2] = false; + + } + else if (amount == 100) { + doesThings[0] = false; + doesThings[1] = false; + doesThings[2] = true; + + } + else if (amount == 11) { + doesThings[0] = true; + doesThings[1] = true; + doesThings[2] = false; + + } + else if (amount == 101) { + doesThings[0] = true; + doesThings[1] = false; + doesThings[2] = true; + + } + else if (amount == 110) { + doesThings[0] = false; + doesThings[1] = true; + doesThings[2] = true; + + } + else if (amount == 111) { + doesThings[0] = true; + doesThings[1] = true; + doesThings[2] = true; } else { - aOutput = dustInfo.getIngot(1); - if (aOutput != null) { - if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ - Logger.MATERIALS("Successfully added a furnace recipe for "+this.materialName); - } - else { - Logger.MATERIALS("Failed to add a furnace recipe for "+this.materialName); - } - } - } - } - catch (Throwable t) { - t.printStackTrace(); + doesThings[0] = false; + doesThings[1] = false; + doesThings[2] = false; + } + MIXTURE = amount; } - } - - private boolean addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ - - try { - int timeTaken = 125*this.mTier*10; - - if (this.mTier <= 4){ - timeTaken = 25*this.mTier*10; + public DustState get(int a) { + if (a == 1) { + return new DustState(NORMAL); } - int aSlot = mTier - 2; - if (aSlot < 2) { - aSlot = 2; + else if (a == 10) { + return new DustState(SMALL); + } + else if (a == 100) { + return new DustState(TINY); + } + else { + return new DustState(MIXTURE); } - long aVoltage = GT_Values.V[aSlot >= 2 ? aSlot : 2]; - - return GT_Values.RA.addBlastRecipe( - input1, - input2, - GT_Values.NF, GT_Values.NF, - output1, - output2, - timeTaken, - (int) aVoltage, - tempRequired); - } - catch (Throwable t) { - t.printStackTrace(); - return false; } - - - } + } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java index f9594822ab..56d2aabdba 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java @@ -7,20 +7,27 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import gtPlusPlus.core.block.base.BlockBaseModular; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; public class ItemBlockGtBlock extends ItemBlock{ protected final int blockColour; protected final int sRadiation; + private final Material mMaterial; + private final Block thisBlock; private boolean isOre = false; + private boolean isModular = false; public ItemBlockGtBlock(final Block block) { super(block); @@ -28,14 +35,42 @@ public class ItemBlockGtBlock extends ItemBlock{ if (block instanceof BlockBaseOre){ this.isOre = true; } + else if (block instanceof BlockBaseModular) { + this.isModular = true; + } + else { + + } + if (!isModular && !isOre) { + mMaterial = null; + } + else { + if (isOre) { + mMaterial = ((BlockBaseOre) block).getMaterialEx(); + } + else { + mMaterial = ((BlockBaseModular) block).getMaterialEx(); + } + } + final BlockBaseModular baseBlock = (BlockBaseModular) block; - this.blockColour = baseBlock.getRenderColor(0); - if (block.getLocalizedName().toLowerCase().contains("uranium") || block.getLocalizedName().toLowerCase().contains("plutonium") || block.getLocalizedName().toLowerCase().contains("thorium")){ - this.sRadiation = 2; + if (isModular) { + this.blockColour = baseBlock.getRenderColor(0); + } + else if (isOre) { + this.blockColour = block.getBlockColor(); + } + else { + this.blockColour = block.getBlockColor(); + } + if (this.mMaterial != null) { + this.sRadiation = mMaterial.vRadiationLevel; } else { this.sRadiation = 0; } + + //GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); } @@ -45,17 +80,38 @@ public class ItemBlockGtBlock extends ItemBlock{ @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + + if (this.mMaterial != null){ + list.add(this.mMaterial.vChemicalFormula); + } + if (this.sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive); } - if (this.isOre){ - if (this.thisBlock != null){ - if (this.thisBlock.getLocalizedName().equalsIgnoreCase("fluorite ore")){ - list.add("Mined from Sandstone and Limestone."); + + if (KeyboardUtils.isCtrlKeyDown()) { + Block b = Block.getBlockFromItem(stack.getItem()); + if (b != null) { + + String aTool = b.getHarvestTool(stack.getItemDamage()); + int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); + list.add("Mining Level: "+Math.min(Math.max(aMiningLevel1, 0), 5)); + + if (this.mMaterial != null) { + list.add("Ore contains: "); + if (mMaterial.getComposites().isEmpty()) { + list.add("- "+mMaterial.getLocalizedName()); + } + else { + for (MaterialStack m : mMaterial.getComposites()) { + list.add("- "+m.getStackMaterial().getLocalizedName()+" x"+m.getPartsPerOneHundred()); + } + } } } } else { + list.add(EnumChatFormatting.DARK_GRAY+"Hold Ctrl to show additional info."); } super.addInformation(stack, aPlayer, list, bool); } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java index 91dcf97f5b..03f3e50338 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java @@ -7,14 +7,17 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import gtPlusPlus.core.block.base.BlockBaseOre; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; public class ItemBlockOre extends ItemBlock{ @@ -60,23 +63,55 @@ public class ItemBlockOre extends ItemBlock{ if (this.mThisMaterial == FLUORIDES.FLUORITE){ list.add("Mined from Sandstone with a 1/"+(CORE.ConfigSwitches.chanceToDropFluoriteOre*20)+" chance, or Limestone with a 1/"+(CORE.ConfigSwitches.chanceToDropFluoriteOre)+" chance."); } - else if (this.mThisMaterial != FLUORIDES.FLUORITE){ +/* else if (this.mThisMaterial != FLUORIDES.FLUORITE){ list.add("Mined from the Toxic Everglades."); - } - super.addInformation(stack, aPlayer, list, bool); - } + }*/ - @Override - public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - if (this.mThisMaterial != null){ - if (this.mThisRadiation > 0){ - if (entityHolding instanceof EntityPlayer){ - if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.mThisMaterial.vRadiationLevel, world, entityHolding); + if (KeyboardUtils.isCtrlKeyDown()) { + + if (this.mThisMaterial != null) { + Block b = Block.getBlockFromItem(stack.getItem()); + if (b != null) { + String aTool = b.getHarvestTool(stack.getItemDamage()); + int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage()); + if (aMiningLevel1 != 0) { + list.add("Mining Level: "+Math.min(Math.max(aMiningLevel1, 0), 5)); + } + list.add("Ore contains: "); + if (mThisMaterial.getComposites().isEmpty()) { + list.add("- "+mThisMaterial.getLocalizedName()); + } + else { + for (MaterialStack m : mThisMaterial.getComposites()) { + list.add("- "+m.getStackMaterial().getLocalizedName()+" x"+m.getPartsPerOneHundred()); } } } + } + } + else { + list.add(EnumChatFormatting.DARK_GRAY+"Hold Ctrl to show additional info."); + } + + + + + + + super.addInformation(stack, aPlayer, list, bool); +} + +@Override +public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { + if (this.mThisMaterial != null){ + if (this.mThisRadiation > 0){ + if (entityHolding instanceof EntityPlayer){ + if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ + EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.mThisMaterial.vRadiationLevel, world, entityHolding); + } + } } } +} } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java b/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java new file mode 100644 index 0000000000..c1a2655a03 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/general/ItemCreativeTab.java @@ -0,0 +1,59 @@ +package gtPlusPlus.core.item.general; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.GregTech_API; +import gtPlusPlus.core.lib.CORE; +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; + +public class ItemCreativeTab extends Item { + + public IIcon[] icons = new IIcon[10]; + + public ItemCreativeTab() { + super(); + this.setHasSubtypes(true); + String unlocalizedName = "itemCreativeTabs"; + this.setUnlocalizedName(unlocalizedName); + this.setCreativeTab(GregTech_API.TAB_GREGTECH); + GameRegistry.registerItem(this, unlocalizedName); + } + + @Override + public void registerIcons(IIconRegister reg) { + this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_0"); + this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_1"); + this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_2"); + this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_3"); + this.icons[4] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_4"); + this.icons[5] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_5"); + this.icons[6] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_6"); + this.icons[7] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_7"); + this.icons[8] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_8"); + this.icons[9] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_9"); + } + + @Override + public IIcon getIconFromDamage(int meta) { + return this.icons[meta]; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 10; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return this.getUnlocalizedName() + "_" + stack.getItemDamage(); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java index 8e19896b92..aa3b044802 100644 --- a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java +++ b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java @@ -30,9 +30,9 @@ public class DustDecayable extends BaseItemTickable { @Override public void registerIcons(IIconRegister reg) { - String gt = "gregtech" + ":" + "materialicons/"+"METALLIC"+"/" + "dust"; + String gt = "gregtech" + ":" + "materialicons/"+"SHINY"+"/" + "dust"; this.mIcon[0] = reg.registerIcon(gt); - String gt2 = "gregtech" + ":" + "materialicons/"+"METALLIC"+"/" + "dust" + "_OVERLAY"; + String gt2 = "gregtech" + ":" + "materialicons/"+"SHINY"+"/" + "dust" + "_OVERLAY"; this.mIcon[1] = reg.registerIcon(gt2); } @@ -57,15 +57,16 @@ public class DustDecayable extends BaseItemTickable { } } - if (!tickItemTag(world, iStack)) { + if (!tickItemTag(world, iStack) && !this.getIsActive(world, iStack)) { if (entityHolding instanceof EntityPlayer){ ItemStack replacement = ItemUtils.getSimpleStack(turnsIntoItem); //Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+replacement.getDisplayName()+"."); final ItemStack tempTransform = replacement; - if (iStack.stackSize == 64){ - tempTransform.stackSize=64; + if (iStack.stackSize > 1){ + int u = iStack.stackSize; + tempTransform.stackSize = u; ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform)); - for (int l=0;l<64;l++){ + for (int l=0;l<u;l++){ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); } |