diff --git a/changelog/3.0.0+1.20.2.md b/changelog/3.0.0+1.20.2.md deleted file mode 100644 index 8b253ff..0000000 --- a/changelog/3.0.0+1.20.2.md +++ /dev/null @@ -1,6 +0,0 @@ -- Updated to 1.20.2 -- Updated nodeflow - - Nodes are now grouped with tags, allowing easier customization - - Now uses split client sources - - Textures are now sprite based - - Lots of API changes for anyone building an addon or integration \ No newline at end of file diff --git a/changelog/3.0.0+1.20.4.md b/changelog/3.0.0+1.20.4.md new file mode 100644 index 0000000..ddd2a3b --- /dev/null +++ b/changelog/3.0.0+1.20.4.md @@ -0,0 +1,2 @@ +* Updated to 1.20.4 + * Tooltips changed slightly due to a change in how minecraft does them \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 54598fa..932dd27 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,18 +1,18 @@ org.gradle.jvmargs=-Xmx1G -minecraft_version=1.20.2 -yarn_mappings=1.20.2+build.2 -loader_version=0.14.22 +minecraft_version=1.20.4 +yarn_mappings=1.20.4+build.3 +loader_version=0.15.2 mod_version=3.0.0 maven_group=io.github.mattidragon archives_base_name=advanced-networking -fabric_version=0.89.3+1.20.2 -nodeflow_version=1.0.0-mc.1.20.2 -graphlib_version=1.4.0+1.20.2 +fabric_version=0.91.2+1.20.4 +nodeflow_version=1.0.1-mc.1.20.4 +graphlib_version=1.4.0+1.20.4 energy_version=3.0.0 -yacl_version=3.2.1+1.20.2 -modmenu_version=8.0.0 +yacl_version=3.3.1+1.20.4 +modmenu_version=9.0.0-pre.1 configtoolkit_version=1.0.0 noindium_version=1.1.0+1.20 \ No newline at end of file diff --git a/src/client/java/io/github/mattidragon/advancednetworking/client/screen/node/InterfaceNodeConfigScreen.java b/src/client/java/io/github/mattidragon/advancednetworking/client/screen/node/InterfaceNodeConfigScreen.java index 9b52080..f731dd6 100644 --- a/src/client/java/io/github/mattidragon/advancednetworking/client/screen/node/InterfaceNodeConfigScreen.java +++ b/src/client/java/io/github/mattidragon/advancednetworking/client/screen/node/InterfaceNodeConfigScreen.java @@ -72,17 +72,17 @@ record Interface(String id, String name) { private class InterfaceList extends ElementListWidget { public InterfaceList(MinecraftClient minecraftClient, int screenWidth, int screenHeight) { - super(minecraftClient, 150, screenHeight - 50, 30, screenHeight - 20, 25); + super(minecraftClient, 150, screenHeight - 50, 30, 25); setRenderBackground(false); - setLeftPos(((screenWidth - 200) / 2) - this.width / 2); + setX(((screenWidth - 200) / 2) - this.width / 2); addEntry(new InterfaceList.MessageEntry(Text.translatable("node.advanced_networking.interface.loading"))); } @Override protected int getScrollbarPositionX() { - return left + width; + return getX() + width; } @Override @@ -118,12 +118,24 @@ public void render(DrawContext context, int index, int y, int x, int entryWidth, private class InterfaceEntry extends InterfaceList.Entry { private final Interface value; - private final InterfaceList.InterfaceEntry.CheckBox checkbox; + private final CheckboxWidget checkbox; private InterfaceEntry(Interface value) { this.value = value; var text = value.name.isBlank() ? value.id : value.name; - this.checkbox = new InterfaceList.InterfaceEntry.CheckBox(0, 0, 150, 20, Text.literal(text), false); + this.checkbox = CheckboxWidget.builder(Text.literal(text), textRenderer) + .callback((clickedBox, checked) -> { + for (int i = 0; i < getEntryCount(); i++) { + if (getEntry(i) instanceof InterfaceList.InterfaceEntry entry && entry.checkbox != clickedBox) { + ((CheckboxWidgetAccess) entry.checkbox).setChecked(false); + } + } + + owner.interfaceId = value.id; + }) + .build(); + checkbox.setWidth(150); + checkbox.setHeight(20); } @Override @@ -142,24 +154,6 @@ public void render(DrawContext context, int index, int y, int x, int entryWidth, checkbox.setY(y); checkbox.render(context, mouseX, mouseY, tickDelta); } - - private class CheckBox extends CheckboxWidget { - public CheckBox(int x, int y, int width, int height, Text message, boolean checked) { - super(x, y, width, height, message, checked); - } - - @Override - public void onPress() { - for (int i = 0; i < getEntryCount(); i++) { - if (getEntry(i) instanceof InterfaceList.InterfaceEntry entry) - ((CheckboxWidgetAccess) entry.checkbox).setChecked(false); - } - - owner.interfaceId = value.id; - - super.onPress(); - } - } } } } diff --git a/src/main/generated/data/advanced_networking/advancements/recipes/misc/compound.json b/src/main/generated/data/advanced_networking/advancements/recipes/misc/compound.json index 2d56465..5706094 100644 --- a/src/main/generated/data/advanced_networking/advancements/recipes/misc/compound.json +++ b/src/main/generated/data/advanced_networking/advancements/recipes/misc/compound.json @@ -43,6 +43,5 @@ "recipes": [ "advanced_networking:compound" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/main/generated/data/advanced_networking/advancements/recipes/redstone/cable.json b/src/main/generated/data/advanced_networking/advancements/recipes/redstone/cable.json index e179bc1..23f39ca 100644 --- a/src/main/generated/data/advanced_networking/advancements/recipes/redstone/cable.json +++ b/src/main/generated/data/advanced_networking/advancements/recipes/redstone/cable.json @@ -43,6 +43,5 @@ "recipes": [ "advanced_networking:cable" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/main/generated/data/advanced_networking/advancements/recipes/redstone/controller.json b/src/main/generated/data/advanced_networking/advancements/recipes/redstone/controller.json index a717916..be5b0b8 100644 --- a/src/main/generated/data/advanced_networking/advancements/recipes/redstone/controller.json +++ b/src/main/generated/data/advanced_networking/advancements/recipes/redstone/controller.json @@ -43,6 +43,5 @@ "recipes": [ "advanced_networking:controller" ] - }, - "sends_telemetry_event": false + } } \ No newline at end of file diff --git a/src/main/generated/data/advanced_networking/recipes/cable.json b/src/main/generated/data/advanced_networking/recipes/cable.json index 97fc1a2..6d173a1 100644 --- a/src/main/generated/data/advanced_networking/recipes/cable.json +++ b/src/main/generated/data/advanced_networking/recipes/cable.json @@ -12,6 +12,5 @@ "result": { "count": 8, "item": "advanced_networking:cable" - }, - "show_notification": true + } } \ No newline at end of file diff --git a/src/main/generated/data/advanced_networking/recipes/controller.json b/src/main/generated/data/advanced_networking/recipes/controller.json index b97487b..abec172 100644 --- a/src/main/generated/data/advanced_networking/recipes/controller.json +++ b/src/main/generated/data/advanced_networking/recipes/controller.json @@ -19,6 +19,5 @@ ], "result": { "item": "advanced_networking:controller" - }, - "show_notification": true + } } \ No newline at end of file diff --git a/src/main/java/io/github/mattidragon/advancednetworking/block/CableBlock.java b/src/main/java/io/github/mattidragon/advancednetworking/block/CableBlock.java index 899490a..d81a817 100644 --- a/src/main/java/io/github/mattidragon/advancednetworking/block/CableBlock.java +++ b/src/main/java/io/github/mattidragon/advancednetworking/block/CableBlock.java @@ -4,6 +4,7 @@ import com.google.common.collect.Maps; import com.google.common.primitives.Longs; import com.kneelawk.graphlib.api.graph.user.BlockNode; +import com.mojang.serialization.MapCodec; import io.github.mattidragon.advancednetworking.AdvancedNetworking; import io.github.mattidragon.advancednetworking.misc.ClientScreenOpener; import io.github.mattidragon.advancednetworking.misc.InterfaceType; @@ -66,6 +67,11 @@ public CableBlock(AbstractBlock.Settings settings) { this.connectionsToShape = this.generateShapeMap(2 / 16f); } + @Override + protected MapCodec getCodec() { + return createCodec(CableBlock::new); + } + @Override public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; diff --git a/src/main/java/io/github/mattidragon/advancednetworking/block/ControllerBlock.java b/src/main/java/io/github/mattidragon/advancednetworking/block/ControllerBlock.java index bbc9f6e..f51ca50 100644 --- a/src/main/java/io/github/mattidragon/advancednetworking/block/ControllerBlock.java +++ b/src/main/java/io/github/mattidragon/advancednetworking/block/ControllerBlock.java @@ -1,5 +1,6 @@ package io.github.mattidragon.advancednetworking.block; +import com.mojang.serialization.MapCodec; import io.github.mattidragon.advancednetworking.AdvancedNetworking; import io.github.mattidragon.advancednetworking.network.NetworkRegistry; import net.minecraft.block.Block; @@ -33,6 +34,11 @@ public ControllerBlock(Settings settings) { this.setDefaultState(this.getDefaultState().with(POWERED, false).with(SUCCESS, true)); } + @Override + protected MapCodec getCodec() { + return createCodec(ControllerBlock::new); + } + @Nullable @Override public BlockState getPlacementState(ItemPlacementContext ctx) { diff --git a/src/main/java/io/github/mattidragon/advancednetworking/block/ControllerBlockEntity.java b/src/main/java/io/github/mattidragon/advancednetworking/block/ControllerBlockEntity.java index 98deb22..d8a3db2 100644 --- a/src/main/java/io/github/mattidragon/advancednetworking/block/ControllerBlockEntity.java +++ b/src/main/java/io/github/mattidragon/advancednetworking/block/ControllerBlockEntity.java @@ -75,7 +75,7 @@ public void readNbt(NbtCompound nbt) { graph.readNbt(nbt.getCompound("graph")); errors = NbtUtils.readStrings(nbt, "errors").stream() - .map((Function>) json -> Optional.ofNullable(Text.Serializer.fromJson(json))) + .map((Function>) json -> Optional.ofNullable(Text.Serialization.fromJson(json))) .flatMap(Optional::stream) .toList(); } @@ -91,7 +91,7 @@ protected void writeNbt(NbtCompound nbt) { var graphNbt = new NbtCompound(); graph.writeNbt(graphNbt); nbt.put("graph", graphNbt); - NbtUtils.writeStrings(nbt, "errors", errors.stream().map(Text.Serializer::toJson).toList()); + NbtUtils.writeStrings(nbt, "errors", errors.stream().map(Text.Serialization::toJsonString).toList()); } public static void tick(World world, BlockPos pos, BlockState state, ControllerBlockEntity controller) {