Skip to content

Commit ec511fb

Browse files
committed
Remove deprecated and make things protected which is what mojang finally has moved to in order to represent that block methods should be called via blockstates
1 parent e03d8d3 commit ec511fb

28 files changed

+127
-200
lines changed

src/additions/java/mekanism/additions/common/block/BlockGlowPanel.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public EnumColor getColor() {
4343

4444
@NotNull
4545
@Override
46-
@Deprecated
47-
public BlockState updateShape(BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
46+
protected BlockState updateShape(BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
4847
@NotNull BlockPos currentPos, @NotNull BlockPos facingPos) {
4948
if (facing.getOpposite() == Attribute.getFacing(state) && !state.canSurvive(world, currentPos)) {
5049
return Blocks.AIR.defaultBlockState();
@@ -53,8 +52,7 @@ public BlockState updateShape(BlockState state, @NotNull Direction facing, @NotN
5352
}
5453

5554
@Override
56-
@Deprecated
57-
public boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader world, @NotNull BlockPos pos) {
55+
protected boolean canSurvive(@NotNull BlockState state, @NotNull LevelReader world, @NotNull BlockPos pos) {
5856
Direction side = Attribute.getFacing(state);
5957
Direction sideOn = side.getOpposite();
6058
BlockPos offsetPos = pos.relative(sideOn);

src/additions/java/mekanism/additions/common/block/BlockObsidianTNT.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public BlockState getStateForPlacement(@NotNull BlockPlaceContext context) {
7373
}
7474

7575
@Override
76-
public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) {
76+
public int getFlammability(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos, @NotNull Direction face) {
7777
//300 is 100% chance fire will spread to this block, 100 is default for TNT
7878
// Given we are "obsidian" make ours slightly more stable against fire being spread than vanilla TNT
7979
return 75;
@@ -98,29 +98,25 @@ public void wasExploded(Level world, @NotNull BlockPos pos, @NotNull Explosion e
9898
}
9999

100100
@Override
101-
@Deprecated
102-
public boolean isPathfindable(@NotNull BlockState state, @NotNull PathComputationType type) {
101+
protected boolean isPathfindable(@NotNull BlockState state, @NotNull PathComputationType type) {
103102
return false;
104103
}
105104

106105
@NotNull
107106
@Override
108-
@Deprecated
109-
public VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos, @NotNull CollisionContext context) {
107+
protected VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos, @NotNull CollisionContext context) {
110108
return bounds;
111109
}
112110

113111
@NotNull
114112
@Override
115-
@Deprecated
116-
public FluidState getFluidState(@NotNull BlockState state) {
113+
protected FluidState getFluidState(@NotNull BlockState state) {
117114
return getFluid(state);
118115
}
119116

120117
@NotNull
121118
@Override
122-
@Deprecated
123-
public BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
119+
protected BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
124120
@NotNull BlockPos currentPos, @NotNull BlockPos facingPos) {
125121
updateFluids(state, world, currentPos);
126122
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);

src/additions/java/mekanism/additions/common/block/plastic/BlockPlasticFence.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ public BlockState getStateForPlacement(@NotNull BlockPlaceContext context) {
5151

5252
@NotNull
5353
@Override
54-
@Deprecated
55-
public FluidState getFluidState(@NotNull BlockState state) {
54+
protected FluidState getFluidState(@NotNull BlockState state) {
5655
return getFluid(state);
5756
}
5857

@@ -68,8 +67,7 @@ public boolean canPlaceLiquid(Player player, @NotNull BlockGetter world, @NotNul
6867

6968
@NotNull
7069
@Override
71-
@Deprecated
72-
public BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
70+
protected BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
7371
@NotNull BlockPos currentPos, @NotNull BlockPos facingPos) {
7472
updateFluids(state, world, currentPos);
7573
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
@@ -91,7 +89,7 @@ public Optional<SoundEvent> getPickupSound() {
9189

9290
@NotNull
9391
@Override
94-
public Optional<SoundEvent> getPickupSound(BlockState state) {
92+
public Optional<SoundEvent> getPickupSound(@NotNull BlockState state) {
9593
//Manually declare which getPickupSound we want to be using
9694
return IStateExtendedFluidLoggable.super.getPickupSound(state);
9795
}

src/additions/java/mekanism/additions/common/block/plastic/BlockPlasticFenceGate.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ public BlockState getStateForPlacement(@NotNull BlockPlaceContext context) {
4141

4242
@NotNull
4343
@Override
44-
@Deprecated
45-
public FluidState getFluidState(@NotNull BlockState state) {
44+
protected FluidState getFluidState(@NotNull BlockState state) {
4645
return getFluid(state);
4746
}
4847

4948
@NotNull
5049
@Override
51-
@Deprecated
52-
public BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
50+
protected BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
5351
@NotNull BlockPos currentPos, @NotNull BlockPos facingPos) {
5452
updateFluids(state, world, currentPos);
5553
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);

src/additions/java/mekanism/additions/common/block/plastic/BlockPlasticSlab.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public BlockState getStateForPlacement(@NotNull BlockPlaceContext context) {
5454

5555
@NotNull
5656
@Override
57-
@Deprecated
58-
public FluidState getFluidState(@NotNull BlockState state) {
57+
protected FluidState getFluidState(@NotNull BlockState state) {
5958
return getFluid(state);
6059
}
6160

@@ -71,8 +70,7 @@ public boolean canPlaceLiquid(Player player, @NotNull BlockGetter world, @NotNul
7170

7271
@NotNull
7372
@Override
74-
@Deprecated
75-
public BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
73+
protected BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
7674
@NotNull BlockPos currentPos, @NotNull BlockPos facingPos) {
7775
updateFluids(state, world, currentPos);
7876
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
@@ -94,7 +92,7 @@ public Optional<SoundEvent> getPickupSound() {
9492

9593
@NotNull
9694
@Override
97-
public Optional<SoundEvent> getPickupSound(BlockState state) {
95+
public Optional<SoundEvent> getPickupSound(@NotNull BlockState state) {
9896
//Manually declare which getPickupSound we want to be using
9997
return IStateExtendedFluidLoggable.super.getPickupSound(state);
10098
}

src/additions/java/mekanism/additions/common/block/plastic/BlockPlasticStairs.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public BlockState getStateForPlacement(@NotNull BlockPlaceContext context) {
5454

5555
@NotNull
5656
@Override
57-
@Deprecated
58-
public FluidState getFluidState(@NotNull BlockState state) {
57+
protected FluidState getFluidState(@NotNull BlockState state) {
5958
return getFluid(state);
6059
}
6160

@@ -71,8 +70,7 @@ public boolean canPlaceLiquid(Player player, @NotNull BlockGetter world, @NotNul
7170

7271
@NotNull
7372
@Override
74-
@Deprecated
75-
public BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
73+
protected BlockState updateShape(@NotNull BlockState state, @NotNull Direction facing, @NotNull BlockState facingState, @NotNull LevelAccessor world,
7674
@NotNull BlockPos currentPos, @NotNull BlockPos facingPos) {
7775
updateFluids(state, world, currentPos);
7876
return super.updateShape(state, facing, facingState, world, currentPos, facingPos);
@@ -94,7 +92,7 @@ public Optional<SoundEvent> getPickupSound() {
9492

9593
@NotNull
9694
@Override
97-
public Optional<SoundEvent> getPickupSound(BlockState state) {
95+
public Optional<SoundEvent> getPickupSound(@NotNull BlockState state) {
9896
//Manually declare which getPickupSound we want to be using
9997
return IStateExtendedFluidLoggable.super.getPickupSound(state);
10098
}

src/additions/java/mekanism/additions/common/block/plastic/BlockPlasticTransparent.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ public BlockPlasticTransparent(EnumColor color) {
2323
}
2424

2525
@Override
26-
@Deprecated
27-
public float getShadeBrightness(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos) {
26+
protected float getShadeBrightness(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos) {
2827
return 0.8F;
2928
}
3029

3130
@Override
32-
@Deprecated
33-
public boolean useShapeForLightOcclusion(@NotNull BlockState state) {
31+
protected boolean useShapeForLightOcclusion(@NotNull BlockState state) {
3432
return true;
3533
}
3634

@@ -40,13 +38,12 @@ public boolean propagatesSkylightDown(@NotNull BlockState state, @NotNull BlockG
4038
}
4139

4240
@Override
43-
@Deprecated
44-
public boolean skipRendering(@NotNull BlockState state, @NotNull BlockState adjacentBlockState, @NotNull Direction side) {
41+
protected boolean skipRendering(@NotNull BlockState state, @NotNull BlockState adjacentBlockState, @NotNull Direction side) {
4542
return isSideInvisible(this, state, adjacentBlockState, side);
4643
}
4744

4845
@Override
49-
public float[] getBeaconColorMultiplier(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) {
46+
public float[] getBeaconColorMultiplier(@NotNull BlockState state, @NotNull LevelReader world, @NotNull BlockPos pos, @NotNull BlockPos beaconPos) {
5047
return getColor().getRgbCodeFloat();
5148
}
5249

src/additions/java/mekanism/additions/common/block/plastic/BlockPlasticTransparentSlab.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ public BlockPlasticTransparentSlab(EnumColor color) {
1818
}
1919

2020
@Override
21-
@Deprecated
22-
public float getShadeBrightness(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos) {
21+
protected float getShadeBrightness(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos) {
2322
return 0.8F;
2423
}
2524

2625
@Override
27-
@Deprecated
28-
public boolean useShapeForLightOcclusion(@NotNull BlockState state) {
26+
protected boolean useShapeForLightOcclusion(@NotNull BlockState state) {
2927
return true;
3028
}
3129

@@ -35,13 +33,12 @@ public boolean propagatesSkylightDown(@NotNull BlockState state, @NotNull BlockG
3533
}
3634

3735
@Override
38-
@Deprecated
39-
public boolean skipRendering(@NotNull BlockState state, @NotNull BlockState adjacentBlockState, @NotNull Direction side) {
36+
protected boolean skipRendering(@NotNull BlockState state, @NotNull BlockState adjacentBlockState, @NotNull Direction side) {
4037
return BlockPlasticTransparent.isSideInvisible(this, state, adjacentBlockState, side);
4138
}
4239

4340
@Override
44-
public float[] getBeaconColorMultiplier(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) {
41+
public float[] getBeaconColorMultiplier(@NotNull BlockState state, @NotNull LevelReader world, @NotNull BlockPos pos, @NotNull BlockPos beaconPos) {
4542
return getColor().getRgbCodeFloat();
4643
}
4744
}

src/additions/java/mekanism/additions/common/block/plastic/BlockPlasticTransparentStairs.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ public BlockPlasticTransparentStairs(IBlockProvider blockProvider, EnumColor col
1919
}
2020

2121
@Override
22-
@Deprecated
23-
public float getShadeBrightness(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos) {
22+
protected float getShadeBrightness(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos) {
2423
return 0.8F;
2524
}
2625

2726
@Override
28-
@Deprecated
29-
public boolean useShapeForLightOcclusion(@NotNull BlockState state) {
27+
protected boolean useShapeForLightOcclusion(@NotNull BlockState state) {
3028
return true;
3129
}
3230

@@ -36,13 +34,12 @@ public boolean propagatesSkylightDown(@NotNull BlockState state, @NotNull BlockG
3634
}
3735

3836
@Override
39-
@Deprecated
40-
public boolean skipRendering(@NotNull BlockState state, @NotNull BlockState adjacentBlockState, @NotNull Direction side) {
37+
protected boolean skipRendering(@NotNull BlockState state, @NotNull BlockState adjacentBlockState, @NotNull Direction side) {
4138
return BlockPlasticTransparent.isSideInvisible(this, state, adjacentBlockState, side);
4239
}
4340

4441
@Override
45-
public float[] getBeaconColorMultiplier(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) {
42+
public float[] getBeaconColorMultiplier(@NotNull BlockState state, @NotNull LevelReader world, @NotNull BlockPos pos, @NotNull BlockPos beaconPos) {
4643
return getColor().getRgbCodeFloat();
4744
}
4845
}

src/api/java/mekanism/api/text/TextComponentUtil.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,10 @@ else if (component instanceof EnumColor color && cachedStyle.getColor() == null)
248248
//If we didn't format it, and it is a string make sure we clean it up
249249
component = cleanString(str);
250250
} else if (!TranslatableContents.isAllowedPrimitiveArgument(component)) {
251-
//Ensure that any types that aren't allowed for sync purposes get converted to their string representation while creating the component
252-
current = getString(component.toString());
251+
//If it isn't a supported primitive type, turn it into a string, as that is a supported type
252+
//Note: We don't have to turn it into a component as strings are valid for parameters,
253+
// though we will turn it into one lower down if we have a style to apply
254+
component = cleanString(component.toString());
253255
}
254256
if (!cachedStyle.isEmpty()) {
255257
//If we don't have a text component, then we have to just ignore the formatting and
@@ -277,7 +279,9 @@ else if (component instanceof EnumColor color && cachedStyle.getColor() == null)
277279
//Odds are this will never be true, but we check it to see if we can avoid having to convert it to a string
278280
args.add(lastComponent);
279281
} else {
280-
args.add(getString(lastComponent.toString()));
282+
//If it isn't a supported primitive type, turn it into a string, as that is a supported type
283+
//Note: We don't have to turn it into a component as strings are valid for parameters
284+
args.add(cleanString(lastComponent.toString()));
281285
}
282286
//TODO: If we have multiple trailing formatting types such as a color and italics, we may want to eventually
283287
// handle how we add them to the arguments better?

0 commit comments

Comments
 (0)