server wont delete history
This commit is contained in:
parent
d1abbeec7b
commit
c5ff6a2c4f
2 changed files with 12 additions and 7 deletions
|
@ -80,9 +80,6 @@ public class ComputerBlockEntity extends BlockEntity {
|
|||
} else {
|
||||
lines.add("Made unknown!");
|
||||
}
|
||||
while (lines.size() > screen.dimensions().rows() - 1 && !lines.isEmpty()) {
|
||||
lines.removeFirst();
|
||||
}
|
||||
}
|
||||
|
||||
public ComputerScreenUpdate getSyncPacket(int windowId) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package dev.exhq.ajarc.computer;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import dev.exhq.ajarc.network.ComputerCommandSent;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
|
@ -22,7 +23,7 @@ public class ComputerScreen extends AbstractContainerScreen<ComputerMenu> {
|
|||
|
||||
@Override
|
||||
protected void init() {
|
||||
imageHeight = menu.getRows() * 11 - 1;
|
||||
imageHeight = (menu.getRows() * 11) - 1;
|
||||
imageWidth = menu.getColumns() * 10;
|
||||
super.init();
|
||||
}
|
||||
|
@ -42,7 +43,9 @@ public class ComputerScreen extends AbstractContainerScreen<ComputerMenu> {
|
|||
|
||||
@Override
|
||||
public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) {
|
||||
if (super.keyPressed(pKeyCode, pScanCode, pModifiers))
|
||||
InputConstants.Key mouseKey = InputConstants.getKey(pKeyCode, pScanCode);
|
||||
assert this.minecraft != null;
|
||||
if (!this.minecraft.options.keyInventory.isActiveAndMatches(mouseKey) && super.keyPressed(pKeyCode, pScanCode, pModifiers))
|
||||
return true;
|
||||
if (pKeyCode == GLFW.GLFW_KEY_ENTER) {
|
||||
var toSend = editingLine;
|
||||
|
@ -50,14 +53,19 @@ public class ComputerScreen extends AbstractContainerScreen<ComputerMenu> {
|
|||
menu.sendLineToServer(toSend);
|
||||
return true;
|
||||
}
|
||||
if (pKeyCode == GLFW.GLFW_KEY_BACKSPACE && !editingLine.isEmpty()) {
|
||||
editingLine = editingLine.substring(0, editingLine.length() - 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderLabels(@NotNull GuiGraphics graphics, int pMouseX, int pMouseY) {
|
||||
int offsetY = 0;
|
||||
for (String line : menu.getLines()) {
|
||||
graphics.drawString(font, line, 0, offsetY, 0xFFFFFFFF);
|
||||
var lines = menu.getLines();
|
||||
//var renderedlines = lines.subList(lines.size() - menu.getRows(), lines.size());
|
||||
for (int i = Math.max(0, lines.size() - menu.getRows() + 1); i < lines.size(); i++) {
|
||||
graphics.drawString(font, lines.get(i), 0, offsetY, 0xFFFFFFFF);
|
||||
offsetY += 11;
|
||||
}
|
||||
graphics.drawString(font, "$ " + editingLine, 0, offsetY, 0xFFFFFFFF);
|
||||
|
|
Loading…
Reference in a new issue