From 83b4953bbab72315c0044a9d0df21e763d4babeb Mon Sep 17 00:00:00 2001 From: Sollace Date: Wed, 12 Oct 2022 10:40:36 +0200 Subject: [PATCH] Move out some references to vanilla sounds to make them easier to replace --- .../java/com/minelittlepony/unicopia/USounds.java | 13 +++++++++++++ .../magic/spell/effect/DisplacementSpell.java | 4 ++-- .../magic/spell/effect/HydrophobicSpell.java | 4 ++-- .../ability/magic/spell/effect/MindSwapSpell.java | 10 +++++----- .../com/minelittlepony/unicopia/block/PieBlock.java | 5 ++--- .../com/minelittlepony/unicopia/entity/Living.java | 3 ++- .../unicopia/item/DragonBreathScrollItem.java | 4 ++-- 7 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/USounds.java b/src/main/java/com/minelittlepony/unicopia/USounds.java index 3033f16c..8c6b1504 100644 --- a/src/main/java/com/minelittlepony/unicopia/USounds.java +++ b/src/main/java/com/minelittlepony/unicopia/USounds.java @@ -1,6 +1,7 @@ package com.minelittlepony.unicopia; import net.minecraft.sound.SoundEvent; +import net.minecraft.sound.SoundEvents; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; @@ -40,6 +41,9 @@ public interface USounds { SoundEvent ITEM_AMULET_CHARGING = register("item.amulet.charging"); SoundEvent ITEM_AMULET_RECHARGE = register("item.amulet.recharge"); + SoundEvent ITEM_DRAGON_BREATH_SCROLL_USE = SoundEvents.ITEM_FIRECHARGE_USE; + SoundEvent ITEM_DRAGON_BREATH_ARRIVE = SoundEvents.ITEM_FIRECHARGE_USE; + SoundEvent ITEM_ICARUS_WINGS_PURIFY = register("item.icarus_wings.resonate"); SoundEvent ITEM_ICARUS_WINGS_CORRUPT = register("item.icarus_wings.corrupted"); SoundEvent ITEM_ICARUS_WINGS_WARN = register("item.icarus_wings.warn"); @@ -53,6 +57,9 @@ public interface USounds { SoundEvent ITEM_BRACELET_SIGN = register("item.bracelet.sign"); SoundEvent ITEM_MAGIC_AURA = register("item.magic.aura"); + SoundEvent BLOCK_WEATHER_VANE_ROTATE = SoundEvents.BLOCK_LANTERN_STEP; + SoundEvent BLOCK_PIE_SLICE = SoundEvents.BLOCK_BEEHIVE_SHEAR; + SoundEvent SPELL_CAST_FAIL = register("spell.cast.fail"); SoundEvent SPELL_CAST_SUCCESS = register("spell.cast.success"); SoundEvent SPELL_CAST_SHOOT = register("spell.cast.shoot"); @@ -62,6 +69,12 @@ public interface USounds { SoundEvent SPELL_SHIELD_BURN_PROJECTILE = register("spell.shield.projectile.burn"); SoundEvent SPELL_TRANSFORM_TRANSMUTE_ENTITY = register("spell.transform.transmute.entity"); + SoundEvent SPELL_AMBIENT = SoundEvents.BLOCK_BEACON_AMBIENT; + SoundEvent SPELL_MINDSWAP_SWAP = SoundEvents.ENTITY_ZOMBIE_INFECT; + SoundEvent SPELL_MINDSWAP_UNSWAP = SoundEvents.ENTITY_ZOMBIE_VILLAGER_CURE; + + SoundEvent SPELL_DISPLACEMENT_TELEPORT = SoundEvents.ENTITY_HUSK_CONVERTED_TO_ZOMBIE; + SoundEvent AMBIENT_DARK_VORTEX_MOOD = register("ambient.dark_vortex.mood"); SoundEvent AMBIENT_DARK_VORTEX_ADDITIONS = register("ambient.dark_vortex.additions"); diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/DisplacementSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/DisplacementSpell.java index 8c028d04..8713214e 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/DisplacementSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/DisplacementSpell.java @@ -1,5 +1,6 @@ package com.minelittlepony.unicopia.ability.magic.spell.effect; +import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.ability.magic.Caster; import com.minelittlepony.unicopia.ability.magic.spell.*; import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait; @@ -10,7 +11,6 @@ import com.minelittlepony.unicopia.util.MagicalDamageSource; import net.minecraft.entity.Entity; import net.minecraft.nbt.NbtCompound; -import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.Vec3d; public class DisplacementSpell extends AbstractSpell implements HomingSpell, PlaceableSpell.PlacementDelegate { @@ -73,7 +73,7 @@ public class DisplacementSpell extends AbstractSpell implements HomingSpell, Pla entity.teleport(pos.x, pos.y, pos.z); entity.setVelocity(vel); entity.setGlowing(false); - entity.playSound(SoundEvents.ENTITY_HUSK_CONVERTED_TO_ZOMBIE, 1, 1); + entity.playSound(USounds.SPELL_DISPLACEMENT_TELEPORT, 1, 1); float damage = getTraits().get(Trait.BLOOD); if (damage > 0) { diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/HydrophobicSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/HydrophobicSpell.java index c0076c25..ff0a0c8e 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/HydrophobicSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/HydrophobicSpell.java @@ -3,6 +3,7 @@ package com.minelittlepony.unicopia.ability.magic.spell.effect; import java.util.HashSet; import java.util.Set; +import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.ability.magic.Caster; import com.minelittlepony.unicopia.ability.magic.CasterView; import com.minelittlepony.unicopia.ability.magic.spell.Situation; @@ -16,7 +17,6 @@ import com.minelittlepony.unicopia.util.shape.*; import net.minecraft.block.*; import net.minecraft.fluid.*; import net.minecraft.nbt.*; -import net.minecraft.sound.SoundEvents; import net.minecraft.state.property.Properties; import net.minecraft.tag.TagKey; import net.minecraft.util.math.BlockPos; @@ -88,7 +88,7 @@ public class HydrophobicSpell extends AbstractSpell { }); if (source.getEntity().age % 200 == 0) { - source.playSound(SoundEvents.BLOCK_BEACON_AMBIENT, 0.5F); + source.playSound(USounds.SPELL_AMBIENT, 0.5F); } } diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java index 85a4ba72..ab5f387b 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/MindSwapSpell.java @@ -2,6 +2,7 @@ package com.minelittlepony.unicopia.ability.magic.spell.effect; import java.util.Optional; +import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.ability.magic.Caster; import com.minelittlepony.unicopia.ability.magic.spell.Situation; import com.minelittlepony.unicopia.entity.EntityReference; @@ -13,7 +14,6 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; -import net.minecraft.sound.SoundEvents; public class MindSwapSpell extends MimicSpell { @@ -45,8 +45,8 @@ public class MindSwapSpell extends MimicSpell { Caster other = Caster.of(e).get(); other.getSpellSlot().removeIf(SpellType.MIMIC, true); - other.playSound(SoundEvents.ENTITY_ZOMBIE_INFECT, 1); - caster.playSound(SoundEvents.ENTITY_ZOMBIE_INFECT, 1); + other.playSound(USounds.SPELL_MINDSWAP_UNSWAP, 1); + caster.playSound(USounds.SPELL_MINDSWAP_UNSWAP, 1); }); } } @@ -71,8 +71,8 @@ public class MindSwapSpell extends MimicSpell { a -> theirStoredInventory = Optional.of(a) ); - other.playSound(SoundEvents.ENTITY_ZOMBIE_INFECT, 1); - caster.playSound(SoundEvents.ENTITY_ZOMBIE_INFECT, 1); + other.playSound(USounds.SPELL_MINDSWAP_SWAP, 1); + caster.playSound(USounds.SPELL_MINDSWAP_SWAP, 1); }); } diff --git a/src/main/java/com/minelittlepony/unicopia/block/PieBlock.java b/src/main/java/com/minelittlepony/unicopia/block/PieBlock.java index e8c9372f..2db7b089 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/PieBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/block/PieBlock.java @@ -1,7 +1,6 @@ package com.minelittlepony.unicopia.block; -import com.minelittlepony.unicopia.AwaitTickQueue; -import com.minelittlepony.unicopia.UGameEvents; +import com.minelittlepony.unicopia.*; import com.minelittlepony.unicopia.util.SoundEmitter; import net.minecraft.block.*; @@ -81,7 +80,7 @@ public class PieBlock extends Block implements Waterloggable { } if (itemStack.getItem() == Items.SHEARS) { - SoundEmitter.playSoundAt(player, SoundEvents.BLOCK_BEEHIVE_SHEAR, SoundCategory.NEUTRAL, 1, 1); + SoundEmitter.playSoundAt(player, USounds.BLOCK_PIE_SLICE, SoundCategory.NEUTRAL, 1, 1); removeSlice(world, pos, state, player); SoundEmitter.playSoundAt(player, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.NEUTRAL, 0.5F, world.getRandom().nextFloat() * 0.1F + 0.9F); Block.dropStack(world, pos, sliceItem.asItem().getDefaultStack()); diff --git a/src/main/java/com/minelittlepony/unicopia/entity/Living.java b/src/main/java/com/minelittlepony/unicopia/entity/Living.java index 6a86cd00..514c28b2 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/Living.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/Living.java @@ -6,6 +6,7 @@ import java.util.stream.Stream; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.Unicopia; import com.minelittlepony.unicopia.ability.magic.Caster; import com.minelittlepony.unicopia.ability.magic.SpellContainer; @@ -145,7 +146,7 @@ public abstract class Living implements Equine, Caste item.setStack(stack.payload()); item.setPosition(randomPos); item.world.spawnEntity(item); - entity.world.playSoundFromEntity(null, entity, SoundEvents.ITEM_FIRECHARGE_USE, entity.getSoundCategory(), 1, 1); + entity.world.playSoundFromEntity(null, entity, USounds.ITEM_DRAGON_BREATH_ARRIVE, entity.getSoundCategory(), 1, 1); if (stack.payload().getItem() == UItems.OATS && entity instanceof PlayerEntity player) { UCriteria.RECEIVE_OATS.trigger(player); diff --git a/src/main/java/com/minelittlepony/unicopia/item/DragonBreathScrollItem.java b/src/main/java/com/minelittlepony/unicopia/item/DragonBreathScrollItem.java index 402111aa..545fdc06 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/DragonBreathScrollItem.java +++ b/src/main/java/com/minelittlepony/unicopia/item/DragonBreathScrollItem.java @@ -2,13 +2,13 @@ package com.minelittlepony.unicopia.item; import java.util.UUID; +import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.advancement.UCriteria; import com.minelittlepony.unicopia.block.data.DragonBreathStore; import net.minecraft.entity.player.PlayerEntity; 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 net.minecraft.world.World; @@ -35,7 +35,7 @@ public class DragonBreathScrollItem extends Item { } DragonBreathStore.get(world).put(stack.getName().getString(), payload.split(1)); } - player.playSound(SoundEvents.ITEM_FIRECHARGE_USE, 1, 1); + player.playSound(USounds.ITEM_DRAGON_BREATH_SCROLL_USE, 1, 1); return TypedActionResult.consume(stack); }