1.16 port

This commit is contained in:
yueh
2020-07-22 16:44:42 +02:00
parent 662dbca3e1
commit 56ecda5173
225 changed files with 1214 additions and 969 deletions
@@ -20,12 +20,14 @@ package appeng.client.gui.implementations;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.config.SortDir;
@@ -68,7 +70,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
@Override
public void render(final int mouseX, final int mouseY, final float btn) {
public void render(MatrixStack matrixStack, final int mouseX, final int mouseY, final float btn) {
final int gx = (this.width - this.xSize) / 2;
final int gy = (this.height - this.ySize) / 2;
@@ -96,23 +98,24 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
}
super.render(mouseX, mouseY, btn);
super.render(matrixStack, mouseX, mouseY, btn);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.NetworkDetails.getLocal(), 8, 6, 4210752);
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, GuiText.NetworkDetails.getLocal(), 8, 6, 4210752);
this.font.drawString(
this.font.drawString(matrixStack,
GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong(container.getCurrentPower(), false),
13, 16, 4210752);
this.font.drawString(
this.font.drawString(matrixStack,
GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong(container.getMaxPower(), false), 13, 26,
4210752);
this.font.drawString(GuiText.PowerInputRate.getLocal() + ": "
this.font.drawString(matrixStack, GuiText.PowerInputRate.getLocal() + ": "
+ Platform.formatPowerLong(container.getAverageAddition(), true), 13, 143 - 10, 4210752);
this.font.drawString(
this.font.drawString(matrixStack,
GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong(container.getPowerUsage(), true),
13, 143 - 20, 4210752);
@@ -141,7 +144,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
final int w = this.font.getStringWidth(str);
this.font.drawString(str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2),
this.font.drawString(matrixStack, str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * 18 + yo + 6) * 2, 4210752);
RenderSystem.popMatrix();
@@ -149,7 +152,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
final int posY = y * 18 + yo;
if (this.tooltip == z - viewStart) {
toolTip = Platform.getItemDisplayName(refStack).getFormattedText();
toolTip = Platform.getItemDisplayName(refStack).getString();
toolTip += ('\n' + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
if (refStack.getCountRequestable() > 0) {
@@ -173,12 +176,13 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
if (this.tooltip >= 0 && toolTip.length() > 0) {
this.drawTooltip(toolPosX, toolPosY + 10, toolTip);
this.drawTooltip(matrixStack, toolPosX, toolPosY + 10, new StringTextComponent(toolTip));
}
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
this.bindTexture("guis/networkstatus.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -201,7 +205,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
@Override
protected void renderTooltip(final ItemStack stack, final int x, final int y) {
protected void renderTooltip(MatrixStack matrixStack, final ItemStack stack, final int x, final int y) {
final Slot s = this.getSlot(x, y);
if (s instanceof SlotME && !stack.isEmpty()) {
@@ -214,7 +218,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
if (myStack != null) {
List<String> currentToolTip = getTooltipFromItem(stack);
List<ITextComponent> currentToolTip = getTooltipFromItem(stack);
while (currentToolTip.size() > 1) {
currentToolTip.remove(1);
@@ -224,11 +228,11 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
currentToolTip.add(GuiText.EnergyDrain.getLocal() + ": "
+ Platform.formatPowerLong(myStack.getCountRequestable(), true));
this.drawTooltip(x, y, currentToolTip);
this.drawTooltip(matrixStack, x, y, currentToolTip);
}
}
super.renderTooltip(stack, x, y);
super.renderTooltip(matrixStack, stack, x, y);
}
@Override