1 Commits
2.1.0 ... main

Author SHA1 Message Date
67f979a051 Update to 1.21.4 2025-01-19 17:13:27 +01:00
3 changed files with 10 additions and 9 deletions

View File

@ -4,11 +4,11 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.3
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.8
loader_version=0.16.10
# Mod Properties
mod_version = 2.1.0
mod_version = 2.2.0
maven_group = de.steamwar
archives_base_name = AdvancedScripts

View File

@ -7,7 +7,7 @@ import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
public record KeyAction(int key, byte action, int modifiers) implements CustomPayload {
private static final Identifier channel = new Identifier("sw:hotkeys");
private static final Identifier channel = Identifier.of("sw:hotkeys");
public static final CustomPayload.Id<KeyAction> ID = new CustomPayload.Id<>(channel);
public static final PacketCodec<RegistryByteBuf, KeyAction> CODEC = PacketCodec.tuple(PacketCodecs.INTEGER, KeyAction::key, PacketCodecs.BYTE, KeyAction::action, PacketCodecs.INTEGER, KeyAction::modifiers, KeyAction::new);

View File

@ -102,7 +102,7 @@ public class ScriptEditScreen extends Screen {
this.addDrawableChild(
new Button(BOOK, this.width - 98 - 5, height - 20 - 5, () -> {
finalizeBook();
this.client.setScreen(new BookEditScreen(player, itemStack, hand));
this.client.setScreen(new BookEditScreen(player, itemStack, hand, toContent(toPages())));
})
);
}
@ -159,7 +159,6 @@ public class ScriptEditScreen extends Screen {
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
setFocused(null);
this.renderBackground(context, mouseX, mouseY, delta);
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
context.fill(23, 23, this.width - 23, this.height - 63, TokenTypeColors.BACKGROUND);
@ -634,11 +633,13 @@ public class ScriptEditScreen extends Screen {
this.client.getNetworkHandler().sendPacket(new BookUpdateC2SPacket(i, pages, Optional.empty()));
}
private WritableBookContentComponent toContent(List<String> pages) {
return new WritableBookContentComponent(pages.stream().map(string -> new RawFilteredPair<String>(string, Optional.empty())).toList());
}
private void writeNbtData(List<String> pages) {
if (!pages.isEmpty()) {
this.itemStack.set(DataComponentTypes.WRITABLE_BOOK_CONTENT, new WritableBookContentComponent(
pages.stream().map(string -> new RawFilteredPair<String>(string, Optional.empty())).toList())
);
this.itemStack.set(DataComponentTypes.WRITABLE_BOOK_CONTENT, toContent(pages));
}
}
}