@@ -114,8 +114,7 @@ protected boolean isPipeTool(@NotNull ItemStack stack) {
114114 @ Override
115115 public int getLightValue (@ NotNull IBlockState state , IBlockAccess world , @ NotNull BlockPos pos ) {
116116 TileEntity tile = world .getTileEntity (pos );
117- if (tile instanceof TileEntityCable ) {
118- TileEntityCable cable = (TileEntityCable ) tile ;
117+ if (tile instanceof TileEntityCable cable ) {
119118 int temp = cable .getTemperature ();
120119 // max light at 5000 K
121120 // min light at 500 K
@@ -132,7 +131,9 @@ public int getLightValue(@NotNull IBlockState state, IBlockAccess world, @NotNul
132131 @ Override
133132 public void breakBlock (@ NotNull World worldIn , @ NotNull BlockPos pos , @ NotNull IBlockState state ) {
134133 if (worldIn .isRemote ) {
135- TileEntityCable cable = (TileEntityCable ) getPipeTileEntity (worldIn , pos );
134+ IPipeTile <Insulation , WireProperties > pipeTile = getPipeTileEntity (worldIn , pos );
135+ if (pipeTile == null ) return ;
136+ TileEntityCable cable = (TileEntityCable ) pipeTile ;
136137 cable .killParticle ();
137138 }
138139 super .breakBlock (worldIn , pos , state );
@@ -165,11 +166,12 @@ public void onEntityCollision(World worldIn, @NotNull BlockPos pos, @NotNull IBl
165166 @ NotNull Entity entityIn ) {
166167 super .onEntityCollision (worldIn , pos , state , entityIn );
167168 if (worldIn .isRemote ) return ;
168- Insulation insulation = getPipeTileEntity (worldIn , pos ).getPipeType ();
169- if (insulation .insulationLevel == -1 && entityIn instanceof EntityLivingBase ) {
170- EntityLivingBase entityLiving = (EntityLivingBase ) entityIn ;
171- TileEntityCable cable = (TileEntityCable ) getPipeTileEntity (worldIn , pos );
172- if (cable != null && cable .getFrameMaterial () == null && cable .getNodeData ().getLossPerBlock () > 0 ) {
169+ IPipeTile <Insulation , WireProperties > pipeTile = getPipeTileEntity (worldIn , pos );
170+ if (pipeTile == null ) return ;
171+ Insulation insulation = pipeTile .getPipeType ();
172+ if (insulation .insulationLevel == -1 && entityIn instanceof EntityLivingBase entityLiving ) {
173+ TileEntityCable cable = (TileEntityCable ) pipeTile ;
174+ if (cable .getFrameMaterial () == null && cable .getNodeData ().getLossPerBlock () > 0 ) {
173175 long voltage = cable .getCurrentMaxVoltage ();
174176 double amperage = cable .getAverageAmperage ();
175177 if (voltage > 0L && amperage > 0L ) {
0 commit comments