mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-23 13:29:40 +00:00
Added effect information to upgrade GUI
This commit is contained in:
1 parent
52efdac614
commit
d8e94b00d2
3 files changed
+31
-4
No files matched your search
@@ -53,6 +53,13 @@ public class GuiUpgradeManagement extends GuiMekanism
|
||||
|
||||
renderText(selectedType.getName() + " " + MekanismUtils.localize("gui.upgrade"), 92, 8, 0.6F, true);
|
||||
renderText(MekanismUtils.localize("gui.upgrades.amount") + ": " + amount + "/" + selectedType.getMax(), 92, 16, 0.6F, true);
|
||||
|
||||
int text = 0;
|
||||
|
||||
for(String s : selectedType.getInfo((TileEntity)tileEntity))
|
||||
{
|
||||
renderText(s, 92, 22+(6*text++), 0.6F, true);
|
||||
}
|
||||
}
|
||||
|
||||
int rendered = 0;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package mekanism.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.EnumColor;
|
||||
@@ -8,6 +10,7 @@ import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
|
||||
public enum Upgrade
|
||||
@@ -65,6 +68,23 @@ public enum Upgrade
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getInfo(TileEntity tile)
|
||||
{
|
||||
List<String> ret = new ArrayList<String>();
|
||||
|
||||
if(tile instanceof IUpgradeTile)
|
||||
{
|
||||
if(canMultiply())
|
||||
{
|
||||
double effect = Math.pow(Mekanism.maxUpgradeMultiplier, (float)((IUpgradeTile)tile).getComponent().getUpgrades(this)/(float)getMax());
|
||||
|
||||
ret.add(MekanismUtils.localize("gui.upgrades.effect") + ": " + (Math.round(effect*100)/100F) + "x");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Map<Upgrade, Integer> buildMap(NBTTagCompound nbtTags)
|
||||
{
|
||||
Map<Upgrade, Integer> upgrades = new HashMap<Upgrade, Integer>();
|
||||
|
||||
@@ -607,7 +607,7 @@ public final class MekanismUtils
|
||||
*/
|
||||
public static int getTicks(IUpgradeTile mgmt, int def)
|
||||
{
|
||||
return (int)(def * Math.pow(Mekanism.maxUpgradeMultiplier, -mgmt.getComponent().getUpgrades(Upgrade.SPEED)/8.0));
|
||||
return (int)(def * Math.pow(Mekanism.maxUpgradeMultiplier, (float)-mgmt.getComponent().getUpgrades(Upgrade.SPEED)/(float)Upgrade.SPEED.getMax()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -619,7 +619,7 @@ public final class MekanismUtils
|
||||
*/
|
||||
public static double getEnergyPerTick(IUpgradeTile mgmt, double def)
|
||||
{
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (2*mgmt.getComponent().getUpgrades(Upgrade.SPEED)-mgmt.getComponent().getUpgrades(Upgrade.ENERGY))/8.0);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (2*mgmt.getComponent().getUpgrades(Upgrade.SPEED)-(float)mgmt.getComponent().getUpgrades(Upgrade.ENERGY))/(float)Upgrade.SPEED.getMax());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -630,7 +630,7 @@ public final class MekanismUtils
|
||||
*/
|
||||
public static double getMaxEnergy(IUpgradeTile mgmt, double def)
|
||||
{
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, mgmt.getComponent().getUpgrades(Upgrade.ENERGY)/8.0);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (float)mgmt.getComponent().getUpgrades(Upgrade.ENERGY)/(float)Upgrade.ENERGY.getMax());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -642,7 +642,7 @@ public final class MekanismUtils
|
||||
public static double getMaxEnergy(ItemStack itemStack, double def)
|
||||
{
|
||||
Map<Upgrade, Integer> upgrades = Upgrade.buildMap(itemStack.stackTagCompound);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, upgrades.get(Upgrade.ENERGY)/8.0);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (float)upgrades.get(Upgrade.ENERGY)/(float)Upgrade.ENERGY.getMax());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user