@@ -58,16 +58,16 @@ private void fixNBT(Level world, CompoundTag nbt, boolean spawnData, CallbackInf
58
58
List <Map .Entry <BlockPos , StructureTemplate .StructureBlockInfo >> toBeReplaced = new ArrayList <>();
59
59
for (Iterator <Map .Entry <BlockPos , StructureTemplate .StructureBlockInfo >> iterator = blocks .entrySet ().iterator (); iterator .hasNext (); ) {
60
60
Map .Entry <BlockPos , StructureTemplate .StructureBlockInfo > entry = iterator .next ();
61
- if (!(entry .getValue ().state () .getBlock () instanceof ItemSiloBlock ))
61
+ if (!(entry .getValue ().state .getBlock () instanceof ItemSiloBlock ))
62
62
continue ;
63
- if (!entry .getValue ().nbt () .contains ("Length" ) && (
64
- blocks .get (NbtUtils .readBlockPos (entry .getValue ().nbt () .getCompound ("Controller" ))) == null ||
65
- !(blocks .get (NbtUtils .readBlockPos (entry .getValue ().nbt () .getCompound ("Controller" ))).state () .getBlock () instanceof ItemSiloBlock ))) {
66
- entry .getValue ().nbt () .put ("Controller" , NbtUtils .writeBlockPos (entry .getKey ()));
67
- entry .getValue ().nbt () .putInt ("Length" , 1 );
68
- entry .getValue ().nbt () .putInt ("Size" , 1 );
63
+ if (!entry .getValue ().nbt .contains ("Length" ) && (
64
+ blocks .get (NbtUtils .readBlockPos (entry .getValue ().nbt .getCompound ("Controller" ))) == null ||
65
+ !(blocks .get (NbtUtils .readBlockPos (entry .getValue ().nbt .getCompound ("Controller" ))).state .getBlock () instanceof ItemSiloBlock ))) {
66
+ entry .getValue ().nbt .put ("Controller" , NbtUtils .writeBlockPos (entry .getKey ()));
67
+ entry .getValue ().nbt .putInt ("Length" , 1 );
68
+ entry .getValue ().nbt .putInt ("Size" , 1 );
69
69
iterator .remove ();
70
- toBeReplaced .add (new AbstractMap .SimpleEntry <>(entry .getKey (), new StructureTemplate .StructureBlockInfo (entry .getKey (), entry .getValue ().state () .setValue (ItemSiloBlock .LARGE , false ), entry .getValue ().nbt () )));
70
+ toBeReplaced .add (new AbstractMap .SimpleEntry <>(entry .getKey (), new StructureTemplate .StructureBlockInfo (entry .getKey (), entry .getValue ().state .setValue (ItemSiloBlock .LARGE , false ), entry .getValue ().nbt )));
71
71
}
72
72
}
73
73
for (Map .Entry <BlockPos , StructureTemplate .StructureBlockInfo > entry : toBeReplaced ) {
@@ -76,12 +76,12 @@ private void fixNBT(Level world, CompoundTag nbt, boolean spawnData, CallbackInf
76
76
toBeReplaced .clear ();
77
77
for (Iterator <Map .Entry <BlockPos , StructureTemplate .StructureBlockInfo >> iterator = capturedMultiblocks .entries ().iterator (); iterator .hasNext (); ) {
78
78
Map .Entry <BlockPos , StructureTemplate .StructureBlockInfo > entry = iterator .next ();
79
- if (!(entry .getValue ().state () .getBlock () instanceof ItemSiloBlock ))
79
+ if (!(entry .getValue ().state .getBlock () instanceof ItemSiloBlock ))
80
80
continue ;
81
- if (!blocks .containsKey (entry .getKey ()) || !(blocks .get (entry .getKey ()).state () .getBlock () instanceof ItemSiloBlock )) {
82
- if (entry .getValue ().nbt () .contains ("Controller" )) {
81
+ if (!blocks .containsKey (entry .getKey ()) || !(blocks .get (entry .getKey ()).state .getBlock () instanceof ItemSiloBlock )) {
82
+ if (entry .getValue ().nbt .contains ("Controller" )) {
83
83
iterator .remove ();
84
- toBeReplaced .add (new AbstractMap .SimpleEntry <>(NbtUtils .readBlockPos (entry .getValue ().nbt () .getCompound ("Controller" )), entry .getValue ()));
84
+ toBeReplaced .add (new AbstractMap .SimpleEntry <>(NbtUtils .readBlockPos (entry .getValue ().nbt .getCompound ("Controller" )), entry .getValue ()));
85
85
}
86
86
}
87
87
}
@@ -92,23 +92,23 @@ private void fixNBT(Level world, CompoundTag nbt, boolean spawnData, CallbackInf
92
92
for (BlockPos blockPos : capturedMultiblocks .keySet ()) {
93
93
if (!blocks .containsKey (blockPos ))
94
94
continue ;
95
- if (!(blocks .get (blockPos ).state () .getBlock () instanceof ItemSiloBlock ))
95
+ if (!(blocks .get (blockPos ).state .getBlock () instanceof ItemSiloBlock ))
96
96
continue ;
97
97
Collection <StructureTemplate .StructureBlockInfo > parts = capturedMultiblocks .get (blockPos );
98
98
99
99
if (parts .size () == 1 ) {
100
100
StructureTemplate .StructureBlockInfo part = parts .iterator ().next ();
101
- if (part .nbt () .contains ("Length" ) && part .nbt () .getInt ("Length" ) > 1 ) {
102
- part .nbt () .putInt ("Length" , 1 );
103
- part .nbt () .putInt ("Size" , 1 );
104
- toBeReplaced .add (new AbstractMap .SimpleEntry <>(blockPos , new StructureTemplate .StructureBlockInfo (part .pos () , part .state () .setValue (ItemSiloBlock .LARGE , false ), part .nbt () )));
101
+ if (part .nbt .contains ("Length" ) && part .nbt .getInt ("Length" ) > 1 ) {
102
+ part .nbt .putInt ("Length" , 1 );
103
+ part .nbt .putInt ("Size" , 1 );
104
+ toBeReplaced .add (new AbstractMap .SimpleEntry <>(blockPos , new StructureTemplate .StructureBlockInfo (part .pos , part .state .setValue (ItemSiloBlock .LARGE , false ), part .nbt )));
105
105
}
106
106
}
107
107
}
108
108
for (Map .Entry <BlockPos , StructureTemplate .StructureBlockInfo > entry : toBeReplaced ) {
109
109
capturedMultiblocks .removeAll (entry .getKey ());
110
110
capturedMultiblocks .put (entry .getKey (), entry .getValue ());
111
- blocks .put (entry .getValue ().pos () , entry .getValue ());
111
+ blocks .put (entry .getValue ().pos , entry .getValue ());
112
112
}
113
113
}
114
114
}
0 commit comments