Skip to content

Commit 6860eec

Browse files
committed
Fix pipe networks bugged in new dimensions
1 parent 057b9c0 commit 6860eec

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

src/main/java/rearth/oritech/block/blocks/pipes/EnergyPipeBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ public boolean connectToBlockType(Block block) {
4747

4848
@Override
4949
public GenericPipeInterfaceEntity.PipeNetworkData getNetworkData(World world) {
50-
return ENERGY_PIPE_DATA.getOrDefault(world.getRegistryKey().getValue(), new GenericPipeInterfaceEntity.PipeNetworkData());
50+
return ENERGY_PIPE_DATA.computeIfAbsent(world.getRegistryKey().getValue(), data -> new GenericPipeInterfaceEntity.PipeNetworkData());
5151
}
5252
}

src/main/java/rearth/oritech/block/blocks/pipes/FluidPipeBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ public boolean connectToBlockType(Block block) {
4747

4848
@Override
4949
public GenericPipeInterfaceEntity.PipeNetworkData getNetworkData(World world) {
50-
return FLUID_PIPE_DATA.getOrDefault(world.getRegistryKey().getValue(), new GenericPipeInterfaceEntity.PipeNetworkData());
50+
return FLUID_PIPE_DATA.computeIfAbsent(world.getRegistryKey().getValue(), data -> new GenericPipeInterfaceEntity.PipeNetworkData());
5151
}
5252
}

src/main/java/rearth/oritech/block/blocks/pipes/GenericPipeConnectionBlock.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState
6868

6969
var regKey = world.getRegistryKey().getValue();
7070
var dataId = getPipeTypeName() + "_" + regKey.getNamespace() + "_" + regKey.getPath();
71+
System.out.println("saving for: " + dataId);
7172
((ServerWorld) world).getPersistentStateManager().set(dataId, getNetworkData(world));
7273
}
7374

src/main/java/rearth/oritech/block/blocks/pipes/ItemPipeBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ public boolean connectToBlockType(Block block) {
4747

4848
@Override
4949
public GenericPipeInterfaceEntity.PipeNetworkData getNetworkData(World world) {
50-
return ITEM_PIPE_DATA.getOrDefault(world.getRegistryKey().getValue(), new GenericPipeInterfaceEntity.PipeNetworkData());
50+
return ITEM_PIPE_DATA.computeIfAbsent(world.getRegistryKey().getValue(), data -> new GenericPipeInterfaceEntity.PipeNetworkData());
5151
}
5252
}

src/main/java/rearth/oritech/block/entity/pipes/GenericPipeInterfaceEntity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ public static PipeNetworkData fromNbt(NbtCompound nbt) {
288288
}
289289
}
290290

291+
result.markDirty();
292+
291293
return result;
292294
}
293295

0 commit comments

Comments
 (0)