@@ -190,26 +190,29 @@ static void tick(Level level, BlockPos pos, BlockState state, NetherReactorBlock
190190 blockEntity .progress = blockEntity .progress .next ();
191191
192192 boolean hasSpawned = false ;
193- for (int i = 0 ; i < 4 ; i ++) {
194- boolean willSpawn = level .random .nextBoolean ();
195- if (!hasSpawned && i == 3 ) {
196- willSpawn = true ; // spawn no matter what
197- }
198-
199- if (willSpawn && blockEntity .progress .ordinal () >= Progress .MID1 .ordinal () && blockEntity .progress .ordinal () < Progress .FINISH1 .ordinal ()) {
200- hasSpawned = true ;
201- ZombifiedPiglin zombifiedPiglin = EntityType .ZOMBIFIED_PIGLIN .create (level );
202- Vec3 mobPos = randomPos (pos , level .random );
203- assert zombifiedPiglin != null ;
204- zombifiedPiglin .setPos (mobPos );
205- if (level .random .nextFloat () <= Constants .LEFT_HANDEDNESS_OCCURRENCE ) {
206- zombifiedPiglin .setLeftHanded (true );
193+ if (blockEntity .progress .ordinal () >= Progress .MID1 .ordinal () && blockEntity .progress .ordinal () < Progress .FINISH1 .ordinal ()) {
194+ for (int i = 0 ; i < 4 ; i ++) {
195+ boolean willSpawn = level .random .nextBoolean ();
196+ if (!hasSpawned && i == 3 ) {
197+ willSpawn = true ; // spawn no matter what
198+ }
199+
200+ if (willSpawn ) {
201+ hasSpawned = true ;
202+ ZombifiedPiglin zombifiedPiglin = EntityType .ZOMBIFIED_PIGLIN .create (level );
203+ Vec3 mobPos = randomPos (pos , level .random );
204+ assert zombifiedPiglin != null ;
205+ zombifiedPiglin .setPos (mobPos );
206+ if (level .random .nextFloat () <= Constants .LEFT_HANDEDNESS_OCCURRENCE ) {
207+ zombifiedPiglin .setLeftHanded (true );
208+ }
209+ zombifiedPiglin .setItemInHand (InteractionHand .MAIN_HAND , new ItemStack (Items .GOLDEN_SWORD ));
210+ level .addFreshEntity (zombifiedPiglin );
207211 }
208- zombifiedPiglin .setItemInHand (InteractionHand .MAIN_HAND , new ItemStack (Items .GOLDEN_SWORD ));
209- level .addFreshEntity (zombifiedPiglin );
210212 }
213+
214+ Assertions .check (hasSpawned , "Failed to spawn at least one Zombified Piglin." );
211215 }
212- Assertions .check (hasSpawned , "Failed to spawn at least one Zombified Piglin." );
213216
214217 BlockPos upPos = pos .above ();
215218 BlockPos downPos = pos .below ();
0 commit comments