diff --git a/src/client/java/su/a71/new_soviet/NewSovietClient.java b/src/client/java/su/a71/new_soviet/NewSovietClient.java index 2509989..d9f090f 100644 --- a/src/client/java/su/a71/new_soviet/NewSovietClient.java +++ b/src/client/java/su/a71/new_soviet/NewSovietClient.java @@ -16,7 +16,6 @@ public class NewSovietClient implements ClientModInitializer { @Override public void onInitializeClient() { BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.CRATE, RenderLayer.getCutout()); - BlockRenderLayerMap.INSTANCE.putBlock(NSE_Blocks.HANDRAIL, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.LAMP, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.CEILING_FAN, RenderLayer.getCutout()); BlockRenderLayerMap.INSTANCE.putBlock(NSE_Custom.SIREN, RenderLayer.getCutout()); diff --git a/src/main/generated/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/main/generated/data/minecraft/tags/blocks/mineable/pickaxe.json index ab67b35..e9caf71 100644 --- a/src/main/generated/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/main/generated/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -2,7 +2,6 @@ "replace": false, "values": [ "new_soviet:sand_tiles", - "new_soviet:handrail", "new_soviet:nii_floor", "new_soviet:big_green_tiles", "new_soviet:big_green_tiles_cracked", diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/black_bishop.json b/src/main/generated/data/new_soviet/loot_tables/blocks/black_bishop.json deleted file mode 100644 index d43e969..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/black_bishop.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:black_bishop" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/black_king.json b/src/main/generated/data/new_soviet/loot_tables/blocks/black_king.json deleted file mode 100644 index 3a18050..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/black_king.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:black_king" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/black_knight.json b/src/main/generated/data/new_soviet/loot_tables/blocks/black_knight.json deleted file mode 100644 index 8e3666c..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/black_knight.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:black_knight" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/black_pawn.json b/src/main/generated/data/new_soviet/loot_tables/blocks/black_pawn.json deleted file mode 100644 index 42a44a7..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/black_pawn.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:black_pawn" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/black_queen.json b/src/main/generated/data/new_soviet/loot_tables/blocks/black_queen.json deleted file mode 100644 index 8a5bff0..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/black_queen.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:black_queen" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/black_rook.json b/src/main/generated/data/new_soviet/loot_tables/blocks/black_rook.json deleted file mode 100644 index 3b389dd..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/black_rook.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:black_rook" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_birch_door.json b/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_birch_door.json index b27cb67..bd082d2 100644 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_birch_door.json +++ b/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_birch_door.json @@ -11,15 +11,6 @@ "entries": [ { "type": "minecraft:item", - "conditions": [ - { - "block": "new_soviet:chiseled_birch_door", - "condition": "minecraft:block_state_property", - "properties": { - "half": "lower" - } - } - ], "name": "new_soviet:chiseled_birch_door" } ], diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_mangrove_door.json b/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_mangrove_door.json index d687b9b..a1b8819 100644 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_mangrove_door.json +++ b/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_mangrove_door.json @@ -11,15 +11,6 @@ "entries": [ { "type": "minecraft:item", - "conditions": [ - { - "block": "new_soviet:chiseled_mangrove_door", - "condition": "minecraft:block_state_property", - "properties": { - "half": "lower" - } - } - ], "name": "new_soviet:chiseled_mangrove_door" } ], diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_oak_door.json b/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_oak_door.json index 2ceb5a2..374e226 100644 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_oak_door.json +++ b/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_oak_door.json @@ -11,15 +11,6 @@ "entries": [ { "type": "minecraft:item", - "conditions": [ - { - "block": "new_soviet:chiseled_oak_door", - "condition": "minecraft:block_state_property", - "properties": { - "half": "lower" - } - } - ], "name": "new_soviet:chiseled_oak_door" } ], diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_spruce_door.json b/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_spruce_door.json index b31f64c..f23c6cf 100644 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_spruce_door.json +++ b/src/main/generated/data/new_soviet/loot_tables/blocks/chiseled_spruce_door.json @@ -11,15 +11,6 @@ "entries": [ { "type": "minecraft:item", - "conditions": [ - { - "block": "new_soviet:chiseled_spruce_door", - "condition": "minecraft:block_state_property", - "properties": { - "half": "lower" - } - } - ], "name": "new_soviet:chiseled_spruce_door" } ], diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/handrail.json b/src/main/generated/data/new_soviet/loot_tables/blocks/handrail.json deleted file mode 100644 index 2c391a9..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/handrail.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:handrail" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/white_bishop.json b/src/main/generated/data/new_soviet/loot_tables/blocks/white_bishop.json deleted file mode 100644 index e316114..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/white_bishop.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:white_bishop" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/white_king.json b/src/main/generated/data/new_soviet/loot_tables/blocks/white_king.json deleted file mode 100644 index 5ca35b7..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/white_king.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:white_king" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/white_knight.json b/src/main/generated/data/new_soviet/loot_tables/blocks/white_knight.json deleted file mode 100644 index e3070d7..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/white_knight.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:white_knight" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/white_pawn.json b/src/main/generated/data/new_soviet/loot_tables/blocks/white_pawn.json deleted file mode 100644 index 0d1f254..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/white_pawn.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:white_pawn" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/white_queen.json b/src/main/generated/data/new_soviet/loot_tables/blocks/white_queen.json deleted file mode 100644 index b313989..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/white_queen.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:white_queen" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/generated/data/new_soviet/loot_tables/blocks/white_rook.json b/src/main/generated/data/new_soviet/loot_tables/blocks/white_rook.json deleted file mode 100644 index 9429d9a..0000000 --- a/src/main/generated/data/new_soviet/loot_tables/blocks/white_rook.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "minecraft:block", - "pools": [ - { - "bonus_rolls": 0.0, - "conditions": [ - { - "condition": "minecraft:survives_explosion" - } - ], - "entries": [ - { - "type": "minecraft:item", - "name": "new_soviet:white_rook" - } - ], - "rolls": 1.0 - } - ] -} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/DataGeneration.java b/src/main/java/su/a71/new_soviet/DataGeneration.java index a605f49..c7b3684 100644 --- a/src/main/java/su/a71/new_soviet/DataGeneration.java +++ b/src/main/java/su/a71/new_soviet/DataGeneration.java @@ -11,32 +11,19 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; import net.minecraft.block.Block; import net.minecraft.block.Blocks; -import net.minecraft.block.CandleBlock; import net.minecraft.data.client.BlockStateModelGenerator; import net.minecraft.data.client.ItemModelGenerator; import net.minecraft.data.server.recipe.RecipeJsonProvider; import net.minecraft.data.server.recipe.RecipeProvider; import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder; import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder; -import net.minecraft.item.Item; import net.minecraft.item.ItemConvertible; import net.minecraft.item.Items; -import net.minecraft.loot.LootPool; -import net.minecraft.loot.LootTable; -import net.minecraft.loot.condition.BlockStatePropertyLootCondition; -import net.minecraft.loot.entry.ItemEntry; -import net.minecraft.loot.entry.LootPoolEntry; -import net.minecraft.loot.function.ExplosionDecayLootFunction; -import net.minecraft.loot.function.LootFunctionConsumingBuilder; -import net.minecraft.loot.function.SetCountLootFunction; -import net.minecraft.loot.provider.number.ConstantLootNumberProvider; -import net.minecraft.predicate.StatePredicate; import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.book.RecipeCategory; import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.Util; -import su.a71.new_soviet.blocks.CheckerBlock; import su.a71.new_soviet.registration.NSE_Blocks; import su.a71.new_soviet.registration.NSE_Custom; import su.a71.new_soviet.registration.NSE_Items; @@ -47,7 +34,8 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; public class DataGeneration implements DataGeneratorEntrypoint { - private class BlockLootTables extends FabricBlockLootTableProvider { + + private static class BlockLootTables extends FabricBlockLootTableProvider { public BlockLootTables(FabricDataOutput dataOutput) { super(dataOutput); } @@ -211,29 +199,15 @@ public class DataGeneration implements DataGeneratorEntrypoint { addDrop(NSE_Blocks.MEAT); 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_OAK_DOOR, doorDrops(NSE_Blocks.CHISELED_OAK_DOOR)); - addDrop(NSE_Blocks.CHISELED_SPRUCE_DOOR, doorDrops(NSE_Blocks.CHISELED_SPRUCE_DOOR));; + addDrop(NSE_Blocks.CHISELED_BIRCH_DOOR); + addDrop(NSE_Blocks.CHISELED_MANGROVE_DOOR); + addDrop(NSE_Blocks.CHISELED_OAK_DOOR); + addDrop(NSE_Blocks.CHISELED_SPRUCE_DOOR); addDrop(NSE_Blocks.BEIGE_WALLPAPER); addDrop(NSE_Blocks.BROWN_WALLPAPER); addDrop(NSE_Blocks.GREEN_WALLPAPER); - addDrop(NSE_Blocks.HANDRAIL); // Drops for furniture/electronics/appliances - addDrop(NSE_Custom.WHITE_PAWN); - addDrop(NSE_Custom.WHITE_BISHOP); - addDrop(NSE_Custom.WHITE_KING); - addDrop(NSE_Custom.WHITE_KNIGHT); - addDrop(NSE_Custom.WHITE_QUEEN); - addDrop(NSE_Custom.WHITE_ROOK); - addDrop(NSE_Custom.BLACK_KNIGHT); - addDrop(NSE_Custom.BLACK_PAWN); - addDrop(NSE_Custom.BLACK_KING); - addDrop(NSE_Custom.BLACK_QUEEN); - addDrop(NSE_Custom.BLACK_BISHOP); - addDrop(NSE_Custom.BLACK_ROOK); - addDrop(NSE_Custom.TV); addDrop(NSE_Custom.RED_TV); addDrop(NSE_Custom.BROWN_TV); @@ -256,7 +230,6 @@ public class DataGeneration implements DataGeneratorEntrypoint { // Blocks mined with a pickaxe getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE) .add(NSE_Blocks.SAND_TILES) - .add(NSE_Blocks.HANDRAIL) .add(NSE_Blocks.NII_FLOOR) .add(NSE_Blocks.BIG_GREEN_TILES) .add(NSE_Blocks.BIG_GREEN_TILES_CRACKED) diff --git a/src/main/java/su/a71/new_soviet/blocks/CheckerBlock.java b/src/main/java/su/a71/new_soviet/blocks/CheckerBlock.java deleted file mode 100644 index 2283c40..0000000 --- a/src/main/java/su/a71/new_soviet/blocks/CheckerBlock.java +++ /dev/null @@ -1,108 +0,0 @@ -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; -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; - protected static final VoxelShape TWO_CHECKER; - protected static final VoxelShape THREE_CHECKER; - protected static final VoxelShape FOUR_CHECKER; - - public CheckerBlock(AbstractBlock.Settings settings) { - super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)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)); - } else { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - boolean bl = fluidState.getFluid() == Fluids.WATER; - return (BlockState)super.getPlacementState(ctx).with(WATERLOGGED, bl); - } - } - - protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { - return !floor.getCollisionShape(world, pos).getFace(Direction.UP).isEmpty() || floor.isSideSolidFullSquare(world, pos, Direction.UP); - } - - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.down(); - return this.canPlantOnTop(world.getBlockState(blockPos), world, blockPos); - } - - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { - if (!state.canPlaceAt(world, pos)) { - return Blocks.AIR.getDefaultState(); - } else { - if ((Boolean)state.get(WATERLOGGED)) { - world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); - } - - return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); - } - } - - public boolean canReplace(BlockState state, ItemPlacementContext context) { - return !context.shouldCancelInteraction() && context.getStack().isOf(this.asItem()) && (Integer) 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; - } - } - - public FluidState getFluidState(BlockState state) { - return (Boolean)state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); - } - - protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{CHECKERS, WATERLOGGED}); - } - - public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { - return false; - } - - static { - 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); - THREE_CHECKER = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 12.0, 14.0); - FOUR_CHECKER = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 16.0, 14.0); - } -} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/ChessBlock.java b/src/main/java/su/a71/new_soviet/blocks/ChessBlock.java deleted file mode 100644 index ade8934..0000000 --- a/src/main/java/su/a71/new_soviet/blocks/ChessBlock.java +++ /dev/null @@ -1,50 +0,0 @@ -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; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; - -public class ChessBlock extends HorizontalFacingBlock { - - private VoxelShape blockShape; - - public ChessBlock(AbstractBlock.Settings settings, VoxelShape blockShape) { - super(settings.notSolid().nonOpaque().noBlockBreakParticles().pistonBehavior(PistonBehavior.DESTROY).strength(0.1f, 2f)); - setDefaultState(getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH)); - this.blockShape = blockShape; - } - - @Override - protected void appendProperties(StateManager.Builder builder) { - builder.add(Properties.HORIZONTAL_FACING); - } - - @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext ctx) { - return VoxelShapes.union(blockShape, Block.createCuboidShape(4,0,4,12,1,12), Block.createCuboidShape(5,1,5,11,4,11), Block.createCuboidShape(6,0,6,10,13,10)); - } - - @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return super.getPlacementState(ctx).with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); - } - - protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { - return !floor.getCollisionShape(world, pos).getFace(Direction.UP).isEmpty() || floor.isSideSolidFullSquare(world, pos, Direction.UP); - } - - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.down(); - return this.canPlantOnTop(world.getBlockState(blockPos), world, blockPos); - } -} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/ChessBlockKnight.java b/src/main/java/su/a71/new_soviet/blocks/ChessBlockKnight.java deleted file mode 100644 index d7f4065..0000000 --- a/src/main/java/su/a71/new_soviet/blocks/ChessBlockKnight.java +++ /dev/null @@ -1,57 +0,0 @@ -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; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.piston.PistonBehavior; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -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 { - - public ChessBlockKnight(Settings settings) { - super(settings.notSolid().nonOpaque().noBlockBreakParticles().pistonBehavior(PistonBehavior.DESTROY).strength(0.1f, 2f)); - setDefaultState(getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH)); - } - - @Override - protected void appendProperties(StateManager.Builder builder) { - builder.add(Properties.HORIZONTAL_FACING); - } - - @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext ctx) { - Direction dir = state.get(FACING); - return switch (dir) { - case NORTH -> VoxelShapes.union(Block.createCuboidShape(4,0,4,12,1,12), Block.createCuboidShape(5,1,5,11,4,11), Block.createCuboidShape(6,0,6,10,13,10), Block.createCuboidShape(5.5,9,1.5,10.5,13,9.5), Block.createCuboidShape(7.5,8,6,8.5,17,11)); - case SOUTH -> VoxelShapes.union(Block.createCuboidShape(4,0,4,12,1,12), Block.createCuboidShape(5,1,5,11,4,11), Block.createCuboidShape(6,0,6,10,13,10), Block.createCuboidShape(5.5,9,6.5,10.5,13,14.5), Block.createCuboidShape(7.5,8,5,8.5,17,10)); - case EAST -> VoxelShapes.union(Block.createCuboidShape(4,0,4,12,1,12), Block.createCuboidShape(5,1,5,11,4,11), Block.createCuboidShape(6,0,6,10,13,10), Block.createCuboidShape(6.5,9,5.5,14.5,13,10.5), Block.createCuboidShape(5,8,7.5,10,17,8.5)); - case WEST -> VoxelShapes.union(Block.createCuboidShape(4,0,4,12,1,12), Block.createCuboidShape(5,1,5,11,4,11), Block.createCuboidShape(6,0,6,10,13,10), Block.createCuboidShape(1.5,9,5.5,9.5,13,10.5), Block.createCuboidShape(6,8,7.5,11,17,8.5)); - default -> VoxelShapes.fullCube(); - }; - } - - @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return super.getPlacementState(ctx).with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); - } - - protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { - return !floor.getCollisionShape(world, pos).getFace(Direction.UP).isEmpty() || floor.isSideSolidFullSquare(world, pos, Direction.UP); - } - - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.down(); - return this.canPlantOnTop(world.getBlockState(blockPos), world, blockPos); - } -} \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/blocks/HandrailBlock.java b/src/main/java/su/a71/new_soviet/blocks/HandrailBlock.java deleted file mode 100644 index 82e879c..0000000 --- a/src/main/java/su/a71/new_soviet/blocks/HandrailBlock.java +++ /dev/null @@ -1,165 +0,0 @@ -package su.a71.new_soviet.blocks; - -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.enums.BlockHalf; -import net.minecraft.block.enums.StairShape; -import net.minecraft.block.piston.PistonBehavior; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.sound.BlockSoundGroup; -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.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.gen.feature.util.CaveSurface; -import su.a71.new_soviet.entity.TVBlockEntity; -import su.a71.new_soviet.registration.NSE_Blocks; -import su.a71.new_soviet.util.Shapes; - -import java.util.List; -import java.util.Objects; - -import static net.minecraft.block.StairsBlock.HALF; -import static net.minecraft.block.StairsBlock.SHAPE; - -public class HandrailBlock extends HorizontalFacingBlock implements BlockEntityProvider { - protected static final Shapes.HorizontalShape2 SHAPE1; - protected static final Shapes.HorizontalShape2 SHAPE2; - protected static final Shapes.HorizontalShape2 SHAPE3; - public static final BooleanProperty WATERLOGGED; - - public static final IntProperty ROTATE; - - public HandrailBlock(Settings settings) { - super(settings.sounds(BlockSoundGroup.METAL).pistonBehavior(PistonBehavior.BLOCK).strength(1f, 2f)); - setDefaultState(getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH)); - } - - @Override - protected void appendProperties(StateManager.Builder builder) { - builder.add(Properties.HORIZONTAL_FACING, WATERLOGGED, ROTATE); - } - - public FluidState getFluidState(BlockState state) { - return (Boolean)state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); - } - - @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext ctx) { - Direction dir = state.get(FACING); - int rot = state.get(ROTATE); - return switch (dir) { - case NORTH -> switch (rot) { - case 1 -> SHAPE1.north(); - case 2 -> SHAPE2.north(); - case 3 -> SHAPE3.north(); - default -> VoxelShapes.fullCube(); - }; - case SOUTH -> switch (rot) { - case 1 -> SHAPE1.south(); - case 2 -> SHAPE2.south(); - case 3 -> SHAPE3.south(); - default -> VoxelShapes.fullCube(); - }; - case EAST -> switch (rot) { - case 1 -> SHAPE1.east(); - case 2 -> SHAPE2.east(); - case 3 -> SHAPE3.east(); - default -> VoxelShapes.fullCube(); - }; - case WEST -> switch (rot) { - case 1 -> SHAPE1.west(); - case 2 -> SHAPE2.west(); - case 3 -> SHAPE3.west(); - default -> VoxelShapes.fullCube(); - }; - default -> VoxelShapes.fullCube(); - }; - } - - @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - boolean bl = fluidState.getFluid() == Fluids.WATER; - int rot = 2; - BlockPos under = new BlockPos(ctx.getBlockPos().getX(), ctx.getBlockPos().getY() - 1, ctx.getBlockPos().getZ()); - if (istruestairs1(ctx.getWorld().getBlockState(ctx.getBlockPos().down(1)), ctx)) { - rot = 1; - } else if (istruestairs2(ctx.getWorld().getBlockState(ctx.getBlockPos().down(1)), ctx)) { - rot = 3; - } - return (BlockState)this.getDefaultState() - .with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER) - .with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()) - .with(ROTATE, rot); - - } - - private boolean istruestairs1(BlockState blockState, ItemPlacementContext ctx) { - boolean output = false; - if (blockState.isIn(BlockTags.STAIRS)) { - boolean h = blockState.get(SHAPE) == StairShape.STRAIGHT; - if (h && blockState.get(HALF) == BlockHalf.BOTTOM && returnFacing(blockState.get(FACING).getName()) == ctx.getHorizontalPlayerFacing().getOpposite().getName()) { - output = true; - } - } - return output; - } - - private boolean istruestairs2(BlockState blockState, ItemPlacementContext ctx) { - boolean output = false; - if (blockState.isIn(BlockTags.STAIRS)) { - boolean h = blockState.get(SHAPE) == StairShape.STRAIGHT; - if (h && blockState.get(HALF) == BlockHalf.BOTTOM && blockState.get(FACING).getName() == returnFacing(ctx.getHorizontalPlayerFacing().getOpposite().getName())) { - output = true; - } - } - return output; - } - - private String returnFacing(String facing1) { - String facing2 = "north"; - if (facing1 == "north") { - facing2 = "west"; - } else if (facing1 == "west") { - facing2 = "south"; - } else if (facing1 == "south") { - facing2 = "east"; - } - return facing2; - } - - @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new TVBlockEntity(pos, state); - } - - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { - if (!state.canPlaceAt(world, pos)) { - return Blocks.AIR.getDefaultState(); - } else { - if ((Boolean)state.get(WATERLOGGED)) { - world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); - } - - return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); - } - } - - static { - SHAPE2 = new Shapes.HorizontalShape2(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.HorizontalShape2(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.HorizontalShape2(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))); - ROTATE = 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/TVBlock.java b/src/main/java/su/a71/new_soviet/blocks/TVBlock.java index 9afd9f0..d350e79 100644 --- a/src/main/java/su/a71/new_soviet/blocks/TVBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/TVBlock.java @@ -14,13 +14,8 @@ import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import su.a71.new_soviet.entity.TVBlockEntity; -import su.a71.new_soviet.util.Shapes; - -import java.util.List; public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvider { - protected static final Shapes.HorizontalShape SHAPE; - public TVBlock(AbstractBlock.Settings settings) { super(settings.sounds(BlockSoundGroup.METAL).pistonBehavior(PistonBehavior.BLOCK).strength(1f, 2f)); setDefaultState(getDefaultState().with(Properties.HORIZONTAL_FACING, Direction.NORTH)); @@ -35,10 +30,8 @@ public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvide public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext ctx) { Direction dir = state.get(FACING); return switch (dir) { - case NORTH -> SHAPE.north(); - case SOUTH -> SHAPE.south(); - case EAST -> SHAPE.east(); - case WEST -> SHAPE.west(); + case NORTH, SOUTH -> VoxelShapes.cuboid(0.0f, 0.0f, 0.1875f, 1.0f, 0.8125f, 0.8125f); + case EAST, WEST -> VoxelShapes.cuboid(0.1875f, 0.0f, 0.0f, 0.8125f, 0.8125f, 1.0f); default -> VoxelShapes.fullCube(); }; } @@ -52,8 +45,4 @@ public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvide public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { return new TVBlockEntity(pos, state); } - - static { - SHAPE = new Shapes.HorizontalShape(List.of(List.of(0.0, 1.0, 3.0, 16.0, 13.0, 13.0), List.of(2.0, 0.0, 4.0, 14.0, 1.0, 12.0), List.of(6.0, 13.0, 7.0, 10.0, 14.0, 9.0))); - } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/items/CigaretteItem.java b/src/main/java/su/a71/new_soviet/items/CigaretteItem.java deleted file mode 100644 index 4d53020..0000000 --- a/src/main/java/su/a71/new_soviet/items/CigaretteItem.java +++ /dev/null @@ -1,128 +0,0 @@ -package su.a71.new_soviet.items; - -import net.minecraft.client.item.TooltipContext; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.*; -import net.minecraft.particle.DustParticleEffect; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.sound.SoundCategory; -import net.minecraft.stat.Stats; -import net.minecraft.text.Text; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; - -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.SoundEvents; -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; - -public class CigaretteItem - extends Item { - private final int durationInTicks; - private final Item returnedItem; - private final String local_tooltip; - - public CigaretteItem(int durationInTicks, Item returnedItem, String localTooltip, Item.Settings settings) { - super(settings.maxDamageIfAbsent(durationInTicks)); - this.durationInTicks = durationInTicks; - this.returnedItem = returnedItem; - this.local_tooltip = localTooltip; - } - - @Override - public int getMaxUseTime(ItemStack stack) { - return durationInTicks - stack.getDamage() - 1; - } - - @Override - public UseAction getUseAction(ItemStack stack) { - return UseAction.SPYGLASS; - } - - @Override - public TypedActionResult use(World world, PlayerEntity user, Hand hand) { - ItemStack itemStack = user.getStackInHand(hand); - if (user.getInventory().getStack(40).getItem() == Items.FLINT_AND_STEEL && user.getInventory().getMainHandStack().getDamage() == 0) { - world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.CIGARETTE_START, SoundCategory.PLAYERS, 1.0f, 1.0f); - user.incrementStat(Stats.USED.getOrCreateStat(this)); - itemStack.damage(1, user, e -> e.sendEquipmentBreakStatus(EquipmentSlot.OFFHAND)); - return ItemUsage.consumeHeldItem(world, user, hand); - } else if (user.getInventory().getMainHandStack().getDamage() != 0) { - world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.CIGARETTE_RESTART, SoundCategory.PLAYERS, 1.0f, 1.0f); - user.incrementStat(Stats.USED.getOrCreateStat(this)); - return ItemUsage.consumeHeldItem(world, user, hand); - } else if (user.isCreative()) { - world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.CIGARETTE_RESTART, SoundCategory.PLAYERS, 1.0f, 1.0f); - user.incrementStat(Stats.USED.getOrCreateStat(this)); - return ItemUsage.consumeHeldItem(world, user, hand); - } - return TypedActionResult.fail(itemStack); - } - - @Override - public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { - stack.onStoppedUsing(world, user, durationInTicks); - return stack; - } - - @Override - public void usageTick(World world, LivingEntity user, ItemStack stack, int remainingUseTicks) { - user.setMovementSpeed(1.1f); - if (stack.getDamage() < durationInTicks - 1) { - stack.damage(1, user, e -> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND));} - if (NewSoviet.RANDOM.nextBetween(1, 2) == 1) { - float pitch = NewSoviet.RANDOM.nextBetween(8, 10) * 0.1f; - double d = user.getX(); - double e = user.getY() + 1.5; - double f = user.getZ(); - world.addParticle(ParticleTypes.SMOKE, d, e, f, 0, 0, 0); - world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.SMOKING, SoundCategory.PLAYERS, 1.0f, pitch); - } - if (NewSoviet.RANDOM.nextBetween(1, 6) == 1) { - double d = user.getX(); - double e = user.getY() + 1.5; - double f = user.getZ(); - world.addParticle(ParticleTypes.LARGE_SMOKE, d, e, f, 0, 0, 0); - float pitch = NewSoviet.RANDOM.nextBetween(9, 10) * 0.1f; - world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.CIGARETTE_RANDOM, SoundCategory.PLAYERS, 1.0f, pitch); - } - } - - @Override - public void onStoppedUsing(ItemStack stack, World world, LivingEntity user, int remainingUseTicks) { - if (stack.getDamage() < (durationInTicks - 1)) { - stack.damage(1, user, e -> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND)); - world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.CIGARETTE_PAUSE, SoundCategory.PLAYERS, 1.0f, 1.0f); - } else if (stack.getDamage() >= (durationInTicks - 2)) { - user.equipStack(EquipmentSlot.MAINHAND, new ItemStack(returnedItem)); - world.playSound(user, BlockPos.ofFloored(user.getPos()), NSE_Sounds.CIGARETTE_STOPPED, SoundCategory.PLAYERS, 1.0f, 1.0f); - } - double d = user.getX(); - double e = user.getY() + 1.5; - double f = user.getZ(); - world.addParticle(ParticleTypes.LARGE_SMOKE, d, e, f, 0, -0.03, 0); - } - - @Override - public void appendTooltip(ItemStack stack, @Nullable World world, List tooltip, TooltipContext context) { - if (!local_tooltip.isEmpty()) { - tooltip.add(Text.translatable(local_tooltip)); - super.appendTooltip(stack, world, tooltip, context); - } - } -} - 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 690295c..cb3b029 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 @@ -18,6 +18,7 @@ import net.minecraft.util.Identifier; import java.util.Optional; import java.util.function.Supplier; import su.a71.new_soviet.NewSoviet; +import su.a71.new_soviet.entity.TVBlockEntity; public class NSE_BaseRegistration { diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Blocks.java b/src/main/java/su/a71/new_soviet/registration/NSE_Blocks.java index c02eda3..39bcbdf 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Blocks.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Blocks.java @@ -12,8 +12,8 @@ import net.minecraft.sound.BlockSoundGroup; import net.minecraft.text.Text; import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; + import su.a71.new_soviet.blocks.ConcreteWithBarsBlock; -import su.a71.new_soviet.blocks.HandrailBlock; public class NSE_Blocks extends NSE_BaseRegistration { @@ -229,8 +229,6 @@ public class NSE_Blocks extends NSE_BaseRegistration { public static final Block MEAT_TEETH = new Block(FabricBlockSettings.copy(MEAT)); public static final SnowBlock PURPLE_GOO = new SnowBlock(FabricBlockSettings.copy(MEAT).hardness(1.2f).nonOpaque()); - public static final HandrailBlock HANDRAIL = new HandrailBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.COPPER).hardness(4f).nonOpaque()); - private static final ItemGroup NSE_BUILDING_TAB = FabricItemGroup.builder() .icon(() -> new ItemStack(CALCITE_TILES)) .displayName(Text.translatable("itemGroup.new_soviet.building_blocks")) @@ -435,7 +433,6 @@ public class NSE_Blocks extends NSE_BaseRegistration { registerBlock("meat_eye", () -> MEAT_EYE, NSE_BUILDING_TAB); registerBlock("meat_teeth", () -> MEAT_TEETH, NSE_BUILDING_TAB); registerBlock("purple_goo", () -> PURPLE_GOO, NSE_BUILDING_TAB); - registerBlock("handrail", () -> HANDRAIL, NSE_BUILDING_TAB); // Flammable blocks! FlammableBlockRegistry flammableBlockRegistry = FlammableBlockRegistry.getDefaultInstance(); diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java b/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java index bc531ef..bd29137 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Custom.java @@ -2,9 +2,7 @@ package su.a71.new_soviet.registration; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; -import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; import net.minecraft.block.MapColor; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.piston.PistonBehavior; @@ -15,11 +13,8 @@ import net.minecraft.registry.Registry; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundEvent; import net.minecraft.text.Text; -import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; import su.a71.new_soviet.NewSoviet; import su.a71.new_soviet.blocks.*; import su.a71.new_soviet.entity.TVBlockEntity; @@ -43,24 +38,6 @@ public class NSE_Custom extends NSE_BaseRegistration { public static final SoundEvent ELECTRIC_HIT = SoundEvent.of(new Identifier(NewSoviet.MOD_ID, "electric_hit")); public static final LandMineBlock LANDMINE = new LandMineBlock(FabricBlockSettings.create().mapColor(MapColor.LIGHT_GRAY).offset(AbstractBlock.OffsetType.XZ).dynamicBounds()); - //games - //checkers - public static final CheckerBlock WHITE_CHECKER = new CheckerBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).hardness(0.1f).nonOpaque().mapColor(MapColor.WHITE)); - public static final CheckerBlock BLACK_CHECKER = new CheckerBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).hardness(0.1f).nonOpaque().mapColor(MapColor.BLACK)); - //chess - public static final ChessBlock WHITE_BISHOP = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,8,5,11,9,11), Block.createCuboidShape(5,10,5,11,16,11), Block.createCuboidShape(7,16,7,9,19,9))); - public static final ChessBlock WHITE_KING = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,13,5,11,16,11), Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5.5,7,5.5,10.5,8,10.5))); - public static final ChessBlockKnight WHITE_KNIGHT = new ChessBlockKnight(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque()); - public static final ChessBlock WHITE_PAWN = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5,8,5,11,14,11))); - public static final ChessBlock WHITE_QUEEN = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,13,5,11,16,11), Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5.5,7,5.5,10.5,8,10.5))); - public static final ChessBlock WHITE_ROOK = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.WHITE).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,10,5,11,15,11), Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5.5,7,5.5,10.5,8,10.5))); - - public static final ChessBlock BLACK_BISHOP = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.BLACK).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,8,5,11,9,11), Block.createCuboidShape(5,10,5,11,16,11), Block.createCuboidShape(7,16,7,9,19,9))); - public static final ChessBlock BLACK_KING = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.BLACK).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,13,5,11,16,11), Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5.5,7,5.5,10.5,8,10.5))); - public static final ChessBlockKnight BLACK_KNIGHT = new ChessBlockKnight(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.BLACK).nonOpaque()); - public static final ChessBlock BLACK_PAWN = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.BLACK).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5,8,5,11,14,11))); - public static final ChessBlock BLACK_QUEEN = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.BLACK).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,13,5,11,16,11), Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5.5,7,5.5,10.5,8,10.5))); - public static final ChessBlock BLACK_ROOK = new ChessBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.DECORATED_POT).mapColor(DyeColor.BLACK).nonOpaque(), VoxelShapes.union(Block.createCuboidShape(5,10,5,11,15,11), Block.createCuboidShape(5.5,5,5.5,10.5,6,10.5), Block.createCuboidShape(5.5,7,5.5,10.5,8,10.5))); private static final ItemGroup NSE_CUSTOM_TAB = FabricItemGroup.builder() .icon(() -> new ItemStack(TV)) @@ -79,19 +56,5 @@ public class NSE_Custom extends NSE_BaseRegistration { registerBlock("siren", () -> SIREN, NSE_CUSTOM_TAB); registerBlock("landmine", () -> LANDMINE, NSE_CUSTOM_TAB); registerBlock("switch", () -> SWITCH, NSE_CUSTOM_TAB); - registerBlock("white_checker", () -> WHITE_CHECKER, NSE_CUSTOM_TAB); - registerBlock("black_checker", () -> BLACK_CHECKER, NSE_CUSTOM_TAB); - registerBlock("white_pawn", () -> WHITE_PAWN, NSE_CUSTOM_TAB); - registerBlock("white_queen", () -> WHITE_QUEEN, NSE_CUSTOM_TAB); - registerBlock("white_rook", () -> WHITE_ROOK, NSE_CUSTOM_TAB); - registerBlock("white_knight", () -> WHITE_KNIGHT, NSE_CUSTOM_TAB); - registerBlock("white_bishop", () -> WHITE_BISHOP, NSE_CUSTOM_TAB); - registerBlock("white_king", () -> WHITE_KING, NSE_CUSTOM_TAB); - registerBlock("black_pawn", () -> BLACK_PAWN, NSE_CUSTOM_TAB); - registerBlock("black_queen", () -> BLACK_QUEEN, NSE_CUSTOM_TAB); - registerBlock("black_knight", () -> BLACK_KNIGHT, NSE_CUSTOM_TAB); - registerBlock("black_rook", () -> BLACK_ROOK, NSE_CUSTOM_TAB); - registerBlock("black_bishop", () -> BLACK_BISHOP, NSE_CUSTOM_TAB); - registerBlock("black_king", () -> BLACK_KING, NSE_CUSTOM_TAB); } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Items.java b/src/main/java/su/a71/new_soviet/registration/NSE_Items.java index c456bcd..212e233 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Items.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Items.java @@ -11,7 +11,6 @@ import net.minecraft.util.Identifier; import net.minecraft.util.Rarity; import su.a71.new_soviet.Materials.NSE_ToolMaterials; -import su.a71.new_soviet.items.CigaretteItem; import su.a71.new_soviet.items.DiceItem; import su.a71.new_soviet.items.RakeItem; @@ -31,11 +30,6 @@ public class NSE_Items extends NSE_BaseRegistration { public static final DiceItem DICE_D20 = new DiceItem(20, "item.new_soviet.dice_d20.tooltip", new Item.Settings().maxCount(6)); public static final Item LIGHT_BULB = new Item(new Item.Settings()); - public static final Item CIGARETTE_BUTT = new Item(new Item.Settings()); - - //cigarettes - public static final CigaretteItem CIGARETTE = new CigaretteItem(200, NSE_Items.CIGARETTE_BUTT, "item.new_soviet.tooltip.salute", new Item.Settings()); - // private static final ItemGroup NSE_ITEMS_TAB = FabricItemGroup.builder() .icon(() -> new ItemStack(SICKLE)) @@ -52,7 +46,5 @@ public class NSE_Items extends NSE_BaseRegistration { registerItem("dice_d4", () -> DICE_D4, NSE_ITEMS_TAB); registerItem("dice_d20", () -> DICE_D20, NSE_ITEMS_TAB); registerItem("light_bulb_item", () -> LIGHT_BULB, NSE_ITEMS_TAB); - registerItem("cigarette", ()-> CIGARETTE, NSE_ITEMS_TAB); - registerItem("cigarette_butt", ()-> CIGARETTE_BUTT, NSE_ITEMS_TAB); } } diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java b/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java index 35a3713..c29db12 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java +++ b/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java @@ -27,13 +27,6 @@ public class NSE_Sounds extends NSE_BaseRegistration { public static SoundEvent ITEM_RAKE_TILL = registerSoundEvent("item_rake_till"); - public static SoundEvent SMOKING = registerSoundEvent("smoking"); - public static SoundEvent CIGARETTE_RESTART = registerSoundEvent("cigarette_restart"); - public static SoundEvent CIGARETTE_RANDOM = registerSoundEvent("cigarette_random"); - public static SoundEvent CIGARETTE_STOPPED = registerSoundEvent("cigarette_stopped"); - public static SoundEvent CIGARETTE_START = registerSoundEvent("cigarette_start"); - public static SoundEvent CIGARETTE_PAUSE = registerSoundEvent("cigarette_pause"); - public static final SoundEvent SIREN_SOUND = registerSoundEvent("siren_sound"); public static final SoundEvent LIGHT_BULB_BROKEN_SOUND = registerSoundEvent("light_bulb_broken_sound"); diff --git a/src/main/java/su/a71/new_soviet/util/Shapes.java b/src/main/java/su/a71/new_soviet/util/Shapes.java deleted file mode 100644 index f589d62..0000000 --- a/src/main/java/su/a71/new_soviet/util/Shapes.java +++ /dev/null @@ -1,199 +0,0 @@ -package su.a71.new_soviet.util; - -import net.minecraft.block.Block; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; - -import java.util.ArrayList; -import java.util.List; - -public class Shapes { - public static class NHShape{ - private VoxelShape NORTH; - private VoxelShape WEST; - private VoxelShape SOUTH; - private VoxelShape EAST; - private double minX; - private double minY; - private double minZ; - private double maxX; - private double maxY; - private double maxZ; - - public NHShape(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - this.minX = minX; - this.minY = minY; - this.minZ = minZ; - this.maxX = maxX; - this.maxY = maxY; - this.maxZ = maxZ; - this.NORTH = Block.createCuboidShape(minX, minY, minZ, maxX, maxY, maxZ); - this.WEST = Block.createCuboidShape(minZ, minY, minX, maxZ, maxY, maxX); - this.SOUTH = Block.createCuboidShape(minX, minY, (16 - maxZ), maxX, maxY, (16 - minZ)); - this.EAST = Block.createCuboidShape((16 - maxZ), minY, minX, (16 - minZ), maxY, maxX); - } - - public VoxelShape north(){ - return NORTH; - } - - public VoxelShape west(){ - return WEST; - } - - public VoxelShape south(){ - return SOUTH; - } - - public VoxelShape east(){ - return EAST; - } - } - - public static class NHShape2{ - private VoxelShape NORTH; - private VoxelShape WEST; - private VoxelShape SOUTH; - private VoxelShape EAST; - private double minX; - private double minY; - private double minZ; - private double maxX; - private double maxY; - private double maxZ; - - public NHShape2(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - this.minX = minX; - this.minY = minY; - this.minZ = minZ; - this.maxX = maxX; - this.maxY = maxY; - this.maxZ = maxZ; - this.NORTH = Block.createCuboidShape((16 - maxX), minY, minZ, (16 - minX), maxY, maxZ); - this.WEST = Block.createCuboidShape(minZ, minY, minX, maxZ, maxY, maxX); - this.SOUTH = Block.createCuboidShape(minX, minY, (16 - maxZ), maxX, maxY, (16 - minZ)); - this.EAST = Block.createCuboidShape((16 - maxZ), minY, (16 - maxX), (16 - minZ), maxY, (16 - minX)); - } - - public VoxelShape north(){ - return NORTH; - } - - public VoxelShape west(){ - return WEST; - } - - public VoxelShape south(){ - return SOUTH; - } - - public VoxelShape east(){ - return EAST; - } - } - - public static class HorizontalShape{ - private List ShapesListN; - private List ShapesListS; - private List ShapesListW; - private List ShapesListE; - public HorizontalShape(List> list) { - this.ShapesListN = new ArrayList<>(); - this.ShapesListS = new ArrayList<>(); - this.ShapesListW = new ArrayList<>(); - this.ShapesListE = new ArrayList<>(); - for (List i : list) { - NHShape shape = new NHShape(i.get(0), i.get(1), i.get(2), i.get(3), i.get(4), i.get(5)); - ShapesListN.add(shape.north()); - ShapesListS.add(shape.south()); - ShapesListW.add(shape.west()); - ShapesListE.add(shape.east()); - } - } - - public VoxelShape north() { - VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0); - for (int i=0;i> list) { - this.ShapesListN = new ArrayList<>(); - this.ShapesListS = new ArrayList<>(); - this.ShapesListW = new ArrayList<>(); - this.ShapesListE = new ArrayList<>(); - for (List i : list) { - NHShape2 shape = new NHShape2(i.get(0), i.get(1), i.get(2), i.get(3), i.get(4), i.get(5)); - ShapesListN.add(shape.north()); - ShapesListS.add(shape.south()); - ShapesListW.add(shape.west()); - ShapesListE.add(shape.east()); - } - } - - public VoxelShape north() { - VoxelShape shape = Block.createCuboidShape(0, 0,0,0,0,0); - for (int i=0;i