Move out some references to vanilla sounds to make them easier to replace

This commit is contained in:
Sollace 2022-10-12 10:40:36 +02:00
parent b13db5cdbf
commit 83b4953bba
7 changed files with 28 additions and 15 deletions

View file

@ -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");

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -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);
});
}

View file

@ -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());

View file

@ -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<T extends LivingEntity> implements Equine<T>, 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);

View file

@ -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);
}