A bit of work on sounds
This commit is contained in:
parent
8be5ecf140
commit
da444327f8
49 changed files with 38 additions and 39 deletions
|
@ -568,8 +568,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
|
||||||
{
|
{
|
||||||
return small_models.get(name);
|
return small_models.get(name);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return large_models.get(name);
|
return large_models.get(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,15 @@ import mekanism.client.HolidayManager;
|
||||||
import mekanism.client.MekanismClient;
|
import mekanism.client.MekanismClient;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.audio.SoundCategory;
|
||||||
|
import net.minecraft.client.gui.GuiOptions;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import net.minecraftforge.event.world.ChunkEvent;
|
import net.minecraftforge.event.world.ChunkEvent;
|
||||||
import paulscode.sound.SoundSystem;
|
import paulscode.sound.SoundSystem;
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ public class SoundHandler
|
||||||
{
|
{
|
||||||
CodeSource src = getClass().getProtectionDomain().getCodeSource();
|
CodeSource src = getClass().getProtectionDomain().getCodeSource();
|
||||||
String corePath = src.getLocation().getFile().split("/mekanism/client")[0];
|
String corePath = src.getLocation().getFile().split("/mekanism/client")[0];
|
||||||
List<String> listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sound");
|
List<String> listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sounds");
|
||||||
|
|
||||||
for(String s : listings)
|
for(String s : listings)
|
||||||
{
|
{
|
||||||
|
@ -68,9 +70,9 @@ public class SoundHandler
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(s.contains("/mekanism/sound/"))
|
if(s.contains("/mekanism/sounds/"))
|
||||||
{
|
{
|
||||||
s = s.split("/mekanism/sound/")[1];
|
s = s.split("/mekanism/sounds/")[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
preloadSound(s);
|
preloadSound(s);
|
||||||
|
@ -78,13 +80,13 @@ public class SoundHandler
|
||||||
|
|
||||||
System.out.println("[Mekanism] Preloaded " + listings.size() + " object sounds.");
|
System.out.println("[Mekanism] Preloaded " + listings.size() + " object sounds.");
|
||||||
|
|
||||||
listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sound/etc");
|
listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sounds/etc");
|
||||||
|
|
||||||
for(String s : listings)
|
for(String s : listings)
|
||||||
{
|
{
|
||||||
if(s.contains("/mekanism/sound/etc/"))
|
if(s.contains("/mekanism/sounds/etc/"))
|
||||||
{
|
{
|
||||||
s = s.split("/mekanism/sound/etc/")[1];
|
s = s.split("/mekanism/sounds/etc/")[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.sndManager.addSound("mekanism:etc/" + s);
|
mc.sndManager.addSound("mekanism:etc/" + s);
|
||||||
|
@ -94,13 +96,13 @@ public class SoundHandler
|
||||||
|
|
||||||
if(MekanismClient.holidays)
|
if(MekanismClient.holidays)
|
||||||
{
|
{
|
||||||
listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sound/holiday");
|
listings = listFiles(corePath.replace("%20", " ").replace(".jar!", ".jar").replace("file:", ""), "assets/mekanism/sounds/holiday");
|
||||||
|
|
||||||
for(String s : listings)
|
for(String s : listings)
|
||||||
{
|
{
|
||||||
if(s.contains("/mekanism/sound/"))
|
if(s.contains("/mekanism/sounds/"))
|
||||||
{
|
{
|
||||||
s = s.split("/mekanism/sound/")[1];
|
s = s.split("/mekanism/sounds/")[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!s.contains("holiday"))
|
if(!s.contains("holiday"))
|
||||||
|
@ -169,7 +171,7 @@ public class SoundHandler
|
||||||
private void preloadSound(String sound)
|
private void preloadSound(String sound)
|
||||||
{
|
{
|
||||||
String id = "pre_" + sound;
|
String id = "pre_" + sound;
|
||||||
URL url = getClass().getClassLoader().getResource("assets/mekanism/sound/" + sound);
|
URL url = getClass().getClassLoader().getResource("assets/mekanism/sounds/" + sound);
|
||||||
|
|
||||||
if(getSoundSystem() != null)
|
if(getSoundSystem() != null)
|
||||||
{
|
{
|
||||||
|
@ -218,7 +220,7 @@ public class SoundHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
masterVolume = FMLClientHandler.instance().getClient().gameSettings.soundVolume;
|
masterVolume = FMLClientHandler.instance().getClient().gameSettings.getSoundLevel(SoundCategory.MASTER);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(Sound sound : sounds.values())
|
for(Sound sound : sounds.values())
|
||||||
|
@ -305,7 +307,7 @@ public class SoundHandler
|
||||||
*/
|
*/
|
||||||
public void quickPlay(String soundPath, World world, Coord4D object)
|
public void quickPlay(String soundPath, World world, Coord4D object)
|
||||||
{
|
{
|
||||||
URL url = getClass().getClassLoader().getResource("assets/mekanism/sound/" + soundPath);
|
URL url = getClass().getClassLoader().getResource("assets/mekanism/sounds/" + soundPath);
|
||||||
|
|
||||||
if(url == null)
|
if(url == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1211,15 +1211,10 @@ public class Mekanism
|
||||||
//Load cached furnace recipes
|
//Load cached furnace recipes
|
||||||
TileEntityEnergizedSmelter.furnaceRecipes.clear();
|
TileEntityEnergizedSmelter.furnaceRecipes.clear();
|
||||||
|
|
||||||
for(Map.Entry<List<Integer>, ItemStack> entry : FurnaceRecipes.smelting().getMetaSmeltingList().entrySet())
|
|
||||||
{
|
|
||||||
TileEntityEnergizedSmelter.furnaceRecipes.put(new ItemStack(entry.getKey().get(0), 1, entry.getKey().get(1)), entry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
for(Object obj : FurnaceRecipes.smelting().getSmeltingList().entrySet())
|
for(Object obj : FurnaceRecipes.smelting().getSmeltingList().entrySet())
|
||||||
{
|
{
|
||||||
Map.Entry<Integer, ItemStack> entry = (Map.Entry<Integer, ItemStack>)obj;
|
Map.Entry<ItemStack, ItemStack> entry = (Map.Entry<ItemStack, ItemStack>)obj;
|
||||||
TileEntityEnergizedSmelter.furnaceRecipes.put(new ItemStack(entry.getKey(), 1, OreDictionary.WILDCARD_VALUE), entry.getValue());
|
TileEntityEnergizedSmelter.furnaceRecipes.put(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
event.registerServerCommand(new CommandMekanism());
|
event.registerServerCommand(new CommandMekanism());
|
||||||
|
|
|
@ -16,16 +16,13 @@ import net.minecraft.world.World;
|
||||||
*/
|
*/
|
||||||
public abstract class MekanismPacket
|
public abstract class MekanismPacket
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode the packet data into the ByteBuf stream. Complex data sets may
|
* Encode the packet data into the ByteBuf stream. Complex data sets may
|
||||||
* need specific data handlers (See
|
* need specific data handlers (See
|
||||||
* @link{cpw.mods.fml.common.network.ByteBuffUtils})
|
* @link{cpw.mods.fml.common.network.ByteBuffUtils})
|
||||||
*
|
*
|
||||||
* @param ctx
|
* @param ctx - channel context
|
||||||
* channel context
|
* @param buffer - the buffer to encode into
|
||||||
* @param buffer
|
|
||||||
* the buffer to encode into
|
|
||||||
*/
|
*/
|
||||||
public abstract void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer);
|
public abstract void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer);
|
||||||
|
|
||||||
|
@ -34,10 +31,8 @@ public abstract class MekanismPacket
|
||||||
* need specific data handlers (See
|
* need specific data handlers (See
|
||||||
* @link{cpw.mods.fml.common.network.ByteBuffUtils})
|
* @link{cpw.mods.fml.common.network.ByteBuffUtils})
|
||||||
*
|
*
|
||||||
* @param ctx
|
* @param ctx - channel context
|
||||||
* channel context
|
* @param buffer - the buffer to decode from
|
||||||
* @param buffer
|
|
||||||
* the buffer to decode from
|
|
||||||
*/
|
*/
|
||||||
public abstract void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer);
|
public abstract void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer);
|
||||||
|
|
||||||
|
@ -45,8 +40,7 @@ public abstract class MekanismPacket
|
||||||
* Handle a packet on the client side. Note this occurs after decoding has
|
* Handle a packet on the client side. Note this occurs after decoding has
|
||||||
* completed.
|
* completed.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player - the player reference
|
||||||
* the player reference
|
|
||||||
*/
|
*/
|
||||||
public abstract void handleClientSide(EntityPlayer player);
|
public abstract void handleClientSide(EntityPlayer player);
|
||||||
|
|
||||||
|
@ -54,8 +48,7 @@ public abstract class MekanismPacket
|
||||||
* Handle a packet on the server side. Note this occurs after decoding has
|
* Handle a packet on the server side. Note this occurs after decoding has
|
||||||
* completed.
|
* completed.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player - the player reference
|
||||||
* the player reference
|
|
||||||
*/
|
*/
|
||||||
public abstract void handleServerSide(EntityPlayer player);
|
public abstract void handleServerSide(EntityPlayer player);
|
||||||
}
|
}
|
||||||
|
|
10
src/main/resources/assets/mekanism/sounds.json
Normal file
10
src/main/resources/assets/mekanism/sounds.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"Beep": {"category": "master","sounds": [{"name": "Beep","stream": false}]},
|
||||||
|
"Click": {"category": "master","sounds": [{"name": "Click","stream": false}]},
|
||||||
|
"Ding": {"category": "master","sounds": [{"name": "Ding","stream": false}]},
|
||||||
|
"Error": {"category": "master","sounds": [{"name": "Error","stream": false}]},
|
||||||
|
"GasMask": {"category": "master","sounds": [{"name": "GasMask","stream": false}]},
|
||||||
|
"Hydraulic": {"category": "master","sounds": [{"name": "Hydraulic","stream": false}]},
|
||||||
|
"Pop": {"category": "master","sounds": [{"name": "Pop","stream": false}]},
|
||||||
|
"Success": {"category": "master","sounds": [{"name": "Success","stream": false}]}
|
||||||
|
}
|
Loading…
Reference in a new issue