From cd3cbc2a959a87b6cc825b83c759f24a79374b7e Mon Sep 17 00:00:00 2001 From: Barbatosishere <584146143@qq.com> Date: Fri, 3 Jul 2026 14:16:42 +0800 Subject: [PATCH 1/5] Fix critical bugs: pack.mcmeta format, NPE on block placement, and registry order --- .../loot_tables/blocks/energy_pylon_flux.json | 19 +++++++++++++++++++ .../blocks/flux_accessor_flux.json | 19 +++++++++++++++++++ .../blocks/induction_port_flux.json | 19 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/energy_pylon_flux.json create mode 100644 versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/flux_accessor_flux.json create mode 100644 versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/induction_port_flux.json diff --git a/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/energy_pylon_flux.json b/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/energy_pylon_flux.json new file mode 100644 index 0000000..7d5196a --- /dev/null +++ b/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/energy_pylon_flux.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "more_flux_storage:energy_pylon_flux" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/flux_accessor_flux.json b/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/flux_accessor_flux.json new file mode 100644 index 0000000..9070174 --- /dev/null +++ b/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/flux_accessor_flux.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "more_flux_storage:flux_accessor_flux" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file diff --git a/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/induction_port_flux.json b/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/induction_port_flux.json new file mode 100644 index 0000000..b4f2488 --- /dev/null +++ b/versions/1.21.1/src/main/resources/data/more_flux_storage/loot_tables/blocks/induction_port_flux.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "more_flux_storage:induction_port_flux" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} \ No newline at end of file From 097e735ec4b499039da31ea4e88c69a3c4ef7117 Mon Sep 17 00:00:00 2001 From: Barbatosishere <584146143@qq.com> Date: Fri, 3 Jul 2026 22:20:12 +0800 Subject: [PATCH 2/5] Fix client crash when Flux Accessor placed next to ME controller --- .../more_flux_storage/blockentity/TileFluxAccessorFlux.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java index b673af5..7201b4a 100644 --- a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java +++ b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java @@ -195,6 +195,10 @@ private void syncTransferStateForTagWrite() { private final class FluxAccessorTransferHandler extends AbstractFluxTransferHandler { private void syncBufferFromStorage() { + // Only sync on server side to avoid client crashes + if (level == null || level.isClientSide) { + return; + } IStorageService storage = getStorageService(); setBuffer(storage == null ? 0L : storage.getCachedInventory().get(FluxKey.of(EnergyType.FE))); } From 3f4639913bd5029b4479d21fc0ec8054e2f5b3d4 Mon Sep 17 00:00:00 2001 From: Barbatosishere <584146143@qq.com> Date: Fri, 3 Jul 2026 22:29:09 +0800 Subject: [PATCH 3/5] Fix pack.mcmeta format for all versions --- versions/1.12.2/src/main/resources/pack.mcmeta | 6 ++---- versions/1.20.1/src/main/resources/pack.mcmeta | 6 ++---- versions/1.21.1/src/main/resources/pack.mcmeta | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/versions/1.12.2/src/main/resources/pack.mcmeta b/versions/1.12.2/src/main/resources/pack.mcmeta index 531a377..da04c20 100644 --- a/versions/1.12.2/src/main/resources/pack.mcmeta +++ b/versions/1.12.2/src/main/resources/pack.mcmeta @@ -1,8 +1,6 @@ { "pack": { "description": "${mod_name} Resources", - "pack_format": ${ - resource_pack_format -} -} + "pack_format": ${resource_pack_format} + } } \ No newline at end of file diff --git a/versions/1.20.1/src/main/resources/pack.mcmeta b/versions/1.20.1/src/main/resources/pack.mcmeta index 531a377..da04c20 100644 --- a/versions/1.20.1/src/main/resources/pack.mcmeta +++ b/versions/1.20.1/src/main/resources/pack.mcmeta @@ -1,8 +1,6 @@ { "pack": { "description": "${mod_name} Resources", - "pack_format": ${ - resource_pack_format -} -} + "pack_format": ${resource_pack_format} + } } \ No newline at end of file diff --git a/versions/1.21.1/src/main/resources/pack.mcmeta b/versions/1.21.1/src/main/resources/pack.mcmeta index b95bcce..da04c20 100644 --- a/versions/1.21.1/src/main/resources/pack.mcmeta +++ b/versions/1.21.1/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "${mod_name} Resources", - "pack_format": " ${resource_pack_format}" + "pack_format": ${resource_pack_format} } } \ No newline at end of file From 6cca9471261ddea7d1a7afd4180394a1f3bfb42b Mon Sep 17 00:00:00 2001 From: Barbatosishere <584146143@qq.com> Date: Fri, 3 Jul 2026 23:20:09 +0800 Subject: [PATCH 4/5] Fix NPE crash when placing Flux blocks --- .../blockentity/TileEnergyPylonFlux.java | 15 ++++++++++++++- .../blockentity/TileFluxAccessorFlux.java | 15 ++++++++++++++- .../blockentity/TileInductionPortFlux.java | 15 ++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileEnergyPylonFlux.java b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileEnergyPylonFlux.java index d9edef8..c8d7258 100644 --- a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileEnergyPylonFlux.java +++ b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileEnergyPylonFlux.java @@ -28,6 +28,8 @@ public class TileEnergyPylonFlux extends TileEnergyPylon implements IFluxProxyHo private final EnergyPylonTransferHandler transferHandler = new EnergyPylonTransferHandler(); private ProxyFluxDevice fluxProxyDevice; + private CompoundTag pendingFluxTag; + private byte pendingFluxTagType; private int fluxTick; public TileEnergyPylonFlux(BlockPos pos, BlockState state) { @@ -53,6 +55,11 @@ public void tick() { @Override public void onLoad() { getOrCreateFluxProxyDevice().syncLevel(); + // Process any pending flux tag data that was received before level was initialized + if (pendingFluxTag != null) { + getOrCreateFluxProxyDevice().readCustomTag(pendingFluxTag, pendingFluxTagType); + pendingFluxTag = null; + } super.onLoad(); } @@ -139,7 +146,13 @@ public void writeFluxTag(CompoundTag tag, byte type) { @Override public void readFluxTag(CompoundTag tag, byte type) { - getOrCreateFluxProxyDevice().readCustomTag(tag, type); + // Defer reading if level is not yet initialized to avoid NPE in FluxNetworks + if (level == null) { + pendingFluxTag = tag.copy(); + pendingFluxTagType = type; + } else { + getOrCreateFluxProxyDevice().readCustomTag(tag, type); + } } @Override diff --git a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java index 7201b4a..56fe612 100644 --- a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java +++ b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java @@ -33,6 +33,8 @@ public class TileFluxAccessorFlux extends AENetworkedBlockEntity implements IFlu private final FluxAccessorTransferHandler transferHandler = new FluxAccessorTransferHandler(); private ProxyFluxDevice fluxProxyDevice; + private CompoundTag pendingFluxTag; + private byte pendingFluxTagType; public TileFluxAccessorFlux(BlockPos pos, BlockState state) { super(Objects.requireNonNull(MoreFluxStorageContent.getFluxAccessorFluxBlockEntityType(), "Flux accessor block entity type is not registered"), pos, state); @@ -54,6 +56,11 @@ public void tick() { @Override public void onReady() { getOrCreateFluxProxyDevice().syncLevel(); + // Process any pending flux tag data that was received before level was initialized + if (pendingFluxTag != null) { + getOrCreateFluxProxyDevice().readCustomTag(pendingFluxTag, pendingFluxTagType); + pendingFluxTag = null; + } super.onReady(); } @@ -137,7 +144,13 @@ public void writeFluxTag(CompoundTag tag, byte type) { @Override public void readFluxTag(CompoundTag tag, byte type) { - getOrCreateFluxProxyDevice().readCustomTag(tag, type); + // Defer reading if level is not yet initialized to avoid NPE in FluxNetworks + if (level == null) { + pendingFluxTag = tag.copy(); + pendingFluxTagType = type; + } else { + getOrCreateFluxProxyDevice().readCustomTag(tag, type); + } } @Override diff --git a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileInductionPortFlux.java b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileInductionPortFlux.java index 43e2da3..6c49ff3 100644 --- a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileInductionPortFlux.java +++ b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileInductionPortFlux.java @@ -34,6 +34,8 @@ public class TileInductionPortFlux extends TileEntityInductionPort implements IF private final InductionPortTransferHandler transferHandler = new InductionPortTransferHandler(); private ProxyFluxDevice fluxProxyDevice; + private CompoundTag pendingFluxTag; + private byte pendingFluxTagType; public TileInductionPortFlux(BlockPos pos, BlockState state) { super(Utils.trigger(pos), state); @@ -79,6 +81,11 @@ public void loadAdditional(@NotNull CompoundTag tag, @NotNull HolderLookup.Provi @Override public void onLoad() { getOrCreateFluxProxyDevice().syncLevel(); + // Process any pending flux tag data that was received before level was initialized + if (pendingFluxTag != null) { + getOrCreateFluxProxyDevice().readCustomTag(pendingFluxTag, pendingFluxTagType); + pendingFluxTag = null; + } super.onLoad(); } @@ -150,7 +157,13 @@ public void writeFluxTag(CompoundTag tag, byte type) { @Override public void readFluxTag(CompoundTag tag, byte type) { - getOrCreateFluxProxyDevice().readCustomTag(tag, type); + // Defer reading if level is not yet initialized to avoid NPE in FluxNetworks + if (level == null) { + pendingFluxTag = tag.copy(); + pendingFluxTagType = type; + } else { + getOrCreateFluxProxyDevice().readCustomTag(tag, type); + } } public InteractionResult onSneakRightClick(Player player) { From 92f3f592965db3f1e46cdd89ad71ce5f249b44d7 Mon Sep 17 00:00:00 2001 From: Barbatosishere <584146143@qq.com> Date: Sat, 4 Jul 2026 11:12:47 +0800 Subject: [PATCH 5/5] fix: correct NPE in readFluxTag - sync ProxyFluxDevice level before reading --- .../blockentity/TileEnergyPylonFlux.java | 9 ++++++--- .../blockentity/TileFluxAccessorFlux.java | 9 ++++++--- .../blockentity/TileInductionPortFlux.java | 9 ++++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileEnergyPylonFlux.java b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileEnergyPylonFlux.java index c8d7258..3b03d12 100644 --- a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileEnergyPylonFlux.java +++ b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileEnergyPylonFlux.java @@ -146,12 +146,15 @@ public void writeFluxTag(CompoundTag tag, byte type) { @Override public void readFluxTag(CompoundTag tag, byte type) { - // Defer reading if level is not yet initialized to avoid NPE in FluxNetworks - if (level == null) { + // FIX: Sync level on the proxy device before reading, as ProxyFluxDevice has its own + // level field that must be explicitly synced from the host BlockEntity + ProxyFluxDevice device = getOrCreateFluxProxyDevice(); + device.syncLevel(); + if (device.getLevel() == null) { pendingFluxTag = tag.copy(); pendingFluxTagType = type; } else { - getOrCreateFluxProxyDevice().readCustomTag(tag, type); + device.readCustomTag(tag, type); } } diff --git a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java index 56fe612..4578c04 100644 --- a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java +++ b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileFluxAccessorFlux.java @@ -144,12 +144,15 @@ public void writeFluxTag(CompoundTag tag, byte type) { @Override public void readFluxTag(CompoundTag tag, byte type) { - // Defer reading if level is not yet initialized to avoid NPE in FluxNetworks - if (level == null) { + // FIX: Sync level on the proxy device before reading, as ProxyFluxDevice has its own + // level field that must be explicitly synced from the host BlockEntity + ProxyFluxDevice device = getOrCreateFluxProxyDevice(); + device.syncLevel(); + if (device.getLevel() == null) { pendingFluxTag = tag.copy(); pendingFluxTagType = type; } else { - getOrCreateFluxProxyDevice().readCustomTag(tag, type); + device.readCustomTag(tag, type); } } diff --git a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileInductionPortFlux.java b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileInductionPortFlux.java index 6c49ff3..e560ed8 100644 --- a/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileInductionPortFlux.java +++ b/versions/1.21.1/src/main/java/com/circulation/more_flux_storage/blockentity/TileInductionPortFlux.java @@ -157,12 +157,15 @@ public void writeFluxTag(CompoundTag tag, byte type) { @Override public void readFluxTag(CompoundTag tag, byte type) { - // Defer reading if level is not yet initialized to avoid NPE in FluxNetworks - if (level == null) { + // FIX: Sync level on the proxy device before reading, as ProxyFluxDevice has its own + // level field that must be explicitly synced from the host BlockEntity + ProxyFluxDevice device = getOrCreateFluxProxyDevice(); + device.syncLevel(); + if (device.getLevel() == null) { pendingFluxTag = tag.copy(); pendingFluxTagType = type; } else { - getOrCreateFluxProxyDevice().readCustomTag(tag, type); + device.readCustomTag(tag, type); } }