@@ -232,7 +232,7 @@ public void onRemove(BlockState state, Level world, BlockPos pos, BlockState new
232232 } :
233233 (currentPos , rowPosition ) -> {
234234 if (world .getBlockEntity (currentPos ) instanceof NixieTubeBlockEntity ntbe )
235- NixieTubeBlock .updateDisplayedRedstoneValue (ntbe , true );
235+ NixieTubeBlock .updateDisplayedRedstoneValue (ntbe , state , true );
236236 });
237237 }
238238 Direction right = left .getOpposite ();
@@ -246,7 +246,7 @@ public void onRemove(BlockState state, Level world, BlockPos pos, BlockState new
246246 } :
247247 (currentPos , rowPosition ) -> {
248248 if (world .getBlockEntity (currentPos ) instanceof NixieTubeBlockEntity ntbe )
249- NixieTubeBlock .updateDisplayedRedstoneValue (ntbe , true );
249+ NixieTubeBlock .updateDisplayedRedstoneValue (ntbe , state , true );
250250 });
251251 }
252252 }
@@ -266,16 +266,11 @@ public ItemRequirement getRequiredItems(BlockState state, BlockEntity be) {
266266 @ Override
267267 public VoxelShape getShape (BlockState pState , BlockGetter pLevel , BlockPos pPos , CollisionContext pContext ) {
268268 Direction facing = pState .getValue (FACING );
269- switch (pState .getValue (FACE )) {
270- case CEILING :
271- return AllShapes .NIXIE_TUBE_CEILING .get (facing .getClockWise ()
272- .getAxis ());
273- case FLOOR :
274- return AllShapes .NIXIE_TUBE .get (facing .getClockWise ()
275- .getAxis ());
276- default :
277- return AllShapes .NIXIE_TUBE_WALL .get (facing );
278- }
269+ return switch (pState .getValue (FACE )) {
270+ case CEILING -> AllShapes .NIXIE_TUBE_CEILING .get (facing .getClockWise ().getAxis ());
271+ case FLOOR -> AllShapes .NIXIE_TUBE .get (facing .getClockWise ().getAxis ());
272+ default -> AllShapes .NIXIE_TUBE_WALL .get (facing );
273+ };
279274 }
280275
281276 @ Override
@@ -343,17 +338,17 @@ public void onPlace(BlockState state, Level worldIn, BlockPos pos, BlockState ol
343338 updateDisplayedRedstoneValue (state , worldIn , pos );
344339 }
345340
346- public static void updateDisplayedRedstoneValue (NixieTubeBlockEntity be , boolean force ) {
341+ public static void updateDisplayedRedstoneValue (NixieTubeBlockEntity be , BlockState state , boolean force ) {
347342 if (be .getLevel () == null || be .getLevel ().isClientSide )
348343 return ;
349344 if (be .reactsToRedstone () || force )
350- be .updateRedstoneStrength (getPower (be .getLevel (), be .getBlockPos ()));
345+ be .updateRedstoneStrength (getPower (be .getLevel (), state , be .getBlockPos ()));
351346 }
352347
353- private void updateDisplayedRedstoneValue (BlockState state , Level worldIn , BlockPos pos ) {
354- if (worldIn .isClientSide )
348+ private void updateDisplayedRedstoneValue (BlockState state , Level level , BlockPos pos ) {
349+ if (level .isClientSide )
355350 return ;
356- withBlockEntityDo (worldIn , pos , be -> NixieTubeBlock .updateDisplayedRedstoneValue (be , false ));
351+ withBlockEntityDo (level , pos , be -> NixieTubeBlock .updateDisplayedRedstoneValue (be , state , false ));
357352 }
358353
359354 static boolean isValidBlock (BlockGetter world , BlockPos pos , boolean above ) {
@@ -362,12 +357,14 @@ static boolean isValidBlock(BlockGetter world, BlockPos pos, boolean above) {
362357 .isEmpty ();
363358 }
364359
365- private static int getPower (Level worldIn , BlockPos pos ) {
360+ private static int getPower (Level level , BlockState state , BlockPos pos ) {
366361 int power = 0 ;
367362 for (Direction direction : Iterate .directions )
368- power = Math .max (worldIn .getSignal (pos .relative (direction ), direction ), power );
369- for (Direction direction : Iterate .directions )
370- power = Math .max (worldIn .getSignal (pos .relative (direction ), Direction .UP ), power );
363+ power = Math .max (level .getSignal (pos .relative (direction ), direction ), power );
364+ for (Direction direction : Iterate .directions ) {
365+ if (state .getValue (FACING ).getOpposite () != direction )
366+ power = Math .max (level .getSignal (pos .relative (direction ), Direction .UP ), power );
367+ }
371368 return power ;
372369 }
373370
0 commit comments