diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..cd7a044 --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1,5 @@ +Изменения от изначальной загрузки + +* правила пирата номер 1, никогда не говори что украл. "Лицензию" звуков убрал +* вернул улучшенную мину +* SwitchBlock это на 90% LeverBlock, добавил иерархию ООП. Также починил пару вещей связанных с ним. diff --git a/TODO.md b/TODO.md index 3ef5f90..5f2ff0d 100644 --- a/TODO.md +++ b/TODO.md @@ -1,16 +1,38 @@ -=== Andrew71 agenda (14.08.23) === -* Minotaur publishing -* Fix GitHub mirror -* Make good README.md stuff -* Revise all new code for issues +# Блоки и функционал +## Высокий приоритет +Это критично прямо сейчас +* Добавить коричневые, жёлтые, красные и зелёные блоки. +* Сделать datagen для ступеней и полублоков, затем добавить их -=== STUFF TO ADD/FIX === +## Средний приоритет +Нужно до 1.0, но не полностью ломает мод +* Механика окон +* Двери с ключами +* Духовка + +## Низкий приоритет +* Терминал + + +=== ADD BLOCKS/FEATURES === +* Add brown+yellow+red+green blocks * Add slab and stair variations -* Add fences +* Add doors and fences * Add windows * Add (with functionality) present appliance/furniture/electronics textures +* Figure out what to do with "NII wall", nii floor, tilled block * Add achievement criterion for dice and advancements -* PO2 wall (fix) + +=== FIX STUFF === +* PO2 wall +* Crate (likely cheap shulker box with small capacity) + +=== NON-GAME CHANGES === +* Minotaur publishing to modrinth and something similar for curse +* git.a71.su maven +* Good README.md and icon, assets, screenshots etc. === ACHIEVEMENTS === -Kolkhoz warrior - kill a zombie, skeleton, creeper and spider with a sickle \ No newline at end of file +Kolkhoz warrior - kill a zombie, skeleton, creeper and spider with a sickle + +=== Блоки и функционал === diff --git a/build.gradle b/build.gradle index f6111f4..70c84cb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,6 @@ plugins { id 'fabric-loom' version '1.2-SNAPSHOT' id 'maven-publish' - - id "com.modrinth.minotaur" version "2.+" } version = project.mod_version @@ -81,7 +79,7 @@ jar { } } -// Configure the maven publication +// configure the maven publication publishing { publications { mavenJava(MavenPublication) { @@ -91,23 +89,9 @@ publishing { // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { - } -} - -// Publishing to Modrinth -modrinth { - token = System.getenv(modrinth_token) // DO NOT REVEAL THE TOKEN!!! - projectId = mod_id - versionNumber = mod_version - versionType = "beta" // `release`, `beta`, `alpha` - uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`! - gameVersions = ["1.20", "1.20.1"] - loaders = ["fabric"] - dependencies { - // scope.type - // The scope can be `required`, `optional`, `incompatible`, or `embedded` - // The type can either be `project` or `version` - required.project "fabric-api" // Creates a new required dependency on Fabric API -// optional.version "sodium", "mc1.19.3-0.4.8" // Creates a new optional dependency on this specific version of Sodium + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ad52bad..ff6c045 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,4 @@ maven_group=su.a71 mod_id=new_soviet # Dependencies -fabric_version=0.83.0+1.20.1 - -# Modrinth publishing -modrinth_token=tokenhere \ No newline at end of file +fabric_version=0.83.0+1.20.1 \ No newline at end of file diff --git a/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java b/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java index 4d9c5e9..4ce9e74 100644 --- a/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java +++ b/src/client/java/su/a71/new_soviet/TVBlockEntityRenderer.java @@ -2,65 +2,21 @@ package su.a71.new_soviet; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.minecraft.block.BlockState; -import net.minecraft.block.SignBlock; -import net.minecraft.block.entity.SignText; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.entity.BlockEntityRenderer; import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.SignBlockEntityRenderer; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.OrderedText; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import org.joml.Matrix4f; import su.a71.new_soviet.entity.TVBlockEntity; -import java.util.List; - @Environment(EnvType.CLIENT) public class TVBlockEntityRenderer implements BlockEntityRenderer { - 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(); - } + public TVBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {} @Override public void render(TVBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { matrices.push(); // Rendering stuff here -// this.setTextAngles(matrices, true, TEXT_OFFSET); -// textRenderer.draw("Test amogus", 0, 0, 999999, false, matrices.peek().getPositionMatrix(), vertexConsumers, TextRenderer.TextLayerType.POLYGON_OFFSET, 19999, light); matrices.pop(); - - } - - public float getScale() { - return 0.6666667F; - } - - - void setAngles(MatrixStack matrices, float rotationDegrees, BlockState state) { - matrices.translate(0.5F, 0.75F * this.getScale(), 0.5F); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationDegrees)); - if (!(state.getBlock() instanceof SignBlock)) { - matrices.translate(0.0F, -0.3125F, -0.4375F); - } - } - - private void setTextAngles(MatrixStack matrices, boolean front, Vec3d translation) { - if (!front) { - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180.0F)); - } - - float f = 0.015625F * this.getScale(); - matrices.translate(translation.x, translation.y, translation.z); - matrices.scale(f, -f, f); } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/Config.java b/src/main/java/su/a71/new_soviet/Config.java deleted file mode 100644 index 2bf1ac9..0000000 --- a/src/main/java/su/a71/new_soviet/Config.java +++ /dev/null @@ -1,55 +0,0 @@ -package su.a71.new_soviet; - -import java.io.*; - -public class Config { - private boolean invert_lamps = false; - - public static Config INSTANCE; - - public Config() { - INSTANCE = this; - } - - public boolean shouldInvertLamps() { - return invert_lamps; - } - - - private static void generateDefault() { - File file = new File("config/new_soviet.json"); - if(!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - INSTANCE = new Config(); - try { - FileWriter writer = new FileWriter(file); - writer.write(NewSoviet.GSON.toJson(INSTANCE)); - writer.close(); - } catch (Exception e) { - INSTANCE = new Config(); - } - - } - - public static void load() { - // Generate config if it doesn't exist - File file = new File("config/new_soviet.json"); - if(!file.exists()) { - generateDefault(); - } - - try { - BufferedReader reader = new BufferedReader(new FileReader(file)); - StringBuilder sb = new StringBuilder(); - String s; - while((s = reader.readLine()) != null) - sb.append(s); - reader.close(); - - INSTANCE = NewSoviet.GSON.fromJson(sb.toString(), Config.class); - } catch(Exception e) { - INSTANCE = new Config(); - } - } -} diff --git a/src/main/java/su/a71/new_soviet/Materials/NSE_ToolMaterials.java b/src/main/java/su/a71/new_soviet/Materials/NSE_ToolMaterials.java index 213d571..09334b9 100644 --- a/src/main/java/su/a71/new_soviet/Materials/NSE_ToolMaterials.java +++ b/src/main/java/su/a71/new_soviet/Materials/NSE_ToolMaterials.java @@ -4,6 +4,7 @@ import net.fabricmc.yarn.constants.MiningLevels; import net.minecraft.item.Items; import net.minecraft.item.ToolMaterial; import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.tag.ItemTags; import net.minecraft.util.Lazy; import java.util.function.Supplier; diff --git a/src/main/java/su/a71/new_soviet/NewSoviet.java b/src/main/java/su/a71/new_soviet/NewSoviet.java index 3fab95f..bd22de2 100644 --- a/src/main/java/su/a71/new_soviet/NewSoviet.java +++ b/src/main/java/su/a71/new_soviet/NewSoviet.java @@ -26,8 +26,6 @@ public class NewSoviet implements ModInitializer { @Override public void onInitialize() { - Config.load(); - NSE_Blocks.init(); NSE_Items.init(); NSE_Custom.init(); 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..16f8838 100644 --- a/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/CeilingFanBlock.java @@ -19,6 +19,8 @@ import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; +import net.minecraft.block.RedstoneLampBlock; +import net.minecraft.block.TorchBlock; import org.jetbrains.annotations.Nullable; public class CeilingFanBlock extends Block implements Waterloggable { diff --git a/src/main/java/su/a71/new_soviet/blocks/LampBlock.java b/src/main/java/su/a71/new_soviet/blocks/LampBlock.java index 65b4787..510799e 100644 --- a/src/main/java/su/a71/new_soviet/blocks/LampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/LampBlock.java @@ -2,49 +2,33 @@ 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.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.ActionResult; -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.util.shape.VoxelShapes; 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; -import su.a71.new_soviet.Config; + +import java.util.function.ToIntFunction; public class LampBlock extends Block implements Waterloggable { - public static final BooleanProperty ON; - public static final BooleanProperty INVERTED; + public static final BooleanProperty HANGING; public static final BooleanProperty WATERLOGGED; - protected static final VoxelShape SHAPE; + protected static final VoxelShape STANDING_SHAPE; + protected static final VoxelShape HANGING_SHAPE; public LampBlock(AbstractBlock.Settings settings) { - super(settings.luminance((BlockState state) -> { - if (!state.get(INVERTED)) { - return state.get(ON) ? 12 : 0; - } else { - return state.get(ON) ? 0 : 12; - } - })); - this.setDefaultState(this.stateManager.getDefaultState() - .with(INVERTED, false) - .with(WATERLOGGED, false) - .with(ON, false)); + super(settings.luminance((BlockState state) -> 12)); + this.setDefaultState(this.stateManager.getDefaultState().with(HANGING, false).with(WATERLOGGED, false)); } @Nullable @@ -53,9 +37,7 @@ public class LampBlock extends Block implements Waterloggable { Direction[] directions = ctx.getPlacementDirections(); for (Direction direction : directions) { if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState() - .with(INVERTED, Config.INSTANCE.shouldInvertLamps()) - .with(ON, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())); + BlockState blockState = this.getDefaultState().with(HANGING, direction == Direction.UP); if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); } @@ -64,19 +46,12 @@ public class LampBlock extends Block implements Waterloggable { return null; } - @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (world.isClient) return super.onUse(state, world, pos, player, hand, hit); -// world.setBlockState(pos, state.cycle(INVERTED)); - return super.onUse(state, world, pos, player, hand, hit); - } - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return SHAPE; + return state.get(HANGING) ? HANGING_SHAPE : STANDING_SHAPE; } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{ON, WATERLOGGED, INVERTED}); + builder.add(new Property[]{HANGING, WATERLOGGED}); } public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { @@ -85,7 +60,7 @@ public class LampBlock extends Block implements Waterloggable { } protected static Direction attachedDirection(BlockState state) { - return Direction.UP; + return state.get(HANGING) ? Direction.DOWN : Direction.UP; } public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { @@ -93,7 +68,7 @@ public class LampBlock extends Block implements Waterloggable { world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } - return Direction.DOWN == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); + return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } public FluidState getFluidState(BlockState state) { @@ -104,23 +79,14 @@ public class LampBlock extends Block implements Waterloggable { return false; } - public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { - if (!world.isClient) { - boolean bl = (Boolean)state.get(ON); - if (bl != world.isReceivingRedstonePower(pos)) { - if (bl) { - world.scheduleBlockTick(pos, this, 4); - } else { - world.setBlockState(pos, (BlockState)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); - } + public static VoxelShape getHangingShape(){ + VoxelShape shape = VoxelShapes.empty(); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.34375, -0.221875, 0.34375, 0.65625, 0.090625, 0.65625)); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.125, 0.0625, 0.125, 0.875, 0.4375, 0.875)); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.5, 0.5, 0.125, 0.5, 0.875, 0.875)); + shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.125, 0.5, 0.5, 0.875, 0.875, 0.5)); + shape.simplify(); + return shape; } public static VoxelShape getStandingShape(){ @@ -134,9 +100,9 @@ public class LampBlock extends Block implements Waterloggable { } static { - SHAPE = getStandingShape(); - ON = RedstoneTorchBlock.LIT; + HANGING = Properties.HANGING; WATERLOGGED = Properties.WATERLOGGED; - INVERTED = Properties.INVERTED; + STANDING_SHAPE = getStandingShape(); + HANGING_SHAPE = getHangingShape(); } } \ 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..a519d6f 100644 --- a/src/main/java/su/a71/new_soviet/blocks/LandMineBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/LandMineBlock.java @@ -23,10 +23,10 @@ import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import net.minecraft.world.explosion.Explosion; - import org.jetbrains.annotations.Nullable; import su.a71.new_soviet.NewSoviet; + public class LandMineBlock extends HorizontalFacingBlock implements Waterloggable { public static final BooleanProperty WATERLOGGED; protected static final VoxelShape SHAPE; diff --git a/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java b/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java index ff74e32..d72d240 100644 --- a/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/LightBulbBlock.java @@ -1,6 +1,7 @@ package su.a71.new_soviet.blocks; import net.minecraft.block.*; +import net.minecraft.particle.DustParticleEffect; import net.minecraft.text.Text; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.ProjectileEntity; @@ -25,35 +26,20 @@ 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; -import su.a71.new_soviet.Config; import su.a71.new_soviet.NewSoviet; import su.a71.new_soviet.registration.NSE_Custom; import su.a71.new_soviet.registration.NSE_Items; -import su.a71.new_soviet.registration.NSE_Sounds; public class LightBulbBlock extends Block implements Waterloggable { protected static final VoxelShape SHAPE; public static final BooleanProperty ON; - public static final BooleanProperty INVERTED; public static final BooleanProperty BROKEN; public static final BooleanProperty WATERLOGGED; public LightBulbBlock(Block.Settings settings) { - super(settings.luminance(((BlockState state) -> { - if (state.get(BROKEN)) return 0; - if (!state.get(INVERTED)) { - return state.get(ON) ? 12 : 0; - } else { - return state.get(ON) ? 0 : 12; - } - }))); - this.setDefaultState((BlockState)this.getDefaultState() - .with(ON, false) - .with(BROKEN, false) - .with(WATERLOGGED, false) - .with(INVERTED, false)); + super(settings.luminance((BlockState state) -> state.get(ON) && !state.get(BROKEN) ? 12 : 0)); + this.setDefaultState((BlockState)this.getDefaultState().with(ON, false).with(BROKEN, false).with(WATERLOGGED, false)); } @Nullable @@ -61,7 +47,6 @@ public class LightBulbBlock extends Block implements Waterloggable { return (BlockState)this.getDefaultState() .with(ON, ctx.getWorld().isReceivingRedstonePower(ctx.getBlockPos())) .with(BROKEN, false) - .with(INVERTED, Config.INSTANCE.shouldInvertLamps()) .with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); } @@ -86,30 +71,26 @@ public class LightBulbBlock extends Block implements Waterloggable { return direction == Direction.UP && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } + @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (world.isClient) return super.onUse(state, world, pos, player, hand, hit); -// if (!state.get(BROKEN)) { -// world.setBlockState(pos, state.cycle(INVERTED)); -// return ActionResult.CONSUME; -// } - - if (state.get(BROKEN) && player.getInventory().getMainHandStack().getItem() == NSE_Items.LIGHT_BULB && !player.getItemCooldownManager().isCoolingDown(NSE_Items.LIGHT_BULB)) { - if (world.isReceivingRedstonePower(pos) == state.get(INVERTED) || (NewSoviet.RANDOM.nextBetween(1, 32) == 1)) { + if (!world.isClient && state.get(BROKEN) && player.getInventory().getMainHandStack().getItem() == NSE_Items.LIGHT_BULB && !world.isReceivingRedstonePower(pos)) { + if (!player.isCreative()) + player.getInventory().getMainHandStack().decrement(1); + world.setBlockState(pos, (BlockState)state.with(BROKEN, false)); + //.with(ON, world.isReceivingRedstonePower(pos)), 2); + } else if (!world.isClient && state.get(BROKEN) && player.getInventory().getMainHandStack().getItem() == NSE_Items.LIGHT_BULB) { + player.sendMessage(Text.translatable("block.new_soviet.light_bulb_block.energized")); + world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Custom.ELECTRIC_HIT, SoundCategory.AMBIENT, 0.8f, 1f); + if (!player.isCreative()) { + player.heal(-1 * NewSoviet.RANDOM.nextBetween(1, 4)); + } + if (NewSoviet.RANDOM.nextBetween(1, 32) == 1){ if (!player.isCreative()) player.getInventory().getMainHandStack().decrement(1); - world.setBlockState(pos, (BlockState)state.with(BROKEN, false)); - return ActionResult.CONSUME; - } else { - player.getItemCooldownManager().set(NSE_Items.LIGHT_BULB, 10); - player.sendMessage(Text.translatable("block.new_soviet.light_bulb_block.energized")); - world.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Custom.ELECTRIC_HIT, SoundCategory.AMBIENT, 0.8f, 1f); - if (!player.isCreative()) { - player.damage(world.getDamageSources().lightningBolt(), NewSoviet.RANDOM.nextBetween(1, 4)); - } + world.setBlockState(pos, (BlockState)state.with(BROKEN, false) + .with(ON, world.isReceivingRedstonePower(pos)), 2); } - return ActionResult.CONSUME; } - return super.onUse(state, world, pos, player, hand, hit); } @@ -117,9 +98,9 @@ public class LightBulbBlock extends Block implements Waterloggable { @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((PlayerEntity)null, hit.getBlockPos().getX(), hit.getBlockPos().getY(), hit.getBlockPos().getZ(), NSE_Custom.LIGHT_BULB_BROKEN_SOUND, SoundCategory.NEUTRAL, 0.8f, 1f); } - world.setBlockState(hit.getBlockPos(), (BlockState)state.with(BROKEN, true), 2); + world.setBlockState(hit.getBlockPos(), (BlockState)state.with(BROKEN, true).with(ON, false), 2); super.onProjectileHit(world, state, hit, projectile); } @@ -130,7 +111,7 @@ public class LightBulbBlock extends Block implements Waterloggable { } protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{ON, BROKEN, WATERLOGGED, INVERTED}); + builder.add(new Property[]{ON, BROKEN, WATERLOGGED}); } public FluidState getFluidState(BlockState state) { @@ -155,6 +136,5 @@ public class LightBulbBlock extends Block implements Waterloggable { ON = RedstoneTorchBlock.LIT; BROKEN = Properties.CRACKED; WATERLOGGED = Properties.WATERLOGGED; - INVERTED = Properties.INVERTED; } } \ No newline at end of file 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..9368d05 100644 --- a/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/SirenBlock.java @@ -19,11 +19,11 @@ import net.minecraft.util.math.random.Random; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; + import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; - -import su.a71.new_soviet.registration.NSE_Sounds; +import su.a71.new_soviet.registration.NSE_Custom; public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { public static final BooleanProperty ON; @@ -46,7 +46,7 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { 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.playSound((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Custom.SIREN_SOUND, SoundCategory.NEUTRAL, getSirenVolume(world, pos), 1f); world.setBlockState(pos, (BlockState)state.cycle(ON), 2); world.scheduleBlockTick(pos, this, 140); } @@ -90,7 +90,7 @@ public class SirenBlock extends HorizontalFacingBlock implements Waterloggable { if ((Boolean)state.get(ON) && !world.isReceivingRedstonePower(pos)) { world.setBlockState(pos, (BlockState)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((PlayerEntity)null, pos.getX(), pos.getY(), pos.getZ(), NSE_Custom.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..78d0892 100644 --- a/src/main/java/su/a71/new_soviet/blocks/StoveBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/StoveBlock.java @@ -16,7 +16,6 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; - import org.jetbrains.annotations.Nullable; public class StoveBlock extends BlockWithEntity { 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 0a26a95..95dee14 100644 --- a/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/SwitchBlock.java @@ -9,6 +9,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.particle.DustParticleEffect; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.Properties; @@ -22,9 +23,10 @@ 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 net.minecraft.world.event.GameEvent; - -import su.a71.new_soviet.registration.NSE_Sounds; +import su.a71.new_soviet.NewSoviet; +import su.a71.new_soviet.sounds.Sounds; public class SwitchBlock extends LeverBlock { public static final BooleanProperty POWERED = Properties.POWERED; @@ -84,7 +86,7 @@ public class SwitchBlock extends LeverBlock { } BlockState blockState = this.togglePower(state, world, pos); float f = blockState.get(POWERED) != false ? 1f : 0.9f; - world.playSound(null, pos, NSE_Sounds.SWITCH_PRESS, SoundCategory.BLOCKS, 0.6f, f); + world.playSound(null, pos, Sounds.SWITCH_PRESS, SoundCategory.BLOCKS, 0.6f, f); world.emitGameEvent((Entity)player, blockState.get(POWERED) != false ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, pos); return ActionResult.CONSUME; } 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 d350e79..13976c1 100644 --- a/src/main/java/su/a71/new_soviet/blocks/TVBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/TVBlock.java @@ -12,7 +12,6 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; - import su.a71.new_soviet.entity.TVBlockEntity; public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvider { diff --git a/src/main/java/su/a71/new_soviet/entity/TVBlockEntity.java b/src/main/java/su/a71/new_soviet/entity/TVBlockEntity.java index 4cc51e9..1d27136 100644 --- a/src/main/java/su/a71/new_soviet/entity/TVBlockEntity.java +++ b/src/main/java/su/a71/new_soviet/entity/TVBlockEntity.java @@ -1,17 +1,19 @@ package su.a71.new_soviet.entity; +import io.netty.channel.unix.Errors; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.listener.ClientPlayPacketListener; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; import net.minecraft.util.math.BlockPos; - import org.jetbrains.annotations.Nullable; -import java.util.Arrays; import su.a71.new_soviet.registration.NSE_Custom; +import java.util.Arrays; + public class TVBlockEntity extends BlockEntity { /* Digit Color 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 d5bcf22..65ecbaa 100644 --- a/src/main/java/su/a71/new_soviet/items/DiceItem.java +++ b/src/main/java/su/a71/new_soviet/items/DiceItem.java @@ -10,11 +10,11 @@ import net.minecraft.text.Text; import net.minecraft.util.Hand; import net.minecraft.util.TypedActionResult; import net.minecraft.world.World; - import org.jetbrains.annotations.Nullable; -import java.util.List; import su.a71.new_soviet.NewSoviet; -import su.a71.new_soviet.registration.NSE_Sounds; +import su.a71.new_soviet.sounds.Sounds; + +import java.util.List; public class DiceItem extends Item { private final int sides; @@ -32,7 +32,7 @@ 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((PlayerEntity)null, user.getX(), user.getY(), user.getZ(), 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(", "); } 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))); diff --git a/src/main/java/su/a71/new_soviet/items/RakeItem.java b/src/main/java/su/a71/new_soviet/items/RakeItem.java index 5063726..6b37dc1 100644 --- a/src/main/java/su/a71/new_soviet/items/RakeItem.java +++ b/src/main/java/su/a71/new_soviet/items/RakeItem.java @@ -14,13 +14,15 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; import net.minecraft.world.event.GameEvent; -import su.a71.new_soviet.registration.NSE_Sounds; +import su.a71.new_soviet.sounds.Sounds; import su.a71.new_soviet.util.NSE_Tags; import java.util.Map; import java.util.function.Consumer; import java.util.function.Predicate; + + public class RakeItem extends MiningToolItem { protected static final Map, Consumer>> TILLING_ACTIONS = Maps.newHashMap(ImmutableMap.of(Blocks.GRASS_BLOCK, Pair.of(HoeItem::canTillFarmland, RakeItem.createTillAction(Blocks.FARMLAND.getDefaultState())), Blocks.DIRT_PATH, Pair.of(HoeItem::canTillFarmland, RakeItem.createTillAction(Blocks.FARMLAND.getDefaultState())), Blocks.DIRT, Pair.of(HoeItem::canTillFarmland, RakeItem.createTillAction(Blocks.FARMLAND.getDefaultState())), Blocks.COARSE_DIRT, Pair.of(RakeItem::canTillFarmland, RakeItem.createTillAction(Blocks.DIRT.getDefaultState())), Blocks.ROOTED_DIRT, Pair.of(itemUsageContext -> true, RakeItem.createTillAndDropAction(Blocks.DIRT.getDefaultState(), Items.HANGING_ROOTS)))); @@ -39,7 +41,7 @@ public class RakeItem extends MiningToolItem { Consumer consumer = pair.getSecond(); if (predicate.test(context)) { PlayerEntity playerEntity = context.getPlayer(); - world.playSound(playerEntity, blockPos, NSE_Sounds.ITEM_RAKE_TILL, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(playerEntity, blockPos, Sounds.ITEM_RAKE_TILL, SoundCategory.BLOCKS, 1.0f, 1.0f); if (!world.isClient) { consumer.accept(context); if (playerEntity != null) { 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 cb3b029..11a0e49 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 @@ -2,23 +2,18 @@ package su.a71.new_soviet.registration; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; -import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; -import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; +import su.a71.new_soviet.NewSoviet; 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 { @@ -38,17 +33,5 @@ public class NSE_BaseRegistration { registerItem(name, () -> blockItem, tab); } - public static SoundEvent registerSoundEvent(String name) { - Identifier id = new Identifier(NewSoviet.MOD_ID, name); - return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id)); - } - - public static T registerBlockEntity(String name, FabricBlockEntityTypeBuilder.Factory factory, net.minecraft.block.Block... blocks) { - return (T) Registry.register( - Registries.BLOCK_ENTITY_TYPE, - new Identifier(NewSoviet.MOD_ID, name), - FabricBlockEntityTypeBuilder.create(factory, blocks).build()); - } - public static void init() {} } 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 39bcbdf..6d3d88f 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 @@ -14,11 +14,12 @@ import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; import su.a71.new_soviet.blocks.ConcreteWithBarsBlock; +import su.a71.new_soviet.sounds.Sounds; public class NSE_Blocks extends NSE_BaseRegistration { // BUILDING BRICKS/TILES ==================== - public static final Block SAND_TILES = new Block(FabricBlockSettings.create().sounds(NSE_Sounds.SAND_TILES_SOUNDS).hardness(1.5f).requiresTool().resistance(6f).mapColor(MapColor.TERRACOTTA_BROWN)); + public static final Block SAND_TILES = new Block(FabricBlockSettings.create().sounds(Sounds.SAND_TILES_SOUNDS).hardness(1.5f).requiresTool().resistance(6f).mapColor(MapColor.TERRACOTTA_BROWN)); public static final StairsBlock SAND_TILES_STAIRS = new StairsBlock(SAND_TILES.getDefaultState(), FabricBlockSettings.copy(SAND_TILES)); public static final Block CRACKED_SAND_TILES = new Block(FabricBlockSettings.copy(SAND_TILES)); public static final Block MOSSY_SAND_TILES = new Block(FabricBlockSettings.copy(SAND_TILES)); @@ -162,24 +163,24 @@ public class NSE_Blocks extends NSE_BaseRegistration { public static final ConcreteWithBarsBlock GREEN_CONCRETE_WITH_BARS = new ConcreteWithBarsBlock(FabricBlockSettings.copy(WHITE_CONCRETE).mapColor(MapColor.TERRACOTTA_GREEN)); // WOOD/FLOOR ========== - public static final Block HERRINGBONE_ACACIA_PLANKS = new Block(FabricBlockSettings.copy(Blocks.ACACIA_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block CROSS_ACACIA_PLANKS = new Block(FabricBlockSettings.copy(Blocks.ACACIA_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block HERRINGBONE_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.OAK_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block CROSS_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.OAK_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block HERRINGBONE_BIRCH_PLANKS = new Block(FabricBlockSettings.copy(Blocks.BIRCH_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block CROSS_BIRCH_PLANKS = new Block(FabricBlockSettings.copy(Blocks.BIRCH_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block HERRINGBONE_CRIMSON_PLANKS = new Block(FabricBlockSettings.copy(Blocks.CRIMSON_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block CROSS_CRIMSON_PLANKS = new Block(FabricBlockSettings.copy(Blocks.CRIMSON_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block HERRINGBONE_DARK_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.DARK_OAK_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block CROSS_DARK_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.DARK_OAK_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block HERRINGBONE_JUNGLE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.JUNGLE_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block CROSS_JUNGLE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.JUNGLE_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block HERRINGBONE_MANGROVE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.MANGROVE_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block CROSS_MANGROVE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.MANGROVE_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block HERRINGBONE_SPRUCE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.SPRUCE_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); - public static final Block CROSS_SPRUCE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.SPRUCE_PLANKS).sounds(NSE_Sounds.PARQUET_SOUNDS)); + public static final Block HERRINGBONE_ACACIA_PLANKS = new Block(FabricBlockSettings.copy(Blocks.ACACIA_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block CROSS_ACACIA_PLANKS = new Block(FabricBlockSettings.copy(Blocks.ACACIA_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block HERRINGBONE_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.OAK_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block CROSS_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.OAK_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block HERRINGBONE_BIRCH_PLANKS = new Block(FabricBlockSettings.copy(Blocks.BIRCH_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block CROSS_BIRCH_PLANKS = new Block(FabricBlockSettings.copy(Blocks.BIRCH_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block HERRINGBONE_CRIMSON_PLANKS = new Block(FabricBlockSettings.copy(Blocks.CRIMSON_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block CROSS_CRIMSON_PLANKS = new Block(FabricBlockSettings.copy(Blocks.CRIMSON_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block HERRINGBONE_DARK_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.DARK_OAK_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block CROSS_DARK_OAK_PLANKS = new Block(FabricBlockSettings.copy(Blocks.DARK_OAK_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block HERRINGBONE_JUNGLE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.JUNGLE_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block CROSS_JUNGLE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.JUNGLE_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block HERRINGBONE_MANGROVE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.MANGROVE_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block CROSS_MANGROVE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.MANGROVE_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block HERRINGBONE_SPRUCE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.SPRUCE_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); + public static final Block CROSS_SPRUCE_PLANKS = new Block(FabricBlockSettings.copy(Blocks.SPRUCE_PLANKS).sounds(Sounds.PARQUET_SOUNDS)); - public static final Block HERRINGBONE_PARQUET = new Block(FabricBlockSettings.create().sounds(NSE_Sounds.PARQUET_SOUNDS).strength(2f, 3f).mapColor(MapColor.OAK_TAN)); + public static final Block HERRINGBONE_PARQUET = new Block(FabricBlockSettings.create().sounds(Sounds.PARQUET_SOUNDS).strength(2f, 3f).mapColor(MapColor.OAK_TAN)); public static final Block STRAIGHT_PARQUET = new Block(FabricBlockSettings.copy(HERRINGBONE_PARQUET)); public static final Block SEPARATED_PARQUET = new Block(FabricBlockSettings.copy(HERRINGBONE_PARQUET)); @@ -219,12 +220,12 @@ public class NSE_Blocks extends NSE_BaseRegistration { public static final WallBlock CONCRETE_WALL = new WallBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.STONE).mapColor(MapColor.STONE_GRAY)); // WALLPAPER BLOCKS ========== - public static final Block GREEN_WALLPAPER = new Block(FabricBlockSettings.create().sounds(NSE_Sounds.WALLPAPER_BLOCK_SOUNDS).nonOpaque().mapColor(MapColor.DARK_GREEN).hardness(10f)); + public static final Block GREEN_WALLPAPER = new Block(FabricBlockSettings.create().sounds(Sounds.WALLPAPER_BLOCK_SOUNDS).nonOpaque().mapColor(MapColor.DARK_GREEN).hardness(10f)); public static final Block BROWN_WALLPAPER = new Block(FabricBlockSettings.copy(GREEN_WALLPAPER).mapColor(MapColor.BROWN)); public static final Block BEIGE_WALLPAPER = new Block(FabricBlockSettings.copy(GREEN_WALLPAPER).mapColor(MapColor.DIRT_BROWN)); // MEAT (cursed...) ========== - public static final Block MEAT = new Block(FabricBlockSettings.create().velocityMultiplier(0.8f).sounds(NSE_Sounds.MEAT_SOUNDS).nonOpaque().mapColor(MapColor.DARK_RED).hardness(8f)); + public static final Block MEAT = new Block(FabricBlockSettings.create().velocityMultiplier(0.8f).sounds(Sounds.MEAT_SOUNDS).nonOpaque().mapColor(MapColor.DARK_RED).hardness(8f)); public static final Block MEAT_EYE = new Block(FabricBlockSettings.copy(MEAT)); 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()); 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 bd29137..4e3e934 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,6 +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.MapColor; import net.minecraft.block.entity.BlockEntityType; @@ -23,17 +24,22 @@ public class NSE_Custom extends NSE_BaseRegistration { public static final TVBlock TV = new TVBlock(FabricBlockSettings.create().mapColor(MapColor.TERRACOTTA_YELLOW)); public static final TVBlock RED_TV = new TVBlock(FabricBlockSettings.create().mapColor(MapColor.TERRACOTTA_RED)); public static final TVBlock BROWN_TV = new TVBlock(FabricBlockSettings.create().mapColor(MapColor.TERRACOTTA_BROWN)); - public static final BlockEntityType TV_BLOCK_ENTITY = registerBlockEntity("tv_block_entity", TVBlockEntity::new, TV, RED_TV, BROWN_TV); - + public static final BlockEntityType TV_BLOCK_ENTITY = Registry.register( + Registries.BLOCK_ENTITY_TYPE, + new Identifier(NewSoviet.MOD_ID, "tv_block_entity"), + FabricBlockEntityTypeBuilder.create(TVBlockEntity::new, TV, RED_TV, BROWN_TV).build() + ); public static final RadioBlock RADIO = new RadioBlock(); public static final SwitchBlock SWITCH = new SwitchBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).notSolid().pistonBehavior(PistonBehavior.DESTROY).strength(1f, 2f).mapColor(MapColor.TERRACOTTA_WHITE)); public static final LampBlock LAMP = new LampBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.LANTERN).strength(1f, 1.5f).mapColor(MapColor.WHITE)); public static final LightBulbBlock LIGHT_BULB = new LightBulbBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.GLASS).strength(1f, 1.5f).mapColor(MapColor.WHITE)); + public static final SoundEvent LIGHT_BULB_BROKEN_SOUND = SoundEvent.of(new Identifier(NewSoviet.MOD_ID, "light_bulb_broken_sound")); public static final CeilingFanBlock CEILING_FAN = new CeilingFanBlock(FabricBlockSettings.create().sounds(BlockSoundGroup.METAL).strength(1f, 1.5f).mapColor(MapColor.WHITE)); public static final SirenBlock SIREN = new SirenBlock(); + public static final SoundEvent SIREN_SOUND = SoundEvent.of(new Identifier(NewSoviet.MOD_ID, "siren_sound")); public static final SoundEvent ELECTRIC_HIT = SoundEvent.of(new Identifier(NewSoviet.MOD_ID, "electric_hit")); @@ -56,5 +62,8 @@ 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); + + Registry.register(Registries.SOUND_EVENT, new Identifier(NewSoviet.MOD_ID, "siren_sound"), SIREN_SOUND); + Registry.register(Registries.SOUND_EVENT, new Identifier(NewSoviet.MOD_ID, "light_bulb_broken_sound"), LIGHT_BULB_BROKEN_SOUND); } } \ No newline at end of file diff --git a/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java b/src/main/java/su/a71/new_soviet/sounds/Sounds.java similarity index 63% rename from src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java rename to src/main/java/su/a71/new_soviet/sounds/Sounds.java index c29db12..4ea99a0 100644 --- a/src/main/java/su/a71/new_soviet/registration/NSE_Sounds.java +++ b/src/main/java/su/a71/new_soviet/sounds/Sounds.java @@ -1,34 +1,45 @@ -package su.a71.new_soviet.registration; +package su.a71.new_soviet.sounds; +import net.minecraft.block.Blocks; +import net.minecraft.sound.SoundEvents; +import su.a71.new_soviet.NewSoviet; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.SoundEvent; +import net.minecraft.util.Identifier; -public class NSE_Sounds extends NSE_BaseRegistration { +public class Sounds { + //dice sound public static SoundEvent DICE_SOUND = registerSoundEvent("dice_sound"); - + //parquet sounds public static SoundEvent PARQUET_WALK = registerSoundEvent("parquet_walk"); public static final BlockSoundGroup PARQUET_SOUNDS = new BlockSoundGroup(1f, 1f, - BlockSoundGroup.CHERRY_WOOD.getBreakSound(), NSE_Sounds.PARQUET_WALK, BlockSoundGroup.CHERRY_WOOD.getPlaceSound(), - BlockSoundGroup.CHERRY_WOOD.getHitSound(), NSE_Sounds.PARQUET_WALK); + BlockSoundGroup.CHERRY_WOOD.getBreakSound(), Sounds.PARQUET_WALK, BlockSoundGroup.CHERRY_WOOD.getPlaceSound(), + BlockSoundGroup.CHERRY_WOOD.getHitSound(), Sounds.PARQUET_WALK); + //meat sounds public static final BlockSoundGroup MEAT_SOUNDS = new BlockSoundGroup(1f, 1f, BlockSoundGroup.MUD.getBreakSound(), BlockSoundGroup.HONEY.getStepSound(), BlockSoundGroup.MUD.getPlaceSound(), BlockSoundGroup.MUD.getHitSound(), BlockSoundGroup.HONEY.getStepSound()); + //switch sound public static SoundEvent SWITCH_PRESS = registerSoundEvent("switch_press"); + //sand tiles sounds public static final BlockSoundGroup SAND_TILES_SOUNDS = new BlockSoundGroup(1f, 0.8f, BlockSoundGroup.MUD_BRICKS.getBreakSound(), BlockSoundGroup.DECORATED_POT.getStepSound(), BlockSoundGroup.MUD_BRICKS.getPlaceSound(), BlockSoundGroup.MUD_BRICKS.getHitSound(), BlockSoundGroup.DECORATED_POT.getStepSound()); + //wallpaper block sounds public static final BlockSoundGroup WALLPAPER_BLOCK_SOUNDS = new BlockSoundGroup(1f, 0.7f, BlockSoundGroup.BAMBOO_WOOD.getBreakSound(), BlockSoundGroup.WOOL.getStepSound(), BlockSoundGroup.BAMBOO_WOOD.getPlaceSound(), BlockSoundGroup.WOOL.getHitSound(), BlockSoundGroup.WOOL.getStepSound()); - + //rake sound public static SoundEvent ITEM_RAKE_TILL = registerSoundEvent("item_rake_till"); - public static final SoundEvent SIREN_SOUND = registerSoundEvent("siren_sound"); - - public static final SoundEvent LIGHT_BULB_BROKEN_SOUND = registerSoundEvent("light_bulb_broken_sound"); - + private static SoundEvent registerSoundEvent(String name) { + Identifier id = new Identifier(NewSoviet.MOD_ID, name); + return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id)); + } } \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/blockstates/lamp.json b/src/main/resources/assets/new_soviet/blockstates/lamp.json index 985f00c..db8e5dd 100644 --- a/src/main/resources/assets/new_soviet/blockstates/lamp.json +++ b/src/main/resources/assets/new_soviet/blockstates/lamp.json @@ -1,10 +1,10 @@ { "variants": { - "inverted=true": { + "hanging=false": { "model": "new_soviet:block/table_lamp" }, - "inverted=false": { - "model": "new_soviet:block/table_lamp" + "hanging=true": { + "model": "new_soviet:block/ceiling_lamp" } } } \ No newline at end of file diff --git a/src/main/resources/assets/new_soviet/blockstates/light_bulb.json b/src/main/resources/assets/new_soviet/blockstates/light_bulb.json index 5400d8b..e04cfea 100644 --- a/src/main/resources/assets/new_soviet/blockstates/light_bulb.json +++ b/src/main/resources/assets/new_soviet/blockstates/light_bulb.json @@ -1,27 +1,15 @@ { "variants": { - "lit=true,cracked=true,inverted=false": { + "lit=true,cracked=true": { "model": "new_soviet:block/light_bulb_broken" }, - "lit=true,cracked=false,inverted=false": { + "lit=true,cracked=false": { "model": "new_soviet:block/light_bulb_on" }, - "lit=false,cracked=false,inverted=false": { + "lit=false,cracked=false": { "model": "new_soviet:block/light_bulb_off" }, - "lit=false,cracked=true,inverted=false": { - "model": "new_soviet:block/light_bulb_broken" - }, - "lit=true,cracked=true,inverted=true": { - "model": "new_soviet:block/light_bulb_broken" - }, - "lit=true,cracked=false,inverted=true": { - "model": "new_soviet:block/light_bulb_off" - }, - "lit=false,cracked=false,inverted=true": { - "model": "new_soviet:block/light_bulb_on" - }, - "lit=false,cracked=true,inverted=true": { + "lit=false,cracked=true": { "model": "new_soviet:block/light_bulb_broken" } } diff --git a/src/main/resources/assets/new_soviet/icon.png b/src/main/resources/assets/new_soviet/icon.png deleted file mode 100644 index 0260f1d..0000000 Binary files a/src/main/resources/assets/new_soviet/icon.png and /dev/null differ diff --git a/src/main/resources/assets/new_soviet/lang/en_us.json b/src/main/resources/assets/new_soviet/lang/en_us.json index fb9b238..6c06512 100644 --- a/src/main/resources/assets/new_soviet/lang/en_us.json +++ b/src/main/resources/assets/new_soviet/lang/en_us.json @@ -204,6 +204,5 @@ "block.new_soviet.brown_wallpaper": "Brown Wallpaper Block", "block.new_soviet.beige_wallpaper": "Beige Wallpaper Block", "block.new_soviet.purple_goo": "Purple Goo", - "subtitles.new_soviet.switch_press": "Switch clicks", - "subtitles.new_soviet.electric_hit": "Electric sparks" + "subtitles.new_soviet.switch_press": "Switch clicks" } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 071a2a5..b64ff1e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -12,7 +12,7 @@ "homepage": "https://nse.a71.su/", "sources": "https://git.a71.su/Ethyl/New-Soviet-Era" }, - "license": "Mixed: All rights reserved assets & MIT code", + "license": "All rights reserved", "icon": "assets/new_soviet/icon.png", "environment": "*", "entrypoints": { @@ -31,14 +31,5 @@ "minecraft": "~1.20.1", "java": ">=17", "fabric-api": "*" - }, - - "custom": { - "modmenu": { - "links": { - "modmenu.discord": "https://discord.gg/D46vGJeCfj" - }, - "update_checker": true - } } } \ No newline at end of file