More Sound Fixes

This commit is contained in:
Henry Mao 2013-01-27 12:48:05 +08:00
parent 6ac80fcb01
commit 56eb997ae2
13 changed files with 36 additions and 38 deletions

Binary file not shown.

View file

@ -15,7 +15,6 @@ import assemblyline.client.render.RenderCrate;
import assemblyline.client.render.RenderDetector;
import assemblyline.client.render.RenderManipulator;
import assemblyline.client.render.RenderRejector;
import assemblyline.client.sound.SoundManager;
import assemblyline.common.AssemblyLine;
import assemblyline.common.CommonProxy;
import assemblyline.common.block.TileEntityCrate;
@ -38,7 +37,7 @@ public class ClientProxy extends CommonProxy
MinecraftForgeClient.preloadTexture(AssemblyLine.BLOCK_TEXTURE_PATH);
MinecraftForgeClient.preloadTexture(AssemblyLine.ITEM_TEXTURE_PATH);
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler());
MinecraftForge.EVENT_BUS.register(new SoundManager());
MinecraftForge.EVENT_BUS.register(SoundManager.INSTANCE);
}
@Override

View file

@ -0,0 +1,30 @@
package assemblyline.client;
import java.net.URL;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;
import assemblyline.common.AssemblyLine;
public class SoundManager
{
public static final SoundManager INSTANCE = new SoundManager();
public static final String[] SOUND_FILES = { "conveyor.ogg" };
@ForgeSubscribe
public void loadSoundEvents(SoundLoadEvent event)
{
for (int i = 0; i < SOUND_FILES.length; i++)
{
URL url = this.getClass().getResource(AssemblyLine.DIRECTORY + SOUND_FILES[i]);
event.manager.soundPoolSounds.addSound(AssemblyLine.DIRECTORY + SOUND_FILES[i], url);
if (url == null)
{
System.out.println("Invalid sound file: " + SOUND_FILES[i]);
}
}
}
}

View file

@ -16,7 +16,6 @@ import universalelectricity.core.vector.Vector3;
import assemblyline.client.model.ModelArmbot;
import assemblyline.common.AssemblyLine;
import assemblyline.common.machine.armbot.TileEntityArmbot;
import assemblyline.common.machine.command.Command;
public class RenderArmbot extends TileEntitySpecialRenderer
{

View file

@ -1,21 +0,0 @@
package assemblyline.client.sound;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;
public class SoundManager
{
@ForgeSubscribe
public void onSound(SoundLoadEvent event)
{
try
{
event.manager.soundPoolSounds.addSound("assemblyline/conveyor.wav", getClass().getResource("conveyor.wav"));
}
catch (Exception e)
{
System.err.println("Failed to register one or more sounds.");
}
}
}

View file

@ -55,9 +55,10 @@ public class AssemblyLine
public static final String CHANNEL = "AssemblyLine";
public static final String RESOURCE_PATH = "/assemblyline/";
public static final String TEXTURE_PATH = RESOURCE_PATH + "textures/";
public static final String LANGUAGE_PATH = RESOURCE_PATH + "language/";
public static final String DIRECTORY_NO_SLASH = "assemblyline/";
public static final String DIRECTORY = "/" + DIRECTORY_NO_SLASH;
public static final String TEXTURE_PATH = DIRECTORY + "textures/";
public static final String LANGUAGE_PATH = DIRECTORY + "language/";
public static final String BLOCK_TEXTURE_PATH = TEXTURE_PATH + "blocks.png";
public static final String ITEM_TEXTURE_PATH = TEXTURE_PATH + "items.png";
@ -156,8 +157,6 @@ public class AssemblyLine
// Manipulator
GameRegistry.addRecipe(new ShapelessOreRecipe(blockManipulator, new Object[] { Block.dispenser, "basicCircuit" }));
UETab.setItemStack(new ItemStack(blockConveyorBelt));
}
public static void printSidedData(String data)

View file

@ -8,7 +8,6 @@ import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.item.EntityItem;
@ -22,7 +21,6 @@ import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.implement.IJouleStorage;
@ -32,7 +30,6 @@ import universalelectricity.prefab.multiblock.IMultiBlock;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import assemblyline.api.IArmbotUseable;
import assemblyline.client.render.RenderHelper;
import assemblyline.common.AssemblyLine;
import assemblyline.common.machine.TileEntityAssemblyNetwork;
import assemblyline.common.machine.command.Command;

View file

@ -121,8 +121,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
{
if (this.ticks % 10 == 0 && this.worldObj.isRemote && this.worldObj.getBlockId(xCoord - 1, yCoord, zCoord) != AssemblyLine.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != AssemblyLine.blockConveyorBelt.blockID)
{
// Sound is 0.5 seconds long (20 ticks/second)
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, "assemblyline.conveyor", 0.3f, 0.3f, true);
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "assemblyline.conveyor", 1.3f, 0.3f);
}
this.wheelRotation += 40;

View file

@ -3,8 +3,6 @@ package assemblyline.common.machine.command;
import java.util.HashMap;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.world.World;
import assemblyline.common.machine.armbot.TileEntityArmbot;

View file

@ -6,7 +6,6 @@ import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import assemblyline.common.AssemblyLine;
import assemblyline.common.machine.armbot.TileEntityArmbot;
import cpw.mods.fml.common.FMLLog;

View file

@ -1,7 +1,6 @@
package assemblyline.common.machine.command;
import net.minecraft.nbt.NBTTagCompound;
import assemblyline.common.machine.armbot.TileEntityArmbot;
/**
* This task resets all previous tasks and does them again in a loop.