Overclocker upgrades give more power input/storage to machine + add some more info to the tool tip in the gui

Also fix for not calling update client side lower down the chain
This commit is contained in:
modmuss50 2018-04-03 16:32:04 +01:00
parent fc9e7df2f9
commit adb12ef43d
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
4 changed files with 18 additions and 4 deletions

View file

@ -38,10 +38,12 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.common.Loader;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import reborncore.api.tile.IUpgradeable;
import reborncore.client.guibuilder.GuiBuilder;
import reborncore.common.powerSystem.PowerSystem;
import reborncore.common.powerSystem.TilePowerAcceptor;
import techreborn.init.ModItems;
import techreborn.lib.ModInfo;
import techreborn.proxies.ClientProxy;
@ -88,6 +90,14 @@ public class TRBuilder extends GuiBuilder {
TextFormatting powerColour = TextFormatting.GOLD;
list.add(powerColour + PowerSystem.getLocaliszedPowerFormattedNoSuffix(energyStored) + "/" + PowerSystem.getLocaliszedPowerFormattedNoSuffix(maxEnergyStored) + " " + PowerSystem.getDisplayPower().abbreviation);
list.add(getPercentageColour(percentage) + "" + percentage + "%" + TextFormatting.GRAY + " Charged");
if(gui.tile instanceof TilePowerAcceptor && Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyCode())){
((TilePowerAcceptor) gui.tile).addInfo(list, true);
list.add("");
list.add(TextFormatting.BLUE + "Click to change display unit");
} else {
list.add("");
list.add(TextFormatting.BLUE + Minecraft.getMinecraft().gameSettings.keyBindSneak.getDisplayName() + TextFormatting.GRAY + " more info");
}
net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(list, mouseX, mouseY, gui.width, gui.height, -1, gui.mc.fontRenderer);
GlStateManager.disableLighting();
GlStateManager.color(1, 1, 1, 1);

View file

@ -123,7 +123,11 @@ public class ItemUpgrades extends ItemTR implements IUpgrade {
if (stack.getItemDamage() == 0) {
handler.addSpeedMulti(0.25);
handler.addPowerMulti(0.75);
if(machineBase instanceof TilePowerAcceptor){
TilePowerAcceptor powerAcceptor = (TilePowerAcceptor) machineBase;
powerAcceptor.extraPowerInput += powerAcceptor.getMaxInput();
powerAcceptor.extraPowerStoage += powerAcceptor.getBaseMaxPower();
}
}
if (machineBase instanceof TilePowerAcceptor) {
if (stack.getItemDamage() == 2) {

View file

@ -76,8 +76,8 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
// TilePowerAcceptor
@Override
public void update() {
super.update();
if (!this.world.isRemote) {
super.update();
this.charge(energySlot);
}
}

View file

@ -140,9 +140,9 @@ public class TileTransformer extends TilePowerAcceptor
// IListInfoProvider
@Override
public void addInfo(List<String> info, boolean isRealTile) {
info.add(TextFormatting.GRAY + "Input Rate: " + TextFormatting.GOLD + getLocaliszedPowerFormatted((int) getBaseMaxInput()));
info.add(TextFormatting.GRAY + "Input Rate: " + TextFormatting.GOLD + getLocaliszedPowerFormatted((int) getMaxInput()));
info.add(TextFormatting.GRAY + "Input Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(inputTier.toString()));
info.add(TextFormatting.GRAY + "Output Rate: " + TextFormatting.GOLD + getLocaliszedPowerFormatted((int) getBaseMaxOutput()));
info.add(TextFormatting.GRAY + "Output Rate: " + TextFormatting.GOLD + getLocaliszedPowerFormatted((int) getMaxOutput()));
info.add(TextFormatting.GRAY + "Output Tier: " + TextFormatting.GOLD + StringUtils.toFirstCapitalAllLowercase(ouputTier.toString()));
}