A bit of work on sounds

This commit is contained in:
Aidan C. Brady 2014-05-31 22:42:02 +02:00
parent 8be5ecf140
commit da444327f8
49 changed files with 38 additions and 39 deletions

View file

@ -568,8 +568,7 @@ public class RenderPartTransmitter implements IIconSelfRegister
{
return small_models.get(name);
}
else
{
else {
return large_models.get(name);
}
}

View file

@ -18,13 +18,15 @@ import mekanism.client.HolidayManager;
import mekanism.client.MekanismClient;
import mekanism.common.Mekanism;
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.world.World;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.event.world.ChunkEvent;
import paulscode.sound.SoundSystem;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -59,7 +61,7 @@ public class SoundHandler
{
CodeSource src = getClass().getProtectionDomain().getCodeSource();
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)
{
@ -68,9 +70,9 @@ public class SoundHandler
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);
@ -78,13 +80,13 @@ public class SoundHandler
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)
{
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);
@ -94,13 +96,13 @@ public class SoundHandler
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)
{
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"))
@ -169,7 +171,7 @@ public class SoundHandler
private void preloadSound(String 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)
{
@ -218,7 +220,7 @@ public class SoundHandler
}
}
masterVolume = FMLClientHandler.instance().getClient().gameSettings.soundVolume;
masterVolume = FMLClientHandler.instance().getClient().gameSettings.getSoundLevel(SoundCategory.MASTER);
}
else {
for(Sound sound : sounds.values())
@ -305,7 +307,7 @@ public class SoundHandler
*/
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)
{

View file

@ -1211,15 +1211,10 @@ public class Mekanism
//Load cached furnace recipes
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())
{
Map.Entry<Integer, ItemStack> entry = (Map.Entry<Integer, ItemStack>)obj;
TileEntityEnergizedSmelter.furnaceRecipes.put(new ItemStack(entry.getKey(), 1, OreDictionary.WILDCARD_VALUE), entry.getValue());
Map.Entry<ItemStack, ItemStack> entry = (Map.Entry<ItemStack, ItemStack>)obj;
TileEntityEnergizedSmelter.furnaceRecipes.put(entry.getKey(), entry.getValue());
}
event.registerServerCommand(new CommandMekanism());

View file

@ -16,46 +16,39 @@ import net.minecraft.world.World;
*/
public abstract class MekanismPacket
{
/**
* Encode the packet data into the ByteBuf stream. Complex data sets may
* need specific data handlers (See
* @link{cpw.mods.fml.common.network.ByteBuffUtils})
*
* @param ctx
* channel context
* @param buffer
* the buffer to encode into
* @param ctx - channel context
* @param buffer - the buffer to encode into
*/
public abstract void encodeInto (ChannelHandlerContext ctx, ByteBuf buffer);
public abstract void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer);
/**
* Decode the packet data from the ByteBuf stream. Complex data sets may
* need specific data handlers (See
* @link{cpw.mods.fml.common.network.ByteBuffUtils})
*
* @param ctx
* channel context
* @param buffer
* the buffer to decode from
* @param ctx - channel context
* @param buffer - the buffer to decode from
*/
public abstract void decodeInto (ChannelHandlerContext ctx, ByteBuf buffer);
public abstract void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer);
/**
* Handle a packet on the client side. Note this occurs after decoding has
* completed.
*
* @param player
* the player reference
* @param player - the player reference
*/
public abstract void handleClientSide (EntityPlayer player);
public abstract void handleClientSide(EntityPlayer player);
/**
* Handle a packet on the server side. Note this occurs after decoding has
* completed.
*
* @param player
* the player reference
* @param player - the player reference
*/
public abstract void handleServerSide (EntityPlayer player);
public abstract void handleServerSide(EntityPlayer player);
}

View 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}]}
}