Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b15e51d33 |
@@ -5,15 +5,15 @@ org.gradle.parallel=true
|
|||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
|
|
||||||
minecraft_version=1.21
|
minecraft_version=1.21.6
|
||||||
yarn_mappings=1.21+build.1
|
yarn_mappings=1.21.6+build.1
|
||||||
loader_version=0.16.14
|
loader_version=0.17.2
|
||||||
loom_version=1.10-SNAPSHOT
|
loom_version=1.11-SNAPSHOT
|
||||||
|
|
||||||
# Fabric API
|
# Fabric API
|
||||||
fabric_version=0.100.3+1.21
|
fabric_version=0.128.2+1.21.6
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 2.2.2
|
mod_version = 2.2.3
|
||||||
maven_group = de.steamwar
|
maven_group = de.steamwar
|
||||||
archives_base_name = AdvancedScripts
|
archives_base_name = AdvancedScripts
|
||||||
@@ -33,9 +33,9 @@ public class TokenTypeColors {
|
|||||||
|
|
||||||
public static final int VARIABLE = 0xFFFFFFFF;
|
public static final int VARIABLE = 0xFFFFFFFF;
|
||||||
public static final int COMMENT = 0xFF656565;
|
public static final int COMMENT = 0xFF656565;
|
||||||
public static final int CONSTANT = 0x3F6EC6;
|
public static final int CONSTANT = 0xFF3F6EC6;
|
||||||
|
|
||||||
public static final int NUMBER = 0xFF61839F;
|
public static final int NUMBER = 0xFF61839F;
|
||||||
public static final int BOOLEAN = 0xFF925F35;
|
public static final int BOOLEAN = 0xFF925F35;
|
||||||
public static final int STRING = 0x6a8759;
|
public static final int STRING = 0xFF6a8759;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.advancedscripts.screen;
|
package de.steamwar.advancedscripts.screen;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.buffers.GpuBufferSlice;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import de.steamwar.advancedscripts.lexer.ScriptColorizer;
|
import de.steamwar.advancedscripts.lexer.ScriptColorizer;
|
||||||
import de.steamwar.advancedscripts.lexer.Token;
|
import de.steamwar.advancedscripts.lexer.Token;
|
||||||
@@ -73,7 +74,7 @@ public class ScriptEditScreen extends Screen {
|
|||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
this.hand = hand;
|
this.hand = hand;
|
||||||
|
|
||||||
List<RawFilteredPair<String>> pages = itemStack.getComponents().get(DataComponentTypes.WRITABLE_BOOK_CONTENT).pages();
|
List<RawFilteredPair<String>> pages = itemStack.get(DataComponentTypes.WRITABLE_BOOK_CONTENT).pages();
|
||||||
pages.forEach(stringRawFilteredPair -> {
|
pages.forEach(stringRawFilteredPair -> {
|
||||||
for (String s : stringRawFilteredPair.raw().split("\n")) {
|
for (String s : stringRawFilteredPair.raw().split("\n")) {
|
||||||
if (s.isEmpty()) {
|
if (s.isEmpty()) {
|
||||||
@@ -103,7 +104,7 @@ public class ScriptEditScreen extends Screen {
|
|||||||
this.addDrawableChild(
|
this.addDrawableChild(
|
||||||
new Button(BOOK, this.width - 98 - 5, height - 20 - 5, () -> {
|
new Button(BOOK, this.width - 98 - 5, height - 20 - 5, () -> {
|
||||||
finalizeBook();
|
finalizeBook();
|
||||||
this.client.setScreen(new BookEditScreen(player, itemStack, hand));
|
this.client.setScreen(new BookEditScreen(player, itemStack, hand, toContent(toPages())));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -156,15 +157,9 @@ public class ScriptEditScreen extends Screen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void applyBlur(float delta) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
setFocused(null);
|
setFocused(null);
|
||||||
this.renderBackground(context, mouseX, mouseY, delta);
|
|
||||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
context.fill(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() + "");
|
int lineNumberLength = textRenderer.getWidth(lines.size() + "");
|
||||||
@@ -194,7 +189,7 @@ public class ScriptEditScreen extends Screen {
|
|||||||
if (lineTooLong(s)) {
|
if (lineTooLong(s)) {
|
||||||
context.fill(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);
|
||||||
}
|
}
|
||||||
context.drawText(textRenderer, String.valueOf(lineNumberText), (int) (25f + lineNumberLength - textRenderer.getWidth(String.valueOf(lineNumberText))), (int) (25f + lineNumber.getValue() * 9f), 0xFFFFFF, false);
|
context.drawText(textRenderer, String.valueOf(lineNumberText), (int) (25f + lineNumberLength - textRenderer.getWidth(String.valueOf(lineNumberText))), (int) (25f + lineNumber.getValue() * 9f), 0xFFFFFFFF, false);
|
||||||
lineNumberText++;
|
lineNumberText++;
|
||||||
|
|
||||||
// Line text
|
// Line text
|
||||||
@@ -634,7 +629,7 @@ public class ScriptEditScreen extends Screen {
|
|||||||
private void finalizeBook() {
|
private void finalizeBook() {
|
||||||
List<String> pages = toPages();
|
List<String> pages = toPages();
|
||||||
this.writeNbtData(pages);
|
this.writeNbtData(pages);
|
||||||
int i = this.hand == Hand.MAIN_HAND ? this.player.getInventory().selectedSlot : 40;
|
int i = this.hand == Hand.MAIN_HAND ? this.player.getInventory().getSelectedSlot() : 40;
|
||||||
this.client.getNetworkHandler().sendPacket(new BookUpdateC2SPacket(i, pages, Optional.empty()));
|
this.client.getNetworkHandler().sendPacket(new BookUpdateC2SPacket(i, pages, Optional.empty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user