1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-09 09:52:59 +00:00

Fix some issues, add AW.

This commit is contained in:
Jacob Farley
2020-08-29 18:44:19 -05:00
parent a4830aff86
commit 56dcc57755
18 changed files with 83 additions and 64 deletions

View File

@@ -14,6 +14,7 @@ import dan200.computercraft.shared.computer.core.ClientComputer;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
import net.minecraft.client.util.math.MatrixStack;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
@@ -43,12 +44,12 @@ public class GuiTurtle extends HandledScreen<ContainerTurtle> {
@Override
protected void init() {
super.init();
minecraft.keyboard.enableRepeatEvents(true);
client.keyboard.setRepeatEvents(true);
int termPxWidth = ComputerCraft.terminalWidth_turtle * FixedWidthFontRenderer.FONT_WIDTH;
int termPxHeight = ComputerCraft.terminalHeight_turtle * FixedWidthFontRenderer.FONT_HEIGHT;
this.terminal = new WidgetTerminal(minecraft, () -> this.m_computer, ComputerCraft.terminalWidth_turtle, ComputerCraft.terminalHeight_turtle, 2, 2, 2, 2);
this.terminal = new WidgetTerminal(client, () -> this.m_computer, ComputerCraft.terminalWidth_turtle, ComputerCraft.terminalHeight_turtle, 2, 2, 2, 2);
this.terminalWrapper = new WidgetWrapper(this.terminal, 2 + 8 + this.x, 2 + 8 + this.y, termPxWidth, termPxHeight);
this.children.add(this.terminalWrapper);
@@ -79,7 +80,7 @@ public class GuiTurtle extends HandledScreen<ContainerTurtle> {
super.removed();
this.children.remove(this.terminal);
this.terminal = null;
minecraft.keyboard.enableRepeatEvents(false);
client.keyboard.setRepeatEvents(false);
}
@Override
@@ -89,37 +90,37 @@ public class GuiTurtle extends HandledScreen<ContainerTurtle> {
}
@Override
protected void drawBackground(float partialTicks, int mouseX, int mouseY) {
protected void drawBackground(MatrixStack stack, float partialTicks, int mouseX, int mouseY) {
// Draw term
boolean advanced = this.m_family == ComputerFamily.Advanced;
this.terminal.draw(this.terminalWrapper.getX(), this.terminalWrapper.getY());
// Draw border/inventory
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
minecraft.getTextureManager()
client.getTextureManager()
.bindTextureInner(advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL);
blit(this.x, this.y, 0, 0, this.backgroundWidth, this.backgroundHeight);
drawTexture(stack, this.x, this.y, 0, 0, this.backgroundWidth, this.backgroundHeight);
this.drawSelectionSlot(advanced);
this.drawSelectionSlot(stack, advanced);
}
private void drawSelectionSlot(boolean advanced) {
private void drawSelectionSlot(MatrixStack stack, boolean advanced) {
// Draw selection slot
int slot = this.m_container.getSelectedSlot();
if (slot >= 0) {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
int slotX = slot % 4;
int slotY = slot / 4;
minecraft.getTextureManager()
client.getTextureManager()
.bindTextureInner(advanced ? BACKGROUND_ADVANCED : BACKGROUND_NORMAL);
blit(this.x + this.m_container.m_turtleInvStartX - 2 + slotX * 18, this.y + this.m_container.m_playerInvStartY - 2 + slotY * 18, 0, 217, 24, 24);
drawTexture(stack, this.x + this.m_container.m_turtleInvStartX - 2 + slotX * 18, this.y + this.m_container.m_playerInvStartY - 2 + slotY * 18, 0, 217, 24, 24);
}
}
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
renderBackground();
super.render(mouseX, mouseY, partialTicks);
this.drawMouseoverTooltip(mouseX, mouseY);
public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
renderBackground(stack);
super.render(stack, mouseX, mouseY, partialTicks);
this.drawMouseoverTooltip(stack, mouseX, mouseY);
}
}