Skip to content

Commit

Permalink
Update visibility of overrided block methods
Browse files Browse the repository at this point in the history
  • Loading branch information
kirderf1 committed Dec 8, 2024
1 parent dbe2796 commit e631892
Show file tree
Hide file tree
Showing 37 changed files with 100 additions and 165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public PushReaction getPistonPushReaction(BlockState state)
}

@Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context)
{
return SHAPE;
}
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/com/mraof/minestuck/block/CustomShapeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,14 @@ public BlockState updateShape(BlockState stateIn, Direction facing, BlockState f
return super.updateShape(stateIn, facing, facingState, level, currentPos, facingPos);
}

@SuppressWarnings("deprecation")
@Override
public BlockState rotate(BlockState state, Rotation direction)
protected BlockState rotate(BlockState state, Rotation direction)
{
return state.setValue(FACING, direction.rotate(state.getValue(FACING)));
}

@SuppressWarnings("deprecation")
@Override
public BlockState mirror(BlockState state, Mirror mirrorIn)
protected BlockState mirror(BlockState state, Mirror mirrorIn)
{
return state.setValue(FACING, mirrorIn.mirror(state.getValue(FACING)));
}
Expand All @@ -75,15 +73,13 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
}

@Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
{
return shape.get(state.getValue(FACING));
}

@Override
@SuppressWarnings("deprecation")
public FluidState getFluidState(BlockState state)
protected FluidState getFluidState(BlockState state)
{
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ public BlockState getStateForPlacement(BlockPlaceContext context)
return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite()).setValue(WATERLOGGED, iFluidState.getType() == Fluids.WATER);
}

@SuppressWarnings("deprecation")
@Override
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos)
protected BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos)
{
if(stateIn.getValue(WATERLOGGED))
{
Expand Down Expand Up @@ -75,16 +74,14 @@ public BlockState rotate(BlockState state, LevelAccessor level, BlockPos pos, Ro
return state.setValue(FACING, direction.rotate(state.getValue(FACING)));
}

@SuppressWarnings("deprecation")
@Override
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
{
return shape.get(state.getValue(FACING));
}

@SuppressWarnings("deprecation")
@Override
public FluidState getFluidState(BlockState state)
protected FluidState getFluidState(BlockState state)
{
return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
}
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/com/mraof/minestuck/block/FragileBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ public FragileBlock(Properties properties)
super(properties);
}

@SuppressWarnings("deprecation")
@Override
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context)
protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context)
{
return COLLISION_SHAPE;
}

@Override
@SuppressWarnings("deprecation")
public void entityInside(BlockState stateIn, Level level, BlockPos pos, Entity entityIn)
protected void entityInside(BlockState stateIn, Level level, BlockPos pos, Entity entityIn)
{
attemptBreak(level, entityIn, pos);
}
Expand Down Expand Up @@ -88,4 +86,4 @@ public boolean directionNeedsObfuscation(Level level, BlockPos pos)
public static boolean isSecure(BlockState state) {
return !state.isAir() && !state.is(BlockTags.FIRE) && !state.liquid() && !state.canBeReplaced();
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/com/mraof/minestuck/block/GateBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected final boolean isValid(BlockPos mainPos, Level level)
}

@Nullable
@Override
protected BlockPos findMainComponent(BlockPos pos, Level level)
{
for(int x = -1; x <= 1; x++)
Expand Down Expand Up @@ -107,8 +108,7 @@ protected BlockPos findMainComponent(BlockPos pos, Level level)
}

@Override
@SuppressWarnings("deprecation")
public void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn)
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn)
{
if(entityIn instanceof ServerPlayer player)
{
Expand Down Expand Up @@ -138,4 +138,4 @@ public static void placeGate(CommonLevelAccessor level, BlockPos centerPos, Gate
}
}
}
}
}
10 changes: 4 additions & 6 deletions src/main/java/com/mraof/minestuck/block/GlowystoneWireBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public GlowystoneWireBlock(Properties properties)
}

@Override
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
{
return SHAPES[getAABBIndex(state)];
}
Expand Down Expand Up @@ -274,8 +274,7 @@ public void animateTick(BlockState stateIn, Level level, BlockPos pos, RandomSou
}

@Override
@SuppressWarnings("deprecation")
public BlockState rotate(BlockState state, Rotation rot)
protected BlockState rotate(BlockState state, Rotation rot)
{
switch(rot)
{
Expand All @@ -291,8 +290,7 @@ public BlockState rotate(BlockState state, Rotation rot)
}

@Override
@SuppressWarnings("deprecation")
public BlockState mirror(BlockState state, Mirror mirrorIn)
protected BlockState mirror(BlockState state, Mirror mirrorIn)
{
switch(mirrorIn)
{
Expand All @@ -310,4 +308,4 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
{
builder.add(NORTH, EAST, SOUTH, WEST);
}
}
}
11 changes: 4 additions & 7 deletions src/main/java/com/mraof/minestuck/block/GoldSeedsBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,20 @@ public GoldSeedsBlock(Properties properties)
}

@Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
{
return SHAPE;
}

@Override
@SuppressWarnings("deprecation")
public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos)
protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos)
{
return level.getBlockState(pos.below()).getBlock() == Blocks.FARMLAND;
}

