aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
diff options
context:
space:
mode:
authorAlkalus <Draknyte1@hotmail.com>2020-04-04 16:57:56 +0100
committerAlkalus <Draknyte1@hotmail.com>2020-04-04 16:57:56 +0100
commitacf7193504fba4a7165d2ba5732cc9ce5f35ec55 (patch)
tree1fb97da489c70c4cc7f134fe5b5aeef2b944979a /src/Java/gtPlusPlus/core/item
parent35f473d3f79d3b4f30e2cd02885a6e685d66fb45 (diff)
downloadGT5-Unofficial-acf7193504fba4a7165d2ba5732cc9ce5f35ec55.tar.gz
GT5-Unofficial-acf7193504fba4a7165d2ba5732cc9ce5f35ec55.tar.bz2
GT5-Unofficial-acf7193504fba4a7165d2ba5732cc9ce5f35ec55.zip
+ Added a new base bus type.
+ Added the Ball Housing bus. + Added the Catalyst Housing bus. + Added the Reinforced Engine Casing. + Made the Flotation Cell Regulator actually load. $ Fixed Tooltips on Milling Balls & Catalysts. $ Added improved item handling for Milling Balls. $ Added improved item handling for Catalysts.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java1
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java191
2 files changed, 175 insertions, 17 deletions
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
index 86ffe49eed..3583ddca3f 100644
--- a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
+++ b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
@@ -1,6 +1,5 @@
package gtPlusPlus.core.item.chemistry;
-import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
index 0863faa38d..ed17f8547a 100644
--- a/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
+++ b/src/Java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
@@ -3,6 +3,8 @@ package gtPlusPlus.core.item.chemistry.general;
import java.util.List;
import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.item.chemistry.GenericChem;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -12,6 +14,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@@ -48,6 +52,14 @@ public class ItemGenericChemBase extends Item {
}
@Override
+ public int getItemStackLimit(ItemStack stack) {
+ if (ItemUtils.isMillingBall(stack)) {
+ return 16;
+ }
+ return super.getItemStackLimit(stack);
+ }
+
+ @Override
public boolean isDamageable() {
return false;
}
@@ -68,17 +80,6 @@ public class ItemGenericChemBase extends Item {
}
@Override
- public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
- try {
-
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
- super.addInformation(aStack, p_77624_2_, aList, p_77624_4_);
- }
-
- @Override
public EnumRarity getRarity(ItemStack p_77613_1_) {
return EnumRarity.common;
}
@@ -116,11 +117,6 @@ public class ItemGenericChemBase extends Item {
}
@Override
- public boolean showDurabilityBar(ItemStack stack) {
- return false;
- }
-
- @Override
public int getItemEnchantability() {
return 0;
}
@@ -165,4 +161,167 @@ public class ItemGenericChemBase extends Item {
}
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack aStack) {
+ if (ItemUtils.isMillingBall(aStack)) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()){
+ createMillingBallNBT(aStack);
+ }
+ double currentDamage = getMillingBallDamage(aStack);
+ double durabilitypercent = currentDamage / 100;
+ return durabilitypercent;
+ }
+ else if (ItemUtils.isCatalyst(aStack)) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()){
+ createCatalystNBT(aStack);
+ }
+ double currentDamage = getCatalystDamage(aStack);
+ double durabilitypercent = currentDamage / 100;
+ return durabilitypercent;
+ }
+ else {
+ return 1D;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer player, List list, boolean bool) {
+ boolean aHasSpecialTooltips = false;
+ int aMaxDamage = 0;
+ int aDamageSegment = 0;
+ int aDam = 0;
+ EnumChatFormatting durability = EnumChatFormatting.GRAY;
+ if (ItemUtils.isMillingBall(aStack)) {
+ list.add(EnumChatFormatting.GRAY+"Tumble Tumble Tumble");
+ aMaxDamage = getMillingBallMaxDamage(aStack);
+ aDamageSegment = aMaxDamage / 5;
+ aDam = aMaxDamage-getMillingBallDamage(aStack);
+ aHasSpecialTooltips = true;
+ }
+ if (ItemUtils.isCatalyst(aStack)) {
+ list.add(EnumChatFormatting.GRAY+"Active Reaction Agent");
+ aMaxDamage = getCatalystMaxDamage(aStack);
+ aDamageSegment = aMaxDamage / 5;
+ aDam = aMaxDamage-getCatalystDamage(aStack);
+ aHasSpecialTooltips = true;
+ }
+ if (aHasSpecialTooltips) {
+ if (aDam > aDamageSegment * 4){
+ durability = EnumChatFormatting.GRAY;
+ }
+ else if (aDam > aDamageSegment * 3){
+ durability = EnumChatFormatting.GREEN;
+ }
+ else if (aDam > aDamageSegment * 2){
+ durability = EnumChatFormatting.YELLOW;
+ }
+ else if (aDam > aDamageSegment){
+ durability = EnumChatFormatting.GOLD;
+ }
+ else if (aDam > 0){
+ durability = EnumChatFormatting.RED;
+ }
+ list.add(durability+""+(aDam)+EnumChatFormatting.GRAY+" / "+aMaxDamage);
+ }
+ super.addInformation(aStack, player, list, bool);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack aStack) {
+ if (ItemUtils.isMillingBall(aStack)) {
+ int aDam = getMillingBallDamage(aStack);
+ if (aDam > 0) {
+ return true;
+ }
+ }
+ else if (ItemUtils.isCatalyst(aStack)) {
+ int aDam = getCatalystDamage(aStack);
+ if (aDam > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean createMillingBallNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Damage", 0);
+ tagNBT.setLong("MaxDamage", getMaxBallDurability(rStack));
+ tagMain.setTag("MillingBall", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static int getMillingBallDamage(ItemStack aStack) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
+ createMillingBallNBT(aStack);
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ return aNBT.getCompoundTag("MillingBall").getInteger("Damage");
+ }
+
+ public static int getMillingBallMaxDamage(ItemStack aStack) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
+ createMillingBallNBT(aStack);
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ return aNBT.getCompoundTag("MillingBall").getInteger("MaxDamage");
+ }
+
+ public static void setMillingBallDamage(ItemStack aStack,int aAmount) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ aNBT = aNBT.getCompoundTag("MillingBall");
+ aNBT.setInteger("Damage", aAmount);
+ }
+
+ public static int getMaxBallDurability(ItemStack aStack) {
+ if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallAlumina, true)) {
+ return 100;
+ }
+ if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallSoapstone, true)) {
+ return 50;
+ }
+ return 0;
+ }
+
+ public static boolean createCatalystNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Damage", 0);
+ tagNBT.setLong("MaxDamage", getMaxCatalystDurability(rStack));
+ tagMain.setTag("catalyst", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static int getCatalystDamage(ItemStack aStack) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
+ createCatalystNBT(aStack);
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ return aNBT.getCompoundTag("catalyst").getInteger("Damage");
+ }
+
+ public static int getCatalystMaxDamage(ItemStack aStack) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
+ createCatalystNBT(aStack);
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ return aNBT.getCompoundTag("catalyst").getInteger("MaxDamage");
+ }
+
+ public static void setCatalystDamage(ItemStack aStack,int aAmount) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ aNBT = aNBT.getCompoundTag("catalyst");
+ aNBT.setInteger("Damage", aAmount);
+ }
+
+ public static int getMaxCatalystDurability(ItemStack aStack) {
+ return 50;
+ }
+
+
}