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/base | |
| 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/base')
5 files changed, 320 insertions, 169 deletions
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); + } + } } } +} } |
