test sound
This commit is contained in:
parent
83a4221e19
commit
9af5c7b6bd
@ -10,6 +10,7 @@ import com.jenny.magic.entities.entities;
|
|||||||
import com.jenny.magic.items.items;
|
import com.jenny.magic.items.items;
|
||||||
import com.jenny.magic.networking.networking;
|
import com.jenny.magic.networking.networking;
|
||||||
import com.jenny.magic.particles.particles;
|
import com.jenny.magic.particles.particles;
|
||||||
|
import com.jenny.magic.sounds.sounds;
|
||||||
import com.mojang.logging.LogUtils;
|
import com.mojang.logging.LogUtils;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.IEventBus;
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
@ -41,6 +42,7 @@ public class Magic {
|
|||||||
enchantments.register(modEventBus);
|
enchantments.register(modEventBus);
|
||||||
creativeTab.register(modEventBus);
|
creativeTab.register(modEventBus);
|
||||||
particles.register(modEventBus);
|
particles.register(modEventBus);
|
||||||
|
sounds.register(modEventBus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.jenny.magic.entities;
|
package com.jenny.magic.entities;
|
||||||
|
|
||||||
|
import com.jenny.magic.sounds.sounds;
|
||||||
|
import net.minecraft.sounds.SoundEvent;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
@ -72,4 +74,9 @@ public abstract class BaseWandProjectile extends AbstractArrow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract String name();
|
public abstract String name();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull SoundEvent getDefaultHitGroundSoundEvent() {
|
||||||
|
return sounds.TEST.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
23
src/main/java/com/jenny/magic/sounds/sounds.java
Normal file
23
src/main/java/com/jenny/magic/sounds/sounds.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package com.jenny.magic.sounds;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.sounds.SoundEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
|
import static com.jenny.magic.Magic.MODID;
|
||||||
|
|
||||||
|
public class sounds {
|
||||||
|
public static final DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, MODID);
|
||||||
|
public static final RegistryObject<SoundEvent> TEST = registerSoundEvent("sound_test");
|
||||||
|
|
||||||
|
private static RegistryObject<SoundEvent> registerSoundEvent(String name) {
|
||||||
|
return SOUNDS.register(name, () -> SoundEvent.createVariableRangeEvent(new ResourceLocation(MODID, name)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register(IEventBus bus) {
|
||||||
|
SOUNDS.register(bus);
|
||||||
|
}
|
||||||
|
}
|
8
src/main/resources/assets/magic/sounds.json
Normal file
8
src/main/resources/assets/magic/sounds.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"sound_test": {
|
||||||
|
"subtitle": "sounds.magic.sound_test",
|
||||||
|
"sounds": [
|
||||||
|
"magic:sound_test"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
BIN
src/main/resources/assets/magic/sounds/sound_test.ogg
Normal file
BIN
src/main/resources/assets/magic/sounds/sound_test.ogg
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user