From 2a695c6029e216d77558b91406bbb1f3ccadd08d Mon Sep 17 00:00:00 2001 From: Andrew-71 Date: Mon, 25 Sep 2023 10:51:32 +0300 Subject: [PATCH] Do chores related to code quality --- recipeTODO.txt | 36 ++++++------- .../a71/new_soviet/TVBlockEntityRenderer.java | 4 +- src/main/java/su/a71/new_soviet/Config.java | 11 ++-- .../new_soviet/blocks/CeilingFanBlock.java | 15 +++--- .../a71/new_soviet/blocks/CheckerBlock.java | 37 ++++++-------- .../su/a71/new_soviet/blocks/ChessBlock.java | 4 +- .../new_soviet/blocks/ChessBlockKnight.java | 2 - .../a71/new_soviet/blocks/HandrailBlock.java | 2 +- .../a71/new_soviet/blocks/LandMineBlock.java | 2 +- .../su/a71/new_soviet/blocks/SirenBlock.java | 34 ++++++------- .../su/a71/new_soviet/blocks/StoveBlock.java | 18 +++---- .../su/a71/new_soviet/blocks/SwitchBlock.java | 50 ++++++------------- .../blocks/lamps/GoldenTableLampBlock.java | 7 ++- .../new_soviet/blocks/lamps/LampBlock.java | 13 +++-- .../blocks/lamps/LightBulbLampBlock.java | 14 +++--- .../blocks/lamps/TableLampBlock.java | 2 +- .../lamps/lamp_post/LampPostBaseBlock.java | 2 +- .../lamps/lamp_post/LampPostLampBlock.java | 10 ++-- .../new_soviet/datagen/BlockLootTables.java | 4 +- .../new_soviet/datagen/ModelGenerator.java | 2 +- .../a71/new_soviet/items/CigaretteItem.java | 2 - .../su/a71/new_soviet/items/DiceItem.java | 6 +-- .../registration/NSE_BaseRegistration.java | 7 +-- .../registration/NSE_ToolMaterials.java | 4 +- .../java/su/a71/new_soviet/util/Shapes.java | 12 ++--- 25 files changed, 126 insertions(+), 174 deletions(-) diff --git a/recipeTODO.txt b/recipeTODO.txt index 8a7ab18..10b39d5 100644 --- a/recipeTODO.txt +++ b/recipeTODO.txt @@ -1,18 +1,18 @@ -aquamarine recipe -whitewash recipe -concrete recipe -concrete with bars recipe -parquet recipe -linoleum recipe -metal plating recipe -crate recipe -po-2 recipe -no wallpaper recipes (intended?) -no handrail recipe -no nutrient block recipe (intended? compressed bread?) -light bulb recipe -sigarette recipe -siren recipe -no landmine recipe - intended -switch recipe -checkers and chess recipe +* aquamarine recipe +* whitewash recipe +* concrete recipe +* concrete with bars recipe +* parquet recipe +* linoleum recipe +* metal plating recipe +* crate recipe +* po-2 recipe +* no wallpaper recipes (intended?) +* no handrail recipe +* no nutrient block recipe (intended? compressed bread?) +* light bulb recipe +* cigarette recipe +* siren recipe +* no landmine recipe - intended +* switch recipe +* checkers and chess recipe diff --git a/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java b/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java index 7fde30f..0c58eeb 100644 --- a/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java +++ b/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java @@ -15,12 +15,12 @@ import su.a71.new_soviet.entities.TVBlockEntity; @Environment(EnvType.CLIENT) public class TVBlockEntityRenderer implements BlockEntityRenderer { - private static TextRenderer textRenderer; +// private static TextRenderer textRenderer; private static final Vec3d TEXT_OFFSET = new Vec3d(0.0, 0.3333333432674408, 0.046666666865348816); public TVBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) { - textRenderer = ctx.getTextRenderer(); +// textRenderer = ctx.getTextRenderer(); } @Override diff --git a/src/main/java/su/a71/new_soviet/Config.java b/src/main/java/su/a71/new_soviet/Config.java index 0d70fea..a8ed583 100644 --- a/src/main/java/su/a71/new_soviet/Config.java +++ b/src/main/java/su/a71/new_soviet/Config.java @@ -17,18 +17,21 @@ public class Config { private static void generateDefault() { + INSTANCE = new Config(); + NewSoviet.LOG.info("Generated config file at config/new_soviet.json"); File file = new File("config/new_soviet.json"); - if(!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); + if(!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { + NewSoviet.LOG.error("Error making dir for config, using default"); + INSTANCE = new Config(); // Something went wrong with mkdir + return; } - INSTANCE = new Config(); try { FileWriter writer = new FileWriter(file); writer.write(NewSoviet.GSON.toJson(INSTANCE)); writer.close(); } catch (Exception e) { - INSTANCE = new Config(); + NewSoviet.LOG.error("Error creating config, using default", e); } } diff --git a/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java b/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java index fcb4aab..ed69602 100644 --- a/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java @@ -8,7 +8,6 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.random.Random; @@ -28,25 +27,25 @@ public class CeilingFanBlock extends Block implements Waterloggable { public CeilingFanBlock(Block.Settings settings) { super(settings); - this.setDefaultState((BlockState)this.getDefaultState().with(ON, false).with(WATERLOGGED, false)); + this.setDefaultState(this.getDefaultState().with(ON, false).with(WATERLOGGED, false)); } @Nullable public BlockState getPlacementState(ItemPlacementContext ctx) { - return (BlockState)this.getDefaultState() + return this.getDefaultState() .with(ON, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())) .with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); } public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { if (!world.isClient) { - boolean bl = (Boolean)state.get(ON); + boolean bl = state.get(ON); if (bl != world.isReceivingRedstonePower(pos)) { if (bl) { world.scheduleBlockTick(pos, this, 4); } else { - world.setBlockState(pos, (BlockState)state.cycle(ON), 2); + world.setBlockState(pos, state.cycle(ON), 2); } } } @@ -61,13 +60,13 @@ public class CeilingFanBlock extends Block implements Waterloggable { } public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if ((Boolean)state.get(ON) && !world.isReceivingRedstonePower(pos)) { - world.setBlockState(pos, (BlockState)state.cycle(ON), 2); + if (state.get(ON) && !world.isReceivingRedstonePower(pos)) { + world.setBlockState(pos, state.cycle(ON), 2); } } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{ON, WATERLOGGED}); + builder.add(ON, WATERLOGGED); } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { diff --git a/src/main/java/su/a71/new_soviet/blocks/CheckerBlock.java b/src/main/java/su/a71/new_soviet/blocks/CheckerBlock.java index 2283c40..9eee71e 100644 --- a/src/main/java/su/a71/new_soviet/blocks/CheckerBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/CheckerBlock.java @@ -2,7 +2,6 @@ package su.a71.new_soviet.blocks; import net.minecraft.block.*; import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; @@ -10,18 +9,15 @@ import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.IntProperty; import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; -import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; public class CheckerBlock extends Block implements Waterloggable { - public static final int MAX_PICKLES = 4; public static final IntProperty CHECKERS; public static final BooleanProperty WATERLOGGED; protected static final VoxelShape ONE_CHECKER; @@ -31,18 +27,18 @@ public class CheckerBlock extends Block implements Waterloggable { public CheckerBlock(AbstractBlock.Settings settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(CHECKERS, 1)).with(WATERLOGGED, true)); + this.setDefaultState(this.stateManager.getDefaultState().with(CHECKERS, 1).with(WATERLOGGED, true)); } @Nullable public BlockState getPlacementState(ItemPlacementContext ctx) { BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos()); if (blockState.isOf(this)) { - return (BlockState)blockState.with(CHECKERS, Math.min(4, (Integer)blockState.get(CHECKERS) + 1)); + return blockState.with(CHECKERS, Math.min(4, blockState.get(CHECKERS) + 1)); } else { FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); boolean bl = fluidState.getFluid() == Fluids.WATER; - return (BlockState)super.getPlacementState(ctx).with(WATERLOGGED, bl); + return super.getPlacementState(ctx).with(WATERLOGGED, bl); } } @@ -59,7 +55,7 @@ public class CheckerBlock extends Block implements Waterloggable { if (!state.canPlaceAt(world, pos)) { return Blocks.AIR.getDefaultState(); } else { - if ((Boolean)state.get(WATERLOGGED)) { + if (state.get(WATERLOGGED)) { world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } @@ -68,29 +64,24 @@ public class CheckerBlock extends Block implements Waterloggable { } public boolean canReplace(BlockState state, ItemPlacementContext context) { - return !context.shouldCancelInteraction() && context.getStack().isOf(this.asItem()) && (Integer) state.get(CHECKERS) < 4 || super.canReplace(state, context); + return !context.shouldCancelInteraction() && context.getStack().isOf(this.asItem()) && state.get(CHECKERS) < 4 || super.canReplace(state, context); } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch ((Integer)state.get(CHECKERS)) { - case 1: - default: - return ONE_CHECKER; - case 2: - return TWO_CHECKER; - case 3: - return THREE_CHECKER; - case 4: - return FOUR_CHECKER; - } + return switch (state.get(CHECKERS)) { + default -> ONE_CHECKER; + case 2 -> TWO_CHECKER; + case 3 -> THREE_CHECKER; + case 4 -> FOUR_CHECKER; + }; } public FluidState getFluidState(BlockState state) { - return (Boolean)state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{CHECKERS, WATERLOGGED}); + builder.add(CHECKERS, WATERLOGGED); } public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { @@ -98,7 +89,7 @@ public class CheckerBlock extends Block implements Waterloggable { } static { - CHECKERS = IntProperty.of("checkers", 1, 4);; + CHECKERS = IntProperty.of("checkers", 1, 4); WATERLOGGED = Properties.WATERLOGGED; ONE_CHECKER = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 4.0, 14.0); TWO_CHECKER = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 8.0, 14.0); diff --git a/src/main/java/su/a71/new_soviet/blocks/ChessBlock.java b/src/main/java/su/a71/new_soviet/blocks/ChessBlock.java index ade8934..fcca0d8 100644 --- a/src/main/java/su/a71/new_soviet/blocks/ChessBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/ChessBlock.java @@ -1,10 +1,8 @@ package su.a71.new_soviet.blocks; -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; import net.minecraft.block.piston.PistonBehavior; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.sound.BlockSoundGroup; import net.minecraft.state.StateManager; import net.minecraft.state.property.Properties; import net.minecraft.util.math.BlockPos; @@ -16,7 +14,7 @@ import net.minecraft.world.WorldView; public class ChessBlock extends HorizontalFacingBlock { - private VoxelShape blockShape; + private final VoxelShape blockShape; public ChessBlock(AbstractBlock.Settings settings, VoxelShape blockShape) { super(settings.notSolid().nonOpaque().noBlockBreakParticles().pistonBehavior(PistonBehavior.DESTROY).strength(0.1f, 2f)); diff --git a/src/main/java/su/a71/new_soviet/blocks/ChessBlockKnight.java b/src/main/java/su/a71/new_soviet/blocks/ChessBlockKnight.java index d7f4065..f0053b8 100644 --- a/src/main/java/su/a71/new_soviet/blocks/ChessBlockKnight.java +++ b/src/main/java/su/a71/new_soviet/blocks/ChessBlockKnight.java @@ -1,6 +1,5 @@ package su.a71.new_soviet.blocks; -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalFacingBlock; @@ -15,7 +14,6 @@ import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.WorldView; -import su.a71.new_soviet.util.Shapes; public class ChessBlockKnight extends HorizontalFacingBlock { diff --git a/src/main/java/su/a71/new_soviet/blocks/HandrailBlock.java b/src/main/java/su/a71/new_soviet/blocks/HandrailBlock.java index 190fbe3..2d7988f 100644 --- a/src/main/java/su/a71/new_soviet/blocks/HandrailBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/HandrailBlock.java @@ -131,7 +131,7 @@ public class HandrailBlock extends HorizontalFacingBlock implements BlockEntityP SHAPE2 = new Shapes.HorizontalShape(List.of(List.of(0.0, 0.0, 15.0, 16.0, 17.0, 16.0), List.of(0.0, 17.0, 14.5, 16.0, 19.0, 16.5))); SHAPE1 = new Shapes.HorizontalShape(List.of(List.of(0.0, 0.0, 15.0, 8.0, 18.0, 16.0), List.of(8.0, -8.0, 15.0, 16.0, 10.0, 16.0))); SHAPE3 = new Shapes.HorizontalShape(List.of(List.of(0.0, -8.0, 15.0, 8.0, 10.0, 16.0), List.of(8.0, 0.0, 15.0, 16.0, 18.0, 16.0))); - ROTATION = IntProperty.of("rotate", 1, 3);; + ROTATION = IntProperty.of("rotate", 1, 3); WATERLOGGED = Properties.WATERLOGGED; } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/LandMineBlock.java b/src/main/java/su/a71/new_soviet/blocks/LandMineBlock.java index 1a72186..db1444a 100644 --- a/src/main/java/su/a71/new_soviet/blocks/LandMineBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/LandMineBlock.java @@ -121,7 +121,7 @@ public class LandMineBlock extends HorizontalFacingBlock implements Waterloggabl @Nullable public BlockState getPlacementState(ItemPlacementContext ctx) { FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return (BlockState)this.getDefaultState().with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER).with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + return this.getDefaultState().with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER).with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { diff --git a/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java b/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java index ae84777..4f718d1 100644 --- a/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java @@ -3,7 +3,6 @@ package su.a71.new_soviet.blocks; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; import net.minecraft.block.piston.PistonBehavior; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; @@ -41,13 +40,13 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { if (!world.isClient) { - boolean bl = (Boolean)state.get(ON); + boolean bl = state.get(ON); if (bl != world.isReceivingRedstonePower(pos)) { if (bl) { world.scheduleBlockTick(pos, this, 4); } else { - world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); - world.setBlockState(pos, (BlockState)state.cycle(ON), 2); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); + world.setBlockState(pos, state.cycle(ON), 2); world.scheduleBlockTick(pos, this, 140); } } @@ -57,18 +56,13 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext ctx) { Direction dir = state.get(FACING); - switch(dir) { - case NORTH: - return Block.createCuboidShape(3.5, 2, 11, 12.5, 15, 16); - case SOUTH: - return Block.createCuboidShape(3.5, 2, 0, 12.5, 15, 5); - case EAST: - return Block.createCuboidShape(0, 2, 3.5, 5, 15, 12.5); - case WEST: - return Block.createCuboidShape(11, 2, 3.5, 16, 15, 12.5); - default: - return VoxelShapes.fullCube(); - } + return switch (dir) { + case NORTH -> Block.createCuboidShape(3.5, 2, 11, 12.5, 15, 16); + case SOUTH -> Block.createCuboidShape(3.5, 2, 0, 12.5, 15, 5); + case EAST -> Block.createCuboidShape(0, 2, 3.5, 5, 15, 12.5); + case WEST -> Block.createCuboidShape(11, 2, 3.5, 16, 15, 12.5); + default -> VoxelShapes.fullCube(); + }; } @Override @@ -80,17 +74,17 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { } public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - Direction direction = (Direction)state.get(FACING); + Direction direction = state.get(FACING); BlockPos blockPos = pos.offset(direction.getOpposite()); BlockState blockState = world.getBlockState(blockPos); return direction.getAxis().isHorizontal() && blockState.isSideSolidFullSquare(world, blockPos, direction); } public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if ((Boolean)state.get(ON) && !world.isReceivingRedstonePower(pos)) { - world.setBlockState(pos, (BlockState)state.cycle(ON), 2); + if (state.get(ON) && !world.isReceivingRedstonePower(pos)) { + world.setBlockState(pos, state.cycle(ON), 2); } else { - world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); world.scheduleBlockTick(pos, this, 140); } } diff --git a/src/main/java/su/a71/new_soviet/blocks/StoveBlock.java b/src/main/java/su/a71/new_soviet/blocks/StoveBlock.java index 5aa8b40..7608133 100644 --- a/src/main/java/su/a71/new_soviet/blocks/StoveBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/StoveBlock.java @@ -40,15 +40,11 @@ public class StoveBlock extends BlockWithEntity { @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext ctx) { - Direction dir = state.get(FACING); - switch(dir) { - case NORTH, SOUTH: - return VoxelShapes.cuboid(0.0625f, 0.0f, 0.3125f, 0.9375f, 0.5625f, 0.6875f); - case EAST, WEST: - return VoxelShapes.cuboid(0.3125f, 0.0f, 0.0625f, 0.6875f, 0.5625f, 0.9375f); - default: - return VoxelShapes.fullCube(); - } + return switch (state.get(FACING)) { + case NORTH, SOUTH -> VoxelShapes.cuboid(0.0625f, 0.0f, 0.3125f, 0.9375f, 0.5625f, 0.6875f); + case EAST, WEST -> VoxelShapes.cuboid(0.3125f, 0.0f, 0.0625f, 0.6875f, 0.5625f, 0.9375f); + default -> VoxelShapes.fullCube(); + }; } @Override @@ -57,11 +53,11 @@ public class StoveBlock extends BlockWithEntity { } public BlockState rotate(BlockState state, BlockRotation rotation) { - return (BlockState)state.with(FACING, rotation.rotate((Direction)state.get(FACING))); + return state.with(FACING, rotation.rotate(state.get(FACING))); } public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation((Direction)state.get(FACING))); + return state.rotate(mirror.getRotation(state.get(FACING))); } static { diff --git a/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java b/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java index 159db2f..33673d1 100644 --- a/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java @@ -4,7 +4,6 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; import net.minecraft.block.enums.WallMountLocation; import net.minecraft.block.piston.PistonBehavior; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.particle.DustParticleEffect; import net.minecraft.sound.BlockSoundGroup; @@ -17,7 +16,6 @@ import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import net.minecraft.world.World; @@ -26,6 +24,8 @@ import net.minecraft.world.event.GameEvent; import su.a71.new_soviet.registration.NSE_Sounds; +import java.util.Objects; + public class SwitchBlock extends LeverBlock { public static final BooleanProperty POWERED = Properties.POWERED; protected static final VoxelShape NORTH_WALL_SHAPE = Block.createCuboidShape(5.5, 5.5, 15, 10.5, 10.5, 16); @@ -39,39 +39,29 @@ public class SwitchBlock extends LeverBlock { public SwitchBlock(FabricBlockSettings fabricBlockSettings) { super(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).notSolid().pistonBehavior(PistonBehavior.DESTROY).strength(1f, 2f).mapColor(MapColor.TERRACOTTA_WHITE).noCollision()); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(FACING, Direction.NORTH)).with(POWERED, false)).with(FACE, WallMountLocation.WALL)); + this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(POWERED, false).with(FACE, WallMountLocation.WALL)); } @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch ((WallMountLocation)state.get(FACE)) { + switch (state.get(FACE)) { case FLOOR: { - switch (state.get(FACING).getAxis()) { - case X: { - return FLOOR_X_AXIS_SHAPE; - } + if (Objects.requireNonNull(state.get(FACING).getAxis()) == Direction.Axis.X) { + return FLOOR_X_AXIS_SHAPE; } return FLOOR_Z_AXIS_SHAPE; } case WALL: { - switch (state.get(FACING)) { - case EAST: { - return EAST_WALL_SHAPE; - } - case WEST: { - return WEST_WALL_SHAPE; - } - case SOUTH: { - return SOUTH_WALL_SHAPE; - } - } - return NORTH_WALL_SHAPE; + return switch (state.get(FACING)) { + case EAST -> EAST_WALL_SHAPE; + case WEST -> WEST_WALL_SHAPE; + case SOUTH -> SOUTH_WALL_SHAPE; + default -> NORTH_WALL_SHAPE; + }; } } - switch (state.get(FACING).getAxis()) { - case X: { - return CEILING_X_AXIS_SHAPE; - } + if (Objects.requireNonNull(state.get(FACING).getAxis()) == Direction.Axis.X) { + return CEILING_X_AXIS_SHAPE; } return CEILING_Z_AXIS_SHAPE; } @@ -79,13 +69,13 @@ public class SwitchBlock extends LeverBlock { @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (world.isClient) { - BlockState blockState = (BlockState)state.cycle(POWERED); + state.cycle(POWERED); return ActionResult.SUCCESS; } BlockState blockState = this.togglePower(state, world, pos); float f = blockState.get(POWERED) ? 1f : 0.9f; world.playSound(null, pos, NSE_Sounds.SWITCH_PRESS, SoundCategory.BLOCKS, 0.6f, f); - world.emitGameEvent((Entity)player, blockState.get(POWERED) ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, pos); + world.emitGameEvent(player, blockState.get(POWERED) ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, pos); return ActionResult.CONSUME; } @@ -98,14 +88,6 @@ public class SwitchBlock extends LeverBlock { world.addParticle(new DustParticleEffect(DustParticleEffect.RED, alpha), d, e, f, 0.0, 0.0, 0.0); } - @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (state.get(POWERED) && random.nextFloat() < 0.25f) { - //SwitchBlock.spawnParticles(state, world, pos, 0.5f); - } - } - - @Override protected void appendProperties(StateManager.Builder builder) { builder.add(FACE, FACING, POWERED); diff --git a/src/main/java/su/a71/new_soviet/blocks/lamps/GoldenTableLampBlock.java b/src/main/java/su/a71/new_soviet/blocks/lamps/GoldenTableLampBlock.java index 6584906..301189c 100644 --- a/src/main/java/su/a71/new_soviet/blocks/lamps/GoldenTableLampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/lamps/GoldenTableLampBlock.java @@ -43,8 +43,7 @@ public class GoldenTableLampBlock extends LampBlock { } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - Direction dir = state.get(FACING); - return switch (dir) { + return switch (state.get(FACING)) { case NORTH -> SHAPE.north(); case SOUTH -> SHAPE.south(); case EAST -> SHAPE.east(); @@ -65,11 +64,11 @@ public class GoldenTableLampBlock extends LampBlock { } public BlockState rotate(BlockState state, BlockRotation rotation) { - return (BlockState)state.with(FACING, rotation.rotate((Direction)state.get(FACING))); + return state.with(FACING, rotation.rotate(state.get(FACING))); } public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation((Direction)state.get(FACING))); + return state.rotate(mirror.getRotation(state.get(FACING))); } static { diff --git a/src/main/java/su/a71/new_soviet/blocks/lamps/LampBlock.java b/src/main/java/su/a71/new_soviet/blocks/lamps/LampBlock.java index 7d00e96..3f43f8c 100644 --- a/src/main/java/su/a71/new_soviet/blocks/lamps/LampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/lamps/LampBlock.java @@ -11,7 +11,6 @@ import net.minecraft.sound.SoundCategory; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -65,7 +64,7 @@ public abstract class LampBlock extends Block implements Waterloggable { @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { if (!world.isClient) { - world.setBlockState(pos, (BlockState)state.cycle(INVERTED), 2); + world.setBlockState(pos, state.cycle(INVERTED), 2); } float f = state.get(ON) ? 1f : 0.9f; world.playSound(null, pos, NSE_Sounds.SWITCH_PRESS, SoundCategory.BLOCKS, 0.6f, f); @@ -73,7 +72,7 @@ public abstract class LampBlock extends Block implements Waterloggable { } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{ON, WATERLOGGED, INVERTED}); + builder.add(ON, WATERLOGGED, INVERTED); } public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { @@ -94,20 +93,20 @@ public abstract class LampBlock extends Block implements Waterloggable { public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { if (!world.isClient) { - boolean bl = (Boolean)state.get(ON); + boolean bl = state.get(ON); if (bl != world.isReceivingRedstonePower(pos)) { if (bl) { world.scheduleBlockTick(pos, this, 4); } else { - world.setBlockState(pos, (BlockState)state.cycle(ON), 2); + world.setBlockState(pos, state.cycle(ON), 2); } } } } public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if ((Boolean)state.get(ON) && !world.isReceivingRedstonePower(pos)) { - world.setBlockState(pos, (BlockState)state.cycle(ON), 2); + if (state.get(ON) && !world.isReceivingRedstonePower(pos)) { + world.setBlockState(pos, state.cycle(ON), 2); } } diff --git a/src/main/java/su/a71/new_soviet/blocks/lamps/LightBulbLampBlock.java b/src/main/java/su/a71/new_soviet/blocks/lamps/LightBulbLampBlock.java index 3c5a1a4..750700d 100644 --- a/src/main/java/su/a71/new_soviet/blocks/lamps/LightBulbLampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/lamps/LightBulbLampBlock.java @@ -9,7 +9,6 @@ import net.minecraft.sound.SoundCategory; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; import net.minecraft.util.ActionResult; import net.minecraft.util.Formatting; import net.minecraft.util.Hand; @@ -24,7 +23,6 @@ import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; import su.a71.new_soviet.NewSoviet; -import su.a71.new_soviet.blocks.lamps.LampBlock; import su.a71.new_soviet.registration.NSE_Items; import su.a71.new_soviet.registration.NSE_Sounds; @@ -47,7 +45,7 @@ public class LightBulbLampBlock extends LampBlock { @Nullable public BlockState getPlacementState(ItemPlacementContext ctx) { - return (BlockState)this.getDefaultState() + return this.getDefaultState() .with(BROKEN, false); } @@ -57,12 +55,12 @@ public class LightBulbLampBlock extends LampBlock { if (world.isReceivingRedstonePower(pos) == state.get(INVERTED) || (NewSoviet.RANDOM.nextBetween(1, 32) == 1)) { if (!player.isCreative()) player.getInventory().getMainHandStack().decrement(1); - world.setBlockState(pos, (BlockState)state.with(BROKEN, false)); + world.setBlockState(pos, state.with(BROKEN, false)); return ActionResult.SUCCESS; } else { player.getItemCooldownManager().set(NSE_Items.LIGHT_BULB, 10); player.sendMessage(Text.translatable("block.new_soviet.light_bulb_block.energized").formatted(Formatting.YELLOW), true); - world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.ELECTRIC_HIT, SoundCategory.AMBIENT, 0.8f, 1f); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), NSE_Sounds.ELECTRIC_HIT, SoundCategory.AMBIENT, 0.8f, 1f); if (!player.isCreative()) { player.damage(world.getDamageSources().lightningBolt(), NewSoviet.RANDOM.nextBetween(1, 4)); } @@ -79,14 +77,14 @@ public class LightBulbLampBlock extends LampBlock { @Override public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { if (!state.get(BROKEN)) { - world.playSound((PlayerEntity)null, hit.getBlockPos().getX(), hit.getBlockPos().getY(), hit.getBlockPos().getZ(), NSE_Sounds.LIGHT_BULB_BROKEN_SOUND, SoundCategory.NEUTRAL, 0.8f, 1f); + world.playSound(null, hit.getBlockPos().getX(), hit.getBlockPos().getY(), hit.getBlockPos().getZ(), NSE_Sounds.LIGHT_BULB_BROKEN_SOUND, SoundCategory.NEUTRAL, 0.8f, 1f); } - world.setBlockState(hit.getBlockPos(), (BlockState)state.with(BROKEN, true), 2); + world.setBlockState(hit.getBlockPos(), state.with(BROKEN, true), 2); super.onProjectileHit(world, state, hit, projectile); } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{ON, BROKEN, WATERLOGGED, INVERTED}); + builder.add(ON, BROKEN, WATERLOGGED, INVERTED); } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { diff --git a/src/main/java/su/a71/new_soviet/blocks/lamps/TableLampBlock.java b/src/main/java/su/a71/new_soviet/blocks/lamps/TableLampBlock.java index 7f215fe..3c6fe1e 100644 --- a/src/main/java/su/a71/new_soviet/blocks/lamps/TableLampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/lamps/TableLampBlock.java @@ -10,7 +10,7 @@ import net.minecraft.world.WorldView; import su.a71.new_soviet.blocks.lamps.LampBlock; public class TableLampBlock extends LampBlock { - protected final VoxelShape SHAPE = getStandingShape();; + protected final VoxelShape SHAPE = getStandingShape(); public TableLampBlock(AbstractBlock.Settings settings) { super(settings, true, null); diff --git a/src/main/java/su/a71/new_soviet/blocks/lamps/lamp_post/LampPostBaseBlock.java b/src/main/java/su/a71/new_soviet/blocks/lamps/lamp_post/LampPostBaseBlock.java index 8b08cd2..779b310 100644 --- a/src/main/java/su/a71/new_soviet/blocks/lamps/lamp_post/LampPostBaseBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/lamps/lamp_post/LampPostBaseBlock.java @@ -36,7 +36,7 @@ public class LampPostBaseBlock extends Block implements Waterloggable { public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext ctx) { if (state.get(Properties.ATTACHED)) { return SHAPE_ATTACHED; - }; + } return SHAPE_BASE; } diff --git a/src/main/java/su/a71/new_soviet/blocks/lamps/lamp_post/LampPostLampBlock.java b/src/main/java/su/a71/new_soviet/blocks/lamps/lamp_post/LampPostLampBlock.java index 5849a76..560b171 100644 --- a/src/main/java/su/a71/new_soviet/blocks/lamps/lamp_post/LampPostLampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/lamps/lamp_post/LampPostLampBlock.java @@ -9,7 +9,6 @@ import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockRotation; import net.minecraft.util.math.BlockPos; @@ -37,8 +36,7 @@ public class LampPostLampBlock extends Block implements Waterloggable { } public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - Direction dir = state.get(FACING); - return switch (dir) { + return switch (state.get(FACING)) { case NORTH -> SHAPE.north(); case SOUTH -> SHAPE.south(); case EAST -> SHAPE.east(); @@ -70,7 +68,7 @@ public class LampPostLampBlock extends Block implements Waterloggable { } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{WATERLOGGED, Properties.HORIZONTAL_FACING}); + builder.add(WATERLOGGED, Properties.HORIZONTAL_FACING); } public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { @@ -90,11 +88,11 @@ public class LampPostLampBlock extends Block implements Waterloggable { } public BlockState rotate(BlockState state, BlockRotation rotation) { - return (BlockState)state.with(FACING, rotation.rotate((Direction)state.get(FACING))); + return state.with(FACING, rotation.rotate(state.get(FACING))); } public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation((Direction)state.get(FACING))); + return state.rotate(mirror.getRotation(state.get(FACING))); } static { diff --git a/src/main/java/su/a71/new_soviet/datagen/BlockLootTables.java b/src/main/java/su/a71/new_soviet/datagen/BlockLootTables.java index 5ffd26d..0bec83d 100644 --- a/src/main/java/su/a71/new_soviet/datagen/BlockLootTables.java +++ b/src/main/java/su/a71/new_soviet/datagen/BlockLootTables.java @@ -171,9 +171,9 @@ public class BlockLootTables extends FabricBlockLootTableProvider { addDrop(NSE_Blocks.MEAT_EYE); addDrop(NSE_Blocks.MEAT_TEETH); addDrop(NSE_Blocks.CHISELED_BIRCH_DOOR, doorDrops(NSE_Blocks.CHISELED_BIRCH_DOOR)); - addDrop(NSE_Blocks.CHISELED_MANGROVE_DOOR, doorDrops(NSE_Blocks.CHISELED_MANGROVE_DOOR));; + addDrop(NSE_Blocks.CHISELED_MANGROVE_DOOR, doorDrops(NSE_Blocks.CHISELED_MANGROVE_DOOR)); addDrop(NSE_Blocks.CHISELED_OAK_DOOR, doorDrops(NSE_Blocks.CHISELED_OAK_DOOR)); - addDrop(NSE_Blocks.CHISELED_SPRUCE_DOOR, doorDrops(NSE_Blocks.CHISELED_SPRUCE_DOOR));; + addDrop(NSE_Blocks.CHISELED_SPRUCE_DOOR, doorDrops(NSE_Blocks.CHISELED_SPRUCE_DOOR)); addDrop(NSE_Blocks.BEIGE_WALLPAPER); addDrop(NSE_Blocks.BROWN_WALLPAPER); addDrop(NSE_Blocks.GREEN_WALLPAPER); diff --git a/src/main/java/su/a71/new_soviet/datagen/ModelGenerator.java b/src/main/java/su/a71/new_soviet/datagen/ModelGenerator.java index fafcd5c..15f838c 100644 --- a/src/main/java/su/a71/new_soviet/datagen/ModelGenerator.java +++ b/src/main/java/su/a71/new_soviet/datagen/ModelGenerator.java @@ -39,7 +39,7 @@ public class ModelGenerator extends FabricModelProvider { public void registerCube(BlockStateModelGenerator blockStateModelGenerator, Block block, String texturePath) { TextureMap textureMap = TextureMap.all(Registries.BLOCK.getId(block).withPath((path) -> "block/" + texturePath + "/" + path)); Identifier model_id = Models.CUBE_ALL.upload(block, textureMap, blockStateModelGenerator.modelCollector); - blockStateModelGenerator.blockStateCollector.accept(blockStateModelGenerator.createSingletonBlockState(block, model_id)); + blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(block, model_id)); } public void registerSlabStairs(BlockStateModelGenerator blockStateModelGenerator, Block parent, StairsBlock stairs, SlabBlock slab, String texturePath) { diff --git a/src/main/java/su/a71/new_soviet/items/CigaretteItem.java b/src/main/java/su/a71/new_soviet/items/CigaretteItem.java index 3d19a1c..8b01af2 100644 --- a/src/main/java/su/a71/new_soviet/items/CigaretteItem.java +++ b/src/main/java/su/a71/new_soviet/items/CigaretteItem.java @@ -19,11 +19,9 @@ import net.minecraft.util.Hand; import net.minecraft.util.TypedActionResult; import org.jetbrains.annotations.Nullable; import su.a71.new_soviet.NewSoviet; -import su.a71.new_soviet.registration.NSE_Items; import su.a71.new_soviet.registration.NSE_Sounds; import java.util.List; -import java.util.Objects; // FIXME: 26.08.2023 This whole class is making my head hurt, fix!!! public class CigaretteItem extends Item { diff --git a/src/main/java/su/a71/new_soviet/items/DiceItem.java b/src/main/java/su/a71/new_soviet/items/DiceItem.java index 9af68e2..b9325c6 100644 --- a/src/main/java/su/a71/new_soviet/items/DiceItem.java +++ b/src/main/java/su/a71/new_soviet/items/DiceItem.java @@ -34,13 +34,11 @@ public class DiceItem extends Item { if (!world.isClient) { StringBuilder output = new StringBuilder(); for (var i = 0; i < itemStack.getCount(); i++) { - world.playSound((PlayerEntity)null, user.getX(), user.getY(), user.getZ(), NSE_Sounds.DICE_SOUND, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); + world.playSound(null, user.getX(), user.getY(), user.getZ(), NSE_Sounds.DICE_SOUND, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); output.append(NewSoviet.RANDOM.nextBetween(1, this.getSides())).append(", "); } if (Config.INSTANCE.shouldAnnounceDice()) { - world.getPlayers().forEach(player -> { - player.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown_announce" : "item.new_soviet.dice.thrown_multiple_announce", user.getDisplayName()).append(" " + output.subSequence(0, output.length() - 2)), false); - }); + world.getPlayers().forEach(player -> player.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown_announce" : "item.new_soviet.dice.thrown_multiple_announce", user.getDisplayName()).append(" " + output.subSequence(0, output.length() - 2)), false)); } else { user.sendMessage(Text.translatable(itemStack.getCount() == 1 ? "item.new_soviet.dice.thrown" : "item.new_soviet.dice.thrown_multiple").append(" " + output.subSequence(0, output.length() - 2)), true); } diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_BaseRegistration.java b/src/main/java/su/a71/new_soviet/registration/NSE_BaseRegistration.java index 7c0461a..20031b7 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_BaseRegistration.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_BaseRegistration.java @@ -19,6 +19,7 @@ import net.minecraft.util.Identifier; import java.util.Optional; import java.util.function.Supplier; + import su.a71.new_soviet.NewSoviet; public class NSE_BaseRegistration { @@ -28,9 +29,7 @@ public class NSE_BaseRegistration { if (tab == null) return; // Sanity check for hidden items Optional> key = Registries.ITEM_GROUP.getKey(tab); - key.ifPresent(itemGroupRegistryKey -> ItemGroupEvents.modifyEntriesEvent(itemGroupRegistryKey).register(content -> { - content.add(supplier.get()); - })); + key.ifPresent(itemGroupRegistryKey -> ItemGroupEvents.modifyEntriesEvent(itemGroupRegistryKey).register(content -> content.add(supplier.get()))); } public static void registerBlock(String name, Supplier supplier, ItemGroup tab) { @@ -44,6 +43,8 @@ public class NSE_BaseRegistration { return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id)); } + + @SuppressWarnings({"unchecked", "rawtypes"}) public static T registerBlockEntity(String name, FabricBlockEntityTypeBuilder.Factory factory, net.minecraft.block.Block... blocks) { return (T) Registry.register( Registries.BLOCK_ENTITY_TYPE, diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_ToolMaterials.java b/src/main/java/su/a71/new_soviet/registration/NSE_ToolMaterials.java index 4411e28..7528841 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_ToolMaterials.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_ToolMaterials.java @@ -19,13 +19,13 @@ public enum NSE_ToolMaterials implements ToolMaterial private final int enchantability; private final Lazy repairIngredient; - private NSE_ToolMaterials(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, int enchantability, Supplier repairIngredient) { + NSE_ToolMaterials(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, int enchantability, Supplier repairIngredient) { this.miningLevel = miningLevel; this.itemDurability = itemDurability; this.miningSpeed = miningSpeed; this.attackDamage = attackDamage; this.enchantability = enchantability; - this.repairIngredient = new Lazy(repairIngredient); + this.repairIngredient = new Lazy<>(repairIngredient); } @Override diff --git a/src/main/java/su/a71/new_soviet/util/Shapes.java b/src/main/java/su/a71/new_soviet/util/Shapes.java index b7a7aae..c1ec08a 100644 --- a/src/main/java/su/a71/new_soviet/util/Shapes.java +++ b/src/main/java/su/a71/new_soviet/util/Shapes.java @@ -96,7 +96,7 @@ public class Shapes { } public VoxelShape west() { - VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0);; + VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0); for (VoxelShape o : ShapesListW) { shape = VoxelShapes.union(shape, o); } @@ -104,7 +104,7 @@ public class Shapes { } public VoxelShape south() { - VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0);; + VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0); for (VoxelShape shapesList : ShapesListS) { shape = VoxelShapes.union(shape, shapesList); } @@ -112,7 +112,7 @@ public class Shapes { } public VoxelShape east() { - VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0);; + VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0); for (VoxelShape o : ShapesListE) { shape = VoxelShapes.union(shape, o); } @@ -148,7 +148,7 @@ public class Shapes { } public VoxelShape west() { - VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0);; + VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0); for (VoxelShape o : ShapesListW) { shape = VoxelShapes.union(shape, o); } @@ -156,7 +156,7 @@ public class Shapes { } public VoxelShape south() { - VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0);; + VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0); for (VoxelShape shapesList : ShapesListS) { shape = VoxelShapes.union(shape, shapesList); } @@ -164,7 +164,7 @@ public class Shapes { } public VoxelShape east() { - VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0);; + VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0); for (VoxelShape o : ShapesListE) { shape = VoxelShapes.union(shape, o); }