2020import net .swedz .tesseract .neoforge .compat .mi .hack .HackedMachineRegistrationHelper ;
2121import net .swedz .tesseract .neoforge .compat .mi .hook .MIHook ;
2222import net .swedz .tesseract .neoforge .compat .mi .hook .context .MIHookContext ;
23+ import net .swedz .tesseract .neoforge .compat .mi .machine .builder .HatchMachineBuilder ;
24+ import net .swedz .tesseract .neoforge .compat .mi .machine .builder .MachineBuilder ;
25+ import net .swedz .tesseract .neoforge .compat .mi .machine .builder .function .MachineBlockRegistrators ;
2326import net .swedz .tesseract .neoforge .registry .holder .BlockWithItemHolder ;
2427import org .apache .commons .lang3 .ArrayUtils ;
2528
@@ -34,16 +37,24 @@ public HatchMIHookContext(MIHook hook)
3437 super (hook );
3538 }
3639
40+ public HatchMachineBuilder builder (String name , String englishName )
41+ {
42+ return MachineBuilder .hatch (hook , name , englishName );
43+ }
44+
45+ @ Deprecated (forRemoval = true )
3746 public interface HatchFactory
3847 {
3948 HatchBlockEntity create (BEP bep , boolean input , ResourceLocation machineId );
4049 }
4150
51+ @ Deprecated (forRemoval = true )
4252 public interface HatchModification <T >
4353 {
4454 void apply (T value , boolean input );
4555 }
4656
57+ @ Deprecated (forRemoval = true )
4758 @ SafeVarargs
4859 private void registerHatch (String id , String englishName , String overlayFolder , MachineCasing casing ,
4960 Consumer <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -53,10 +64,16 @@ private void registerHatch(String id, String englishName, String overlayFolder,
5364 boolean input ,
5465 Consumer <BlockEntityType <?>>... extraRegistrators )
5566 {
56- HackedMachineRegistrationHelper .registerMachine (hook , englishName , id , null , modifyBlock , overrideProperties , defaultMineableTags , (bep ) -> factory .create (bep , input , hook .id (id )), extraRegistrators );
67+ List <MachineBlockRegistrators > wrappedRegistrators = Lists .newArrayList ();
68+ for (var registrator : extraRegistrators )
69+ {
70+ wrappedRegistrators .add (registrator ::accept );
71+ }
72+ HackedMachineRegistrationHelper .registerMachine (hook , englishName , id , null , modifyBlock != null ? modifyBlock ::accept : null , overrideProperties != null ? overrideProperties ::accept : null , defaultMineableTags , (bep ) -> factory .create (bep , input , hook .id (id )), wrappedRegistrators .toArray (MachineBlockRegistrators []::new ));
5773 HackedMachineRegistrationHelper .addMachineModel (hook , id , casing , overlayFolder , true , false , true , false );
5874 }
5975
76+ @ Deprecated (forRemoval = true )
6077 @ SafeVarargs
6178 public final void registerHatch (String id , String englishName , String overlayFolder , MachineCasing casing ,
6279 Consumer <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -68,6 +85,7 @@ public final void registerHatch(String id, String englishName, String overlayFol
6885 this .registerHatch (id , englishName , overlayFolder , casing , modifyBlock , overrideProperties , defaultMineableTags , factory , false , extraRegistrators );
6986 }
7087
88+ @ Deprecated (forRemoval = true )
7189 @ SafeVarargs
7290 public final void registerHatch (String id , String englishName , String overlayFolder , MachineCasing casing ,
7391 Consumer <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -78,6 +96,7 @@ public final void registerHatch(String id, String englishName, String overlayFol
7896 this .registerHatch (id , englishName , overlayFolder , casing , modifyBlock , overrideProperties , true , factory , extraRegistrators );
7997 }
8098
99+ @ Deprecated (forRemoval = true )
81100 @ SafeVarargs
82101 public final void registerHatch (String id , String englishName , String overlayFolder , MachineCasing casing ,
83102 HatchFactory factory ,
@@ -86,6 +105,7 @@ public final void registerHatch(String id, String englishName, String overlayFol
86105 this .registerHatch (id , englishName , overlayFolder , casing , null , null , factory , extraRegistrators );
87106 }
88107
108+ @ Deprecated (forRemoval = true )
89109 @ SafeVarargs
90110 public final void registerHatches (String id , String englishName , String overlayFolder , MachineCasing casing ,
91111 HatchModification <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -108,6 +128,7 @@ public final void registerHatches(String id, String englishName, String overlayF
108128 }
109129 }
110130
131+ @ Deprecated (forRemoval = true )
111132 @ SafeVarargs
112133 public final void registerHatches (String id , String englishName , String overlayFolder , MachineCasing casing ,
113134 HatchModification <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -118,6 +139,7 @@ public final void registerHatches(String id, String englishName, String overlayF
118139 registerHatches (id , englishName , overlayFolder , casing , modifyBlock , overrideProperties , true , factory , extraRegistrators );
119140 }
120141
142+ @ Deprecated (forRemoval = true )
121143 @ SafeVarargs
122144 public final void registerHatches (String id , String englishName , String overlayFolder , MachineCasing casing ,
123145 HatchFactory factory ,
@@ -126,6 +148,7 @@ public final void registerHatches(String id, String englishName, String overlayF
126148 registerHatches (id , englishName , overlayFolder , casing , null , null , factory , extraRegistrators );
127149 }
128150
151+ @ Deprecated (forRemoval = true )
129152 @ SafeVarargs
130153 public final void registerItemHatches (String id , String englishName , MachineCasing casing , int rows , int columns , int xStart , int yStart ,
131154 HatchModification <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -157,6 +180,7 @@ public final void registerItemHatches(String id, String englishName, MachineCasi
157180 }, ArrayUtils .add (extraRegistrators , MachineBlockEntity ::registerItemApi ));
158181 }
159182
183+ @ Deprecated (forRemoval = true )
160184 @ SafeVarargs
161185 public final void registerItemHatches (String id , String englishName , MachineCasing casing , int rows , int columns , int xStart , int yStart ,
162186 HatchModification <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -166,13 +190,15 @@ public final void registerItemHatches(String id, String englishName, MachineCasi
166190 this .registerItemHatches (id , englishName , casing , rows , columns , xStart , yStart , modifyBlock , overrideProperties , true , extraRegistrators );
167191 }
168192
193+ @ Deprecated (forRemoval = true )
169194 @ SafeVarargs
170195 public final void registerItemHatches (String id , String englishName , MachineCasing casing , int rows , int columns , int xStart , int yStart ,
171196 Consumer <BlockEntityType <?>>... extraRegistrators )
172197 {
173198 this .registerItemHatches (id , englishName , casing , rows , columns , xStart , yStart , null , null , extraRegistrators );
174199 }
175200
201+ @ Deprecated (forRemoval = true )
176202 @ SafeVarargs
177203 public final void registerFluidHatches (String id , String englishName , MachineCasing casing , int bucketCapacity ,
178204 HatchModification <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -195,6 +221,7 @@ public final void registerFluidHatches(String id, String englishName, MachineCas
195221 }, ArrayUtils .add (extraRegistrators , MachineBlockEntity ::registerFluidApi ));
196222 }
197223
224+ @ Deprecated (forRemoval = true )
198225 @ SafeVarargs
199226 public final void registerFluidHatches (String id , String englishName , MachineCasing casing , int bucketCapacity ,
200227 HatchModification <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -204,13 +231,15 @@ public final void registerFluidHatches(String id, String englishName, MachineCas
204231 this .registerFluidHatches (id , englishName , casing , bucketCapacity , modifyBlock , overrideProperties , true , extraRegistrators );
205232 }
206233
234+ @ Deprecated (forRemoval = true )
207235 @ SafeVarargs
208236 public final void registerFluidHatches (String id , String englishName , MachineCasing casing , int bucketCapacity ,
209237 Consumer <BlockEntityType <?>>... extraRegistrators )
210238 {
211239 this .registerFluidHatches (id , englishName , casing , bucketCapacity , null , null , extraRegistrators );
212240 }
213241
242+ @ Deprecated (forRemoval = true )
214243 @ SafeVarargs
215244 public final void registerEnergyHatches (CableTier tier ,
216245 HatchModification <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -227,6 +256,7 @@ public final void registerEnergyHatches(CableTier tier,
227256 );
228257 }
229258
259+ @ Deprecated (forRemoval = true )
230260 @ SafeVarargs
231261 public final void registerEnergyHatches (CableTier tier ,
232262 HatchModification <BlockWithItemHolder <?, ?>> modifyBlock ,
@@ -236,6 +266,7 @@ public final void registerEnergyHatches(CableTier tier,
236266 this .registerEnergyHatches (tier , modifyBlock , overrideProperties , true , extraRegistrators );
237267 }
238268
269+ @ Deprecated (forRemoval = true )
239270 @ SafeVarargs
240271 public final void registerEnergyHatches (CableTier tier ,
241272 Consumer <BlockEntityType <?>>... extraRegistrators )
0 commit comments