diff --git a/CHANGELOG b/CHANGELOG index f64eb24..8c7bb4a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,6 +32,7 @@ This version focuses on QOL and bug fixes * Added Russian (ru_ru) and pre-reform Russian (ru_rpr) translations * Added missing warped, cherry and bamboo planks +* Added unique sounds for TV being turned on/off and broken. * Added many of the missing recipes * Removed ability to cut blocks back into original form on stone-cutter * Added button to open config file when using Mod Menu @@ -39,9 +40,11 @@ This version focuses on QOL and bug fixes * Minor bug fixes * Added some dedicated particle textures * Fixed issue with some blocks being non opaque - * Fixed TV's hit-box + * Fixed TVs' hit-boxes * Switches no longer emit redstone particle * Slightly improved cigarette's GUI model + * Light bulb lamp now makes a sound when repaired + * TV can now be repaired with a glass pane (breaking and re-placing still works for now) * Technical changes * Simplified recipe data generation * Deleted various unused files - code, textures and models \ 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 51c7bcd..63f963d 100644 --- a/src/main/java/su/a71/new_soviet/blocks/TVBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/TVBlock.java @@ -11,6 +11,7 @@ import net.minecraft.item.ItemPlacementContext; import net.minecraft.server.world.ServerWorld; 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; @@ -26,7 +27,9 @@ import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; +import su.a71.new_soviet.NewSoviet; import su.a71.new_soviet.entities.TVBlockEntity; +import su.a71.new_soviet.registration.NSE_Items; import su.a71.new_soviet.registration.NSE_Sounds; import su.a71.new_soviet.util.Shapes; @@ -87,18 +90,29 @@ public class TVBlock extends HorizontalFacingBlock implements BlockEntityProvide @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + if (state.get(BROKEN) && player.getInventory().getMainHandStack().getItem() == Blocks.GLASS_PANE.asItem()) { + if (!player.isCreative()) + player.getInventory().getMainHandStack().decrement(1); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_GLASS_PLACE, SoundCategory.BLOCKS, 0.8f, 1f); + world.setBlockState(pos, state.with(BROKEN, false)); + return ActionResult.SUCCESS; + } if (!world.isClient) { world.setBlockState(pos, state.cycle(INVERTED), 2); } - float f = state.get(ON) ? 1f : 0.9f; - world.playSound(null, pos, NSE_Sounds.SWITCH_PRESS, SoundCategory.BLOCKS, 0.6f, f); + BlockState newState = world.getBlockState(pos); + if (newState.get(ON) != newState.get(INVERTED)) { + world.playSound(null, pos, NSE_Sounds.TV_ON_SOUND, SoundCategory.BLOCKS, 0.6f, 1f); + } else { + world.playSound(null, pos, NSE_Sounds.TV_OFF_SOUND, SoundCategory.BLOCKS, 0.6f, 1f); + } return ActionResult.SUCCESS; } @Override public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { if (!state.get(BROKEN)) { - world.playSound(null, hit.getBlockPos().getX(), hit.getBlockPos().getY(), hit.getBlockPos().getZ(), NSE_Sounds.LIGHT_BULB_BROKEN_SOUND, SoundCategory.BLOCKS, 0.8f, 1f); + world.playSound(null, hit.getBlockPos().getX(), hit.getBlockPos().getY(), hit.getBlockPos().getZ(), NSE_Sounds.TV_BREAK_SOUND, SoundCategory.BLOCKS, 0.8f, 1f); } world.setBlockState(hit.getBlockPos(), state.with(BROKEN, true), 2); super.onProjectileHit(world, state, hit, projectile); diff --git a/src/main/java/su/a71/new_soviet/blocks/lamps/LightBulbLampBlock.java b/src/main/java/su/a71/new_soviet/blocks/lamps/LightBulbLampBlock.java index ed0e319..377ed41 100644 --- a/src/main/java/su/a71/new_soviet/blocks/lamps/LightBulbLampBlock.java +++ b/src/main/java/su/a71/new_soviet/blocks/lamps/LightBulbLampBlock.java @@ -1,6 +1,7 @@ package su.a71.new_soviet.blocks.lamps; import net.minecraft.block.*; +import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.ProjectileEntity; @@ -55,6 +56,7 @@ public class LightBulbLampBlock extends LampBlock { if (world.isReceivingRedstonePower(pos) == state.get(INVERTED) || (NewSoviet.RANDOM.nextBetween(1, 32) == 1)) { if (!player.isCreative()) player.getInventory().getMainHandStack().decrement(1); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.BLOCK_GLASS_PLACE, SoundCategory.BLOCKS, 0.8f, 1f); world.setBlockState(pos, state.with(BROKEN, false)); return ActionResult.SUCCESS; } else { 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 46d3c78..ce116fd 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 @@ -41,9 +41,11 @@ public class NSE_Sounds extends NSE_BaseRegistration { public static final SoundEvent WOOP_SIREN_SOUND = registerSoundEvent("woop_siren_sound"); public static final SoundEvent CLOISTER_SIREN_SOUND = registerSoundEvent("cloister_siren_sound"); - public static final SoundEvent ELECTRIC_HIT = SoundEvent.of(new Identifier(NewSoviet.MOD_ID, "electric_hit")); public static final SoundEvent LIGHT_BULB_BROKEN_SOUND = registerSoundEvent("light_bulb_broken_sound"); + public static final SoundEvent TV_ON_SOUND = registerSoundEvent("tv_on_sound"); + public static final SoundEvent TV_OFF_SOUND = registerSoundEvent("tv_off_sound"); + public static final SoundEvent TV_BREAK_SOUND = registerSoundEvent("tv_break_sound"); } \ No newline at end of file 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 6039731..bed62bb 100644 --- a/src/main/resources/assets/new_soviet/lang/en_us.json +++ b/src/main/resources/assets/new_soviet/lang/en_us.json @@ -484,6 +484,9 @@ "block.new_soviet.herringbone_bamboo_planks": "Herringbone Bamboo Planks", "block.new_soviet.herringbone_bamboo_planks_stairs": "Herringbone Bamboo Planks Stairs", "block.new_soviet.herringbone_bamboo_planks_slab": "Herringbone Bamboo Planks Slab", + "subtitles.new_soviet.tv_on": "TV turned on", + "subtitles.new_soviet.tv_off": "TV turned off", + "subtitles.new_soviet.tv_break": "TV screen shattered", "advancement.new_soviet.root.name": "A New Era", "advancement.new_soviet.root.desc": "Time to create something great", diff --git a/src/main/resources/assets/new_soviet/lang/rpr.json b/src/main/resources/assets/new_soviet/lang/rpr.json index fdeb78a..9e4ff32 100644 --- a/src/main/resources/assets/new_soviet/lang/rpr.json +++ b/src/main/resources/assets/new_soviet/lang/rpr.json @@ -484,6 +484,9 @@ "block.new_soviet.herringbone_bamboo_planks": "Бамбуковый паркѣт «ёлочкой»", "block.new_soviet.herringbone_bamboo_planks_stairs": "Ступѣнi из бамбукового паркѣта «ёлочкой»", "block.new_soviet.herringbone_bamboo_planks_slab": "Плита из бамбукового паркѣта «ёлочкой»", + "subtitles.new_soviet.tv_on": "Включается тѣлѣвизоръ", + "subtitles.new_soviet.tv_off": "Выключается тѣлѣвизоръ", + "subtitles.new_soviet.tv_break": "Разбитъ экранъ тѣлѣвизора", "advancement.new_soviet.root.name": "Новыя эра!", "advancement.new_soviet.root.desc": "Врѣмя совѣршать вѣликое!", diff --git a/src/main/resources/assets/new_soviet/lang/ru_ru.json b/src/main/resources/assets/new_soviet/lang/ru_ru.json index 09e78cf..132ec19 100644 --- a/src/main/resources/assets/new_soviet/lang/ru_ru.json +++ b/src/main/resources/assets/new_soviet/lang/ru_ru.json @@ -484,6 +484,9 @@ "block.new_soviet.herringbone_bamboo_planks": "Бамбуковый паркет «ёлочкой»", "block.new_soviet.herringbone_bamboo_planks_stairs": "Ступени из бамбукового паркета «ёлочкой»", "block.new_soviet.herringbone_bamboo_planks_slab": "Плита из бамбукового паркета «ёлочкой»", + "subtitles.new_soviet.tv_on": "Включается телевизор", + "subtitles.new_soviet.tv_off": "Выключается телевизор", + "subtitles.new_soviet.tv_break": "Разбит экран телевизора", "advancement.new_soviet.root.name": "Новая эра!", "advancement.new_soviet.root.desc": "Время совершать великое!", diff --git a/src/main/resources/assets/new_soviet/sounds.json b/src/main/resources/assets/new_soviet/sounds.json index d7b115d..b09a48d 100644 --- a/src/main/resources/assets/new_soviet/sounds.json +++ b/src/main/resources/assets/new_soviet/sounds.json @@ -93,6 +93,24 @@ "sounds": [ "new_soviet:cigarette_pause" ] + }, + "tv_on_sound": { + "subtitle": "subtitles.new_soviet.tv_on", + "sounds": [ + "new_soviet:tv_on" + ] + }, + "tv_off_sound": { + "subtitle": "subtitles.new_soviet.tv_off", + "sounds": [ + "new_soviet:tv_off" + ] + }, + "tv_break_sound": { + "subtitle": "subtitles.new_soviet.tv_break", + "sounds": [ + "new_soviet:tv_break" + ] } } diff --git a/src/main/resources/assets/new_soviet/sounds/tv_break.ogg b/src/main/resources/assets/new_soviet/sounds/tv_break.ogg new file mode 100644 index 0000000..b50eabe Binary files /dev/null and b/src/main/resources/assets/new_soviet/sounds/tv_break.ogg differ diff --git a/src/main/resources/assets/new_soviet/sounds/tv_off.ogg b/src/main/resources/assets/new_soviet/sounds/tv_off.ogg new file mode 100644 index 0000000..840e1bd Binary files /dev/null and b/src/main/resources/assets/new_soviet/sounds/tv_off.ogg differ diff --git a/src/main/resources/assets/new_soviet/sounds/tv_on.ogg b/src/main/resources/assets/new_soviet/sounds/tv_on.ogg new file mode 100644 index 0000000..e7c28af Binary files /dev/null and b/src/main/resources/assets/new_soviet/sounds/tv_on.ogg differ