@Override
@SuppressWarnings("deprecation")
public BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos)
protected BlockState updateShape(BlockState stateIn, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos)
{
return !stateIn.canSurvive(level, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(stateIn, facing, facingState, level, currentPos, facingPos);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public LotusTimeCapsuleBlock(LotusTimeCapsuleMultiblock machine, CustomVoxelShap
}

@Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
{
return shape.get(state.getValue(FACING));
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/mraof/minestuck/block/ReturnNodeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public ReturnNodeBlock(Properties properties)
}

@Override
@SuppressWarnings("deprecation")
public void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn)
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn)
{
if(entityIn instanceof ServerPlayer player)
{
Expand Down Expand Up @@ -124,4 +123,4 @@ public static void placeReturnNode(LevelAccessor level, BlockPos nodePos, @Nulla
}
}
}
}
}
8 changes: 3 additions & 5 deletions src/main/java/com/mraof/minestuck/block/SkaiaPortalBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state)
}

@Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context)
{
return SHAPE;
}

@Override
@SuppressWarnings("deprecation")
public void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn)
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn)
{
if (!entityIn.isPassenger() && !entityIn.isVehicle() && !level.isClientSide && !entityIn.isOnPortalCooldown())
{
Expand All @@ -68,4 +66,4 @@ public ItemStack getCloneItemStack(BlockState state, HitResult target, LevelRead
{
return ItemStack.EMPTY;
}
}
}
8 changes: 3 additions & 5 deletions src/main/java/com/mraof/minestuck/block/SpecialTNTBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public SpecialTNTBlock(Properties builder, boolean primed, boolean unstable, boo
}

@Override
@SuppressWarnings("deprecation")
public void attack(BlockState state, Level level, BlockPos pos, Player player)
protected void attack(BlockState state, Level level, BlockPos pos, Player player)
{
if(primed)
{
Expand Down Expand Up @@ -73,13 +72,12 @@ public void wasExploded(Level level, BlockPos pos, Explosion explosionIn)
}

@Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random)
protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random)
{
if(unstable && random.nextDouble() < 0.1)
{
this.explode(level, pos, null);
level.removeBlock(pos, false);
}
}
}
}
3 changes: 1 addition & 2 deletions src/main/java/com/mraof/minestuck/block/SpikeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ public void fallOn(Level level, BlockState state, BlockPos pos, Entity entityIn,
/**
* Damages relevant entities as they move through the block
*/
@SuppressWarnings("deprecation")
@Override
public void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn)
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn)
{
if(entityIn instanceof LivingEntity && entityIn.fallDistance < 1)
{
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/mraof/minestuck/block/StoneTabletBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state)
}

@Override
@SuppressWarnings("deprecation")
public List<ItemStack> getDrops(BlockState state, LootParams.Builder builder)
protected List<ItemStack> getDrops(BlockState state, LootParams.Builder builder)
{
if(builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY) instanceof ItemStackBlockEntity itemBE)
{
Expand Down Expand Up @@ -81,6 +80,7 @@ protected InteractionResult useWithoutItem(BlockState state, Level level, BlockP
return InteractionResult.SUCCESS;
}

@Nullable
@Override
public BlockState getStateForPlacement(BlockPlaceContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos)
}

@Override
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext)
protected VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext)
{
Vec3 vec3 = pState.getOffset(pLevel, pPos);
return SHAPE.move(vec3.x, vec3.y, vec3.z);
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/com/mraof/minestuck/block/TrajectoryBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,15 @@ public void stepOn(Level level, BlockPos pos, BlockState state, Entity entityIn)
}
}

@SuppressWarnings("deprecation")
@Override
public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving)
protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving)
{
super.neighborChanged(state, level, pos, blockIn, fromPos, isMoving);
updatePower(level, pos);
}

@SuppressWarnings("deprecation")
@Override
public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving)
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving)
{
super.onPlace(state, level, pos, oldState, isMoving);
updatePower(level, pos);
Expand Down Expand Up @@ -129,4 +127,4 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
builder.add(POWER);
builder.add(POWERED);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,10 @@ public Pad(AlchemiterMultiblock machine, CustomVoxelShape emptyShape, CustomVoxe
}

@Override
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context)
{
if(state.getValue(DOWEL).equals(EnumDowelType.NONE))
{
return super.getShape(state, worldIn, pos, context);
}

return dowelShape.get(state.getValue(FACING));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state)
}

@Override
@SuppressWarnings("deprecation")
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving)
protected void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving)
{
if(!newState.is(state.getBlock()))
dropItems(level, pos.getX(), pos.getY(), pos.getZ(), state);
Expand Down Expand Up @@ -224,8 +223,7 @@ private void dropItems(Level level, int x, int y, int z, BlockState state)
}

@Override
@SuppressWarnings("deprecation")
public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context)
protected VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context)
{
if(state.getValue(STATE) == State.OFF)
return shapeOff.get(state.getValue(FACING));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,15 @@ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, Block
return !level.isClientSide ? BlockUtil.checkTypeForTicker(placedType, MSBlockEntityTypes.GRIST_COLLECTOR.get(), GristCollectorBlockEntity::serverTick) : null;
}

@SuppressWarnings("deprecation")
@Override
public void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving)
protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving)
{
super.neighborChanged(state, level, pos, blockIn, fromPos, isMoving);
updatePower(level, pos);
}

@SuppressWarnings("deprecation")
@Override
public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving)
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving)
{
super.onPlace(state, level, pos, oldState, isMoving);
updatePower(level, pos);
Expand Down
Loading

0 comments on commit e631892

Please sign in to comment.