@@ -28,96 +28,93 @@ public class BlockGasPipe extends AbstractRefreshingConnectBlock<GenericTileGasP
2828 public final IGasPipe pipe ;
2929
3030 public BlockGasPipe (IGasPipe pipe ) {
31- super (pipe .getProperties ().sound (pipe .getSoundType ()).strength (0.15f ).dynamicShape ().noOcclusion (), pipe .getRadius ());
31+ super (pipe .getProperties ().sound (pipe .getSoundType ()).strength (0.15f ).dynamicShape ().noOcclusion (),
32+ pipe .getRadius ());
3233
33- this .pipe = pipe ;
34+ this .pipe = pipe ;
3435
35- PIPESET .add (this );
36+ PIPESET .add (this );
3637
3738 }
3839
3940 /*
40- @Override
41- public boolean isFlammable(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
42- return pipe.insulationMaterial.canCombust;
43- }
44-
45- @Override
46- public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
47- if (!pipe.insulationMaterial.canCombust) {
48- return 0;
49- }
50-
51- return state.hasProperty(ElectrodynamicsBlockStates.WATERLOGGED) && state.getValue(ElectrodynamicsBlockStates.WATERLOGGED) ? 0 : 150;
52- }
53-
54- @Override
55- public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
56- if (!pipe.insulationMaterial.canCombust) {
57- return 0;
58- }
59-
60- return state.hasProperty(ElectrodynamicsBlockStates.WATERLOGGED) && state.getValue(ElectrodynamicsBlockStates.WATERLOGGED) ? 0 : 400;
61- }
62-
63- @Override
64- public void onCaughtFire(BlockState state, Level world, BlockPos pos, Direction face, LivingEntity igniter) {
65- super.onCaughtFire(state, world, pos, face, igniter);
66- Scheduler.schedule(5, () -> world.setBlockAndUpdate(pos, ElectrodynamicsBlocks.BLOCKS_GASPIPE.getValue(SubtypeGasPipe.getPipeForType(pipe.pipeMaterial, InsulationMaterial.NONE)).defaultBlockState()));
67- }
68-
41+ * @Override public boolean isFlammable(BlockState state, BlockGetter world,
42+ * BlockPos pos, Direction face) { return pipe.insulationMaterial.canCombust; }
43+ *
44+ * @Override public int getFlammability(BlockState state, BlockGetter world,
45+ * BlockPos pos, Direction face) { if (!pipe.insulationMaterial.canCombust) {
46+ * return 0; }
47+ *
48+ * return state.hasProperty(ElectrodynamicsBlockStates.WATERLOGGED) &&
49+ * state.getValue(ElectrodynamicsBlockStates.WATERLOGGED) ? 0 : 150; }
50+ *
51+ * @Override public int getFireSpreadSpeed(BlockState state, BlockGetter world,
52+ * BlockPos pos, Direction face) { if (!pipe.insulationMaterial.canCombust) {
53+ * return 0; }
54+ *
55+ * return state.hasProperty(ElectrodynamicsBlockStates.WATERLOGGED) &&
56+ * state.getValue(ElectrodynamicsBlockStates.WATERLOGGED) ? 0 : 400; }
57+ *
58+ * @Override public void onCaughtFire(BlockState state, Level world, BlockPos
59+ * pos, Direction face, LivingEntity igniter) { super.onCaughtFire(state, world,
60+ * pos, face, igniter); Scheduler.schedule(5, () -> world.setBlockAndUpdate(pos,
61+ * ElectrodynamicsBlocks.BLOCKS_GASPIPE.getValue(SubtypeGasPipe.getPipeForType(
62+ * pipe.pipeMaterial, InsulationMaterial.NONE)).defaultBlockState())); }
63+ *
6964 */
7065
7166 @ Override
7267 public void entityInside (BlockState state , Level worldIn , BlockPos pos , Entity entityIn ) {
73- TileGasPipe tile = ( TileGasPipe ) worldIn .getBlockEntity (pos );
74- if (worldIn .isClientSide () || tile == null || tile .getNetwork () == null && tile .getNetwork ().transmittedThisTick <= 0 ) {
75- return ;
76- }
77- GasNetwork network = tile .getNetwork ();
68+ if ( worldIn .getBlockEntity (pos ) instanceof TileGasPipe pipe ) {
69+ if (worldIn .isClientSide () || pipe .getNetwork () == null && pipe .getNetwork ().transmittedThisTick <= 0 ) {
70+ return ;
71+ }
72+ GasNetwork network = pipe .getNetwork ();
7873
79- double multipler = 1.0 ;//pipe.insulationMaterial == InsulationMaterial.NONE ? 1.0 : 1.2;
74+ double multipler = 1.0 ;// pipe.insulationMaterial == InsulationMaterial.NONE ? 1.0 : 1.2;
8075
81- if (network .temperatureOfTransmitted >= Gas .MINIMUM_HEAT_BURN_TEMP * multipler ) {
76+ if (network .temperatureOfTransmitted >= Gas .MINIMUM_HEAT_BURN_TEMP * multipler ) {
8277
83- entityIn .hurt (entityIn .damageSources ().inFire (), 1.0F );
78+ entityIn .hurt (entityIn .damageSources ().inFire (), 1.0F );
8479
85- } else if (network .temperatureOfTransmitted > 0 && network .temperatureOfTransmitted <= Gas .MINIMUM_FREEZE_TEMP / multipler ) {
80+ } else if (network .temperatureOfTransmitted > 0
81+ && network .temperatureOfTransmitted <= Gas .MINIMUM_FREEZE_TEMP / multipler ) {
8682
87- entityIn .hurt (entityIn .damageSources ().freeze (), 1.0F );
83+ entityIn .hurt (entityIn .damageSources ().freeze (), 1.0F );
8884
89- }
85+ }
9086
87+ }
9188 }
9289
9390 @ Override
94- public EnumConnectType getConnection (BlockState otherState , BlockEntity otherTile , GenericTileGasPipe thisConductor , Direction dir ) {
95- EnumConnectType connection = EnumConnectType .NONE ;
96- if (otherTile instanceof GenericTileGasPipe ) {
97- connection = EnumConnectType .WIRE ;
98- } else if (GasUtilities .isGasReciever (otherTile , dir .getOpposite ())) {
99- connection = EnumConnectType .INVENTORY ;
100- }
101- return connection ;
91+ public EnumConnectType getConnection (BlockState otherState , BlockEntity otherTile , GenericTileGasPipe thisConductor ,
92+ Direction dir ) {
93+ EnumConnectType connection = EnumConnectType .NONE ;
94+ if (otherTile instanceof GenericTileGasPipe ) {
95+ connection = EnumConnectType .WIRE ;
96+ } else if (GasUtilities .isGasReciever (otherTile , dir .getOpposite ())) {
97+ connection = EnumConnectType .INVENTORY ;
98+ }
99+ return connection ;
102100 }
103101
104102 @ Override
105103 public GenericTileGasPipe getCableIfValid (BlockEntity tile ) {
106- if (tile instanceof GenericTileGasPipe pipe ) {
107- return pipe ;
108- }
109- return null ;
104+ if (tile instanceof GenericTileGasPipe pipe ) {
105+ return pipe ;
106+ }
107+ return null ;
110108 }
111109
112-
113110 @ Override
114111 public BlockEntity newBlockEntity (BlockPos pos , BlockState state ) {
115- return new TileGasPipe (pos , state );
112+ return new TileGasPipe (pos , state );
116113 }
117114
118115 @ Override
119116 protected MapCodec <? extends BaseEntityBlock > codec () {
120- throw new UnsupportedOperationException ("Need to implement CODEC" );
117+ throw new UnsupportedOperationException ("Need to implement CODEC" );
121118 }
122119
123120}
0 commit comments