Dieser Commit ist enthalten in:
Ursprung
828cf88518
Commit
6bb6b479fb
@ -4,11 +4,11 @@ org.gradle.parallel=true
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.19.3
|
||||
yarn_mappings=1.19.3+build.1
|
||||
minecraft_version=1.20.1
|
||||
yarn_mappings=1.20.1+build.1
|
||||
loader_version=0.14.11
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 2.0.0
|
||||
mod_version = 3.0.0
|
||||
maven_group = de.zonlykroks
|
||||
archives_base_name = AdvancedScripts
|
@ -20,11 +20,11 @@
|
||||
package de.steamwar.advancedscripts.screen;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.steamwar.advancedscripts.lexer.TokenTypeColors;
|
||||
import de.steamwar.advancedscripts.lexer.ScriptColorizer;
|
||||
import de.steamwar.advancedscripts.lexer.Token;
|
||||
import de.steamwar.advancedscripts.lexer.TokenTypeColors;
|
||||
import net.minecraft.client.font.TextHandler;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.BookEditScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.BookScreen;
|
||||
@ -33,7 +33,6 @@ import net.minecraft.client.gui.widget.PressableWidget;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.util.NarratorManager;
|
||||
import net.minecraft.client.util.SelectionManager;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
@ -45,7 +44,10 @@ import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Hand;
|
||||
import org.apache.commons.lang3.mutable.MutableInt;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class ScriptEditScreen extends Screen {
|
||||
@ -159,12 +161,12 @@ public class ScriptEditScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
setFocused(null);
|
||||
this.renderBackground(matrices);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||
renderBackground(context);
|
||||
RenderSystem.setShader(GameRenderer::getRenderTypeTextProgram);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
fill(matrices, 23, 23, this.width - 23, this.height - 63, TokenTypeColors.BACKGROUND);
|
||||
context.fill(23, 23, this.width - 23, this.height - 63, TokenTypeColors.BACKGROUND);
|
||||
|
||||
int lineNumberLength = textRenderer.getWidth(lines.size() + "");
|
||||
|
||||
@ -185,15 +187,15 @@ public class ScriptEditScreen extends Screen {
|
||||
}
|
||||
|
||||
if (s.isEmpty() && i == cursorY) {
|
||||
drawCursor(matrices, 25 + lineNumberLength + 5, lineNumber.getValue() * 9 + 25, true);
|
||||
drawCursor(context, 25 + lineNumberLength + 5, lineNumber.getValue() * 9 + 25, true);
|
||||
}
|
||||
|
||||
// Line number
|
||||
int height = this.textRenderer.getWrappedLinesHeight(s, this.width - 50 - lineNumberLength - 5);
|
||||
if (lineTooLong(s)) {
|
||||
fill(matrices, 25 + lineNumberLength + 2, 25 + lineNumber.getValue() * 9, 25 + lineNumberLength + 3, 25 + lineNumber.getValue() * 9 + height, TokenTypeColors.ERROR);
|
||||
context.fill(25 + lineNumberLength + 2, 25 + lineNumber.getValue() * 9, 25 + lineNumberLength + 3, 25 + lineNumber.getValue() * 9 + height, TokenTypeColors.ERROR);
|
||||
}
|
||||
this.textRenderer.draw(matrices, String.valueOf(lineNumberText), 25f + lineNumberLength - textRenderer.getWidth(String.valueOf(lineNumberText)), 25f + lineNumber.getValue() * 9f, 0xFFFFFF);
|
||||
context.drawText(this.textRenderer, Text.literal(String.valueOf(lineNumberText)), 25 + lineNumberLength - textRenderer.getWidth(String.valueOf(lineNumberText)), 25 + lineNumber.getValue() * 9, 0xFFFFFF, false);
|
||||
lineNumberText++;
|
||||
|
||||
// Line text
|
||||
@ -234,15 +236,15 @@ public class ScriptEditScreen extends Screen {
|
||||
}
|
||||
|
||||
if (finalI >= minSelectionY && finalI <= maxSelectionY && x2 > x1) {
|
||||
fill(matrices, x1, y + 25, x2, y + 25 + 9, TokenTypeColors.SELECTION);
|
||||
context.fill(x1, y + 25, x2, y + 25 + 9, TokenTypeColors.SELECTION);
|
||||
}
|
||||
}
|
||||
|
||||
if (finalI == cursorY && currentXIndex.get() >= cursorX && previousXIndex <= cursorX) {
|
||||
drawCursor(matrices, x.get() + textRenderer.getWidth(line.substring(0, cursorX - previousXIndex)) - 1, 25 + y, isAtEndOfLine());
|
||||
drawCursor(context, x.get() + textRenderer.getWidth(line.substring(0, cursorX - previousXIndex)) - 1, 25 + y, isAtEndOfLine());
|
||||
}
|
||||
|
||||
this.textRenderer.draw(matrices, line, x.get(), 25 + y, token.color);
|
||||
context.drawText(this.textRenderer, Text.literal(line), x.get(), 25 + y, token.color, false);
|
||||
x.addAndGet(textRenderer.getWidth(line));
|
||||
if (x.get() > this.width - 50 - lineNumberLength - 5) {
|
||||
x.set(25 + lineNumberLength + 5);
|
||||
@ -253,7 +255,7 @@ public class ScriptEditScreen extends Screen {
|
||||
lineNumber.increment();
|
||||
}
|
||||
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
private boolean lineTooLong(String s) {
|
||||
@ -263,13 +265,13 @@ public class ScriptEditScreen extends Screen {
|
||||
return textRenderer.getWrappedLinesHeight(s, 114) > 128;
|
||||
}
|
||||
|
||||
private void drawCursor(MatrixStack matrices, int x, int y, boolean atEnd) {
|
||||
private void drawCursor(DrawContext context, int x, int y, boolean atEnd) {
|
||||
if (this.tickCounter / 6 % 2 == 0) {
|
||||
if (!atEnd) {
|
||||
Objects.requireNonNull(this.textRenderer);
|
||||
DrawableHelper.fill(matrices, x, y - 1, x + 1, y + 9, 0xFFFFFFFF);
|
||||
context.fill(x, y - 1, x + 1, y + 9, 0xFFFFFFFF);
|
||||
} else {
|
||||
this.textRenderer.draw(matrices, "_", (float) x, (float) y, 0xFFFFFFFF);
|
||||
context.drawText(this.textRenderer, Text.literal("_"), x, y, 0xFFFFFFFF, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.11",
|
||||
"minecraft": ">=1.19.3",
|
||||
"minecraft": ">=1.20.1",
|
||||
"java": ">=17"
|
||||
},
|
||||
"accessWidener" : "advancedscripts.accesswidener"
|
||||
|
@ -2,4 +2,4 @@ build:
|
||||
- "./gradlew remapJar"
|
||||
|
||||
artifacts:
|
||||
"/binarys/AdvancedScripts.jar": "build/libs/AdvancedScripts-2.0.0.jar"
|
||||
"/binarys/AdvancedScripts-v3.jar": "build/libs/AdvancedScripts-3.0.0.jar"
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren