Fix sounds

This commit is contained in:
modmuss50 2016-05-08 11:42:59 +01:00
parent 9c6e9aef64
commit caaa5a3e7f
6 changed files with 36 additions and 26 deletions
src/main/java/techreborn/init

View file

@ -2,6 +2,7 @@ package techreborn.init;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
/**
* Created by Mark on 20/03/2016.
@ -10,16 +11,20 @@ public class ModSounds
{
public static SoundEvent shock;
public static SoundEvent dismantle;
public static SoundEvent extract;
public static void init()
{
shock = getSound("cable_shock");
dismantle = getSound("block_dismantle");
extract = getSound("sap_extract");
}
private static SoundEvent getSound(String str)
{
SoundEvent soundEvent = SoundEvent.REGISTRY.getObject(new ResourceLocation("techreborn" + str));
return soundEvent;
ResourceLocation resourceLocation = new ResourceLocation("techreborn" , str);
return GameRegistry.register(new SoundEvent(resourceLocation).setRegistryName(resourceLocation));
}
}