More big sound work

This commit is contained in:
Ben Spiers 2014-08-27 23:16:59 +01:00
parent 41be14fad4
commit da6cbeb46d
37 changed files with 519 additions and 272 deletions

View file

@ -1,5 +1,7 @@
package mekanism.client.sound; package mekanism.client.sound;
import net.minecraft.client.audio.ISound;
/** /**
* Implement this if your TileEntity has a specific sound. * Implement this if your TileEntity has a specific sound.
* @author AidanBrady * @author AidanBrady
@ -7,15 +9,7 @@ package mekanism.client.sound;
*/ */
public interface IHasSound public interface IHasSound
{ {
/** public ISound getSound();
* Gets the sound path of this block's sound.
* @return sound path
*/
public String getSoundPath();
/** public boolean shouldPlaySound();
* Gets the multiplier to play this sound by.
* @return sound multiplier
*/
public float getVolumeMultiplier();
} }

View file

@ -0,0 +1,23 @@
package mekanism.client.sound;
import mekanism.api.Pos3D;
import net.minecraft.client.audio.ISound.AttenuationType;
import net.minecraft.util.ResourceLocation;
public interface ISoundSource
{
public ResourceLocation getSoundLocation();
public float getVolume();
public float getPitch();
public Pos3D getSoundPosition();
public boolean shouldRepeat();
public int getRepeatDelay();
public AttenuationType getAttenuation();
}

View file

@ -0,0 +1,175 @@
package mekanism.client.sound;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.audio.ISound;
import net.minecraft.util.ResourceLocation;
/**
* Generic ISound class with lots of constructor functionality. Required because - of course - Mojang has no generic that lets you specify *any* arguments for
* this. Taken from CoFHLib
*
* @author skyboy
*
*/
@SideOnly(Side.CLIENT)
public class SoundBase implements ISound {
protected AttenuationType attenuation;
protected final ResourceLocation sound;
protected float volume;
protected float pitch;
protected float x;
protected float y;
protected float z;
protected boolean repeat;
protected int repeatDelay;
public SoundBase(String sound) {
this(sound, 0);
}
public SoundBase(String sound, float volume) {
this(sound, volume, 0);
}
public SoundBase(String sound, float volume, float pitch) {
this(sound, volume, pitch, false, 0);
}
public SoundBase(String sound, float volume, float pitch, boolean repeat, int repeatDelay) {
this(sound, volume, pitch, repeat, repeatDelay, 0, 0, 0, AttenuationType.NONE);
}
public SoundBase(String sound, float volume, float pitch, double x, double y, double z) {
this(sound, volume, pitch, false, 0, x, y, z);
}
public SoundBase(String sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z) {
this(sound, volume, pitch, repeat, repeatDelay, x, y, z, AttenuationType.LINEAR);
}
public SoundBase(String sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z, AttenuationType attenuation) {
this(new ResourceLocation(sound), volume, pitch, repeat, repeatDelay, x, y, z, attenuation);
}
public SoundBase(ResourceLocation sound) {
this(sound, 0);
}
public SoundBase(ResourceLocation sound, float volume) {
this(sound, volume, 0);
}
public SoundBase(ResourceLocation sound, float volume, float pitch) {
this(sound, volume, pitch, false, 0);
}
public SoundBase(ResourceLocation sound, float volume, float pitch, boolean repeat, int repeatDelay) {
this(sound, volume, pitch, repeat, repeatDelay, 0, 0, 0, AttenuationType.NONE);
}
public SoundBase(ResourceLocation sound, float volume, float pitch, double x, double y, double z) {
this(sound, volume, pitch, false, 0, x, y, z);
}
public SoundBase(ResourceLocation sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z) {
this(sound, volume, pitch, repeat, repeatDelay, x, y, z, AttenuationType.LINEAR);
}
public SoundBase(ResourceLocation sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z,
AttenuationType attenuation) {
this.attenuation = attenuation;
this.sound = sound;
this.volume = volume;
this.pitch = pitch;
this.x = (float) x;
this.y = (float) y;
this.z = (float) z;
this.repeat = repeat;
this.repeatDelay = repeatDelay;
}
public SoundBase(SoundBase other) {
this.attenuation = other.attenuation;
this.sound = other.sound;
this.volume = other.volume;
this.pitch = other.pitch;
this.x = other.x;
this.y = other.y;
this.z = other.z;
this.repeat = other.repeat;
this.repeatDelay = other.repeatDelay;
}
@Override
public AttenuationType getAttenuationType() {
return attenuation;
}
@Override
public ResourceLocation getPositionedSoundLocation() {
return sound;
}
@Override
public float getVolume() {
return volume;
}
@Override
public float getPitch() {
return pitch;
}
@Override
public float getXPosF() {
return x;
}
@Override
public float getYPosF() {
return y;
}
@Override
public float getZPosF() {
return z;
}
@Override
public boolean canRepeat() {
return repeat;
}
@Override
public int getRepeatDelay() {
return repeatDelay;
}
}

View file

@ -285,14 +285,6 @@ public class SoundHandler
{ {
return; return;
} }
synchronized(soundMaps)
{
if(getMap(tile) == null)
{
new TileSound(getIdentifier(tile), HolidayManager.filterSound(((IHasSound)tile).getSoundPath()), CHANNEL_TILE_DEFAULT, tile);
}
}
} }
/** /**

View file

@ -0,0 +1,102 @@
package mekanism.client.sound;
import net.minecraft.client.audio.ITickableSound;
import net.minecraft.util.ResourceLocation;
public class SoundTile extends SoundBase implements ITickableSound {
IHasSound source;
boolean beginFadeOut;
boolean donePlaying = true;
int ticks = 0;
int fadeIn = 50;
int fadeOut = 50;
float baseVolume = 1.0F;
public SoundTile(IHasSound source, ISoundSource values)
{
this(source, values.getSoundLocation(), values.getVolume(), values.getPitch(), values.shouldRepeat(), values.getRepeatDelay(), values.getSoundPosition().xPos, values.getSoundPosition().yPos, values.getSoundPosition().zPos);
}
public SoundTile(IHasSound source, String sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z) {
this(source, sound, volume, pitch, repeat, repeatDelay, x, y, z, AttenuationType.LINEAR);
}
public SoundTile(IHasSound source, String sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z,
AttenuationType attenuation) {
this(source, new ResourceLocation(sound), volume, pitch, repeat, repeatDelay, x, y, z, attenuation);
}
public SoundTile(IHasSound source, ResourceLocation sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z) {
this(source, sound, volume, pitch, repeat, repeatDelay, x, y, z, AttenuationType.LINEAR);
}
public SoundTile(IHasSound source, ResourceLocation sound, float volume, float pitch, boolean repeat, int repeatDelay, double x, double y, double z,
AttenuationType attenuation) {
super(sound, volume, pitch, repeat, repeatDelay, x, y, z, attenuation);
this.source = source;
this.baseVolume = volume;
}
public SoundTile setFadeIn(int fadeIn) {
this.fadeIn = Math.min(0, fadeIn);
return this;
}
public SoundTile setFadeOut(int fadeOut) {
this.fadeOut = Math.min(0, fadeOut);
return this;
}
public float getFadeInMultiplier() {
return ticks >= fadeIn ? 1 : (float) (ticks / (float) fadeIn);
}
public float getFadeOutMultiplier() {
return ticks >= fadeOut ? 0 : (float) ((fadeOut - ticks) / (float) fadeOut);
}
/* ITickableSound */
@Override
public void update() {
if (!beginFadeOut) {
if (ticks < fadeIn) {
ticks++;
}
if (!source.shouldPlaySound()) {
beginFadeOut = true;
ticks = 0;
}
} else {
ticks++;
}
float multiplier = beginFadeOut ? getFadeOutMultiplier() : getFadeInMultiplier();
volume = baseVolume * multiplier;
if (multiplier <= 0) {
donePlaying = true;
}
}
@Override
public boolean isDonePlaying()
{
return donePlaying;
}
public void reset()
{
donePlaying = false;
beginFadeOut = false;
ticks = 0;
}
}

View file

@ -2,8 +2,6 @@ package mekanism.client.sound;
import net.minecraft.client.audio.ITickableSound; import net.minecraft.client.audio.ITickableSound;
import net.minecraft.client.audio.PositionedSound; import net.minecraft.client.audio.PositionedSound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -12,17 +10,17 @@ public class TestSound extends PositionedSound implements ITickableSound
{ {
public boolean finished = true; public boolean finished = true;
public TestSound(ResourceLocation location, TileEntity tile) public TestSound(ISoundSource source)
{ {
super(location); super(source.getSoundLocation());
this.volume = 1.0f; this.volume = getVolume();
this.field_147663_c = 1.0f; this.field_147663_c = getPitch();
this.xPosF = tile.xCoord; this.xPosF = (float)source.getSoundPosition().xPos;
this.yPosF = tile.yCoord; this.yPosF = (float)source.getSoundPosition().yPos;
this.zPosF = tile.zCoord; this.zPosF = (float)source.getSoundPosition().zPos;
this.repeat = true; this.repeat = source.shouldRepeat();
this.field_147665_h = 0; this.field_147665_h = source.getRepeatDelay();
this.field_147666_i = AttenuationType.LINEAR; this.field_147666_i = source.getAttenuation();
} }
@Override @Override

View file

@ -35,12 +35,6 @@ public class TileSound extends Sound
tileEntity = tileentity; tileEntity = tileentity;
} }
@Override
public float getMultiplier()
{
return super.getMultiplier()*((IHasSound)tileEntity).getVolumeMultiplier();
}
@Override @Override
public Pos3D getLocation() public Pos3D getLocation()
{ {

View file

@ -14,6 +14,7 @@ import mekanism.api.util.StackUtils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
/** /**
@ -39,16 +40,16 @@ public interface IFactory
public static enum RecipeType public static enum RecipeType
{ {
SMELTING("smelting", "Smelter.ogg", MachineType.ENERGIZED_SMELTER.getStack(), false, null), SMELTING("smelting", "smelter", MachineType.ENERGIZED_SMELTER.getStack(), false, null),
ENRICHING("enriching", "Chamber.ogg", MachineType.ENRICHMENT_CHAMBER.getStack(), false, Recipe.ENRICHMENT_CHAMBER), ENRICHING("enriching", "enrichment", MachineType.ENRICHMENT_CHAMBER.getStack(), false, Recipe.ENRICHMENT_CHAMBER),
CRUSHING("crushing", "Crusher.ogg", MachineType.CRUSHER.getStack(), false, Recipe.CRUSHER), CRUSHING("crushing", "crusher", MachineType.CRUSHER.getStack(), false, Recipe.CRUSHER),
COMPRESSING("compressing", "Compressor.ogg", MachineType.OSMIUM_COMPRESSOR.getStack(), true, Recipe.OSMIUM_COMPRESSOR), COMPRESSING("compressing", "compressor", MachineType.OSMIUM_COMPRESSOR.getStack(), true, Recipe.OSMIUM_COMPRESSOR),
COMBINING("combining", "Combiner.ogg", MachineType.COMBINER.getStack(), true, Recipe.COMBINER), COMBINING("combining", "combiner", MachineType.COMBINER.getStack(), true, Recipe.COMBINER),
PURIFYING("purifying", "PurificationChamber.ogg", MachineType.PURIFICATION_CHAMBER.getStack(), true, Recipe.PURIFICATION_CHAMBER), PURIFYING("purifying", "purifier", MachineType.PURIFICATION_CHAMBER.getStack(), true, Recipe.PURIFICATION_CHAMBER),
INJECTING("injecting", "ChemicalInjectionChamber.ogg", MachineType.CHEMICAL_INJECTION_CHAMBER.getStack(), true, Recipe.CHEMICAL_INJECTION_CHAMBER); INJECTING("injecting", "injection", MachineType.CHEMICAL_INJECTION_CHAMBER.getStack(), true, Recipe.CHEMICAL_INJECTION_CHAMBER);
private String name; private String name;
private String sound; private ResourceLocation sound;
private ItemStack stack; private ItemStack stack;
private boolean usesFuel; private boolean usesFuel;
private Recipe recipe; private Recipe recipe;
@ -188,7 +189,7 @@ public interface IFactory
return MekanismUtils.localize("gui.factory." + name); return MekanismUtils.localize("gui.factory." + name);
} }
public String getSound() public ResourceLocation getSound()
{ {
return sound; return sound;
} }
@ -201,7 +202,7 @@ public interface IFactory
private RecipeType(String s, String s1, ItemStack is, boolean b, Recipe r) private RecipeType(String s, String s1, ItemStack is, boolean b, Recipe r)
{ {
name = s; name = s;
sound = s1; sound = new ResourceLocation("mekanism", s1);
stack = is; stack = is;
usesFuel = b; usesFuel = b;
recipe = r; recipe = r;

View file

@ -5,9 +5,13 @@ import io.netty.buffer.ByteBuf;
import java.util.ArrayList; import java.util.ArrayList;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.Pos3D;
import mekanism.api.Range4D; import mekanism.api.Range4D;
import mekanism.api.MekanismConfig.general; import mekanism.api.MekanismConfig.general;
import mekanism.client.sound.IHasSound; import mekanism.client.sound.IHasSound;
import mekanism.client.sound.ISoundSource;
import mekanism.client.sound.SoundTile;
import mekanism.client.sound.TestSound;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.SideData; import mekanism.common.SideData;
import mekanism.common.base.IActiveState; import mekanism.common.base.IActiveState;
@ -20,15 +24,19 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.component.TileComponentEjector; import mekanism.common.tile.component.TileComponentEjector;
import mekanism.common.tile.component.TileComponentUpgrade; import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.ISound.AttenuationType;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.Optional.Interface; import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method; import cpw.mods.fml.common.Optional.Method;
import dan200.computercraft.api.peripheral.IComputerAccess; import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") @Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public abstract class TileEntityBasicMachine extends TileEntityElectricBlock implements IElectricMachine, IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl public abstract class TileEntityBasicMachine extends TileEntityNoisyElectricBlock implements IElectricMachine, IPeripheral, IInvConfiguration, IUpgradeTile, IRedstoneControl
{ {
/** This machine's side configuration. */ /** This machine's side configuration. */
public byte[] sideConfig; public byte[] sideConfig;
@ -36,9 +44,6 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
/** An arraylist of SideData for this machine. */ /** An arraylist of SideData for this machine. */
public ArrayList<SideData> sideOutputs = new ArrayList<SideData>(); public ArrayList<SideData> sideOutputs = new ArrayList<SideData>();
/** The bundled URL of this machine's sound effect */
public String soundURL;
/** How much energy this machine uses per tick. */ /** How much energy this machine uses per tick. */
public double ENERGY_PER_TICK; public double ENERGY_PER_TICK;
@ -80,10 +85,9 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
*/ */
public TileEntityBasicMachine(String soundPath, String name, ResourceLocation location, double perTick, int ticksRequired, double maxEnergy) public TileEntityBasicMachine(String soundPath, String name, ResourceLocation location, double perTick, int ticksRequired, double maxEnergy)
{ {
super(name, maxEnergy); super("machine." + soundPath, name, maxEnergy);
ENERGY_PER_TICK = perTick; ENERGY_PER_TICK = perTick;
TICKS_REQUIRED = ticksRequired; TICKS_REQUIRED = ticksRequired;
soundURL = soundPath;
guiLocation = location; guiLocation = location;
isActive = false; isActive = false;
} }
@ -291,18 +295,6 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
return facing; return facing;
} }
@Override
public String getSoundPath()
{
return soundURL;
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public boolean renderUpdate() public boolean renderUpdate()
{ {

View file

@ -29,7 +29,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyContainerItem; import cofh.api.energy.IEnergyContainerItem;
public class TileEntityChargepad extends TileEntityElectricBlock implements IActiveState, IHasSound public class TileEntityChargepad extends TileEntityNoisyElectricBlock
{ {
public boolean isActive; public boolean isActive;
@ -39,7 +39,7 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
public TileEntityChargepad() public TileEntityChargepad()
{ {
super("Chargepad", MachineType.CHARGEPAD.baseEnergy); super("chargepad", "Chargepad", MachineType.CHARGEPAD.baseEnergy);
inventory = new ItemStack[0]; inventory = new ItemStack[0];
} }
@ -217,13 +217,7 @@ public class TileEntityChargepad extends TileEntityElectricBlock implements IAct
} }
@Override @Override
public String getSoundPath() public float getVolume()
{
return "Chargepad.ogg";
}
@Override
public float getVolumeMultiplier()
{ {
return 0.4F; return 0.4F;
} }

View file

@ -41,7 +41,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IInvConfiguration, IUpgradeTile, ISustainedData public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IInvConfiguration, IUpgradeTile, ISustainedData
{ {
public static final int MAX_GAS = 10000; public static final int MAX_GAS = 10000;
public static final int MAX_FLUID = 10000; public static final int MAX_FLUID = 10000;
@ -82,7 +82,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
public TileEntityChemicalCrystallizer() public TileEntityChemicalCrystallizer()
{ {
super("ChemicalCrystallizer", MachineType.CHEMICAL_CRYSTALLIZER.baseEnergy); super("crystallizer", "ChemicalCrystallizer", MachineType.CHEMICAL_CRYSTALLIZER.baseEnergy);
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {0})); sideOutputs.add(new SideData(EnumColor.PURPLE, new int[] {0}));
@ -469,18 +469,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
return InventoryUtils.EMPTY; return InventoryUtils.EMPTY;
} }
@Override
public String getSoundPath()
{
return "ChemicalCrystallizer.ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public ArrayList<SideData> getSideData() public ArrayList<SideData> getSideData()
{ {

View file

@ -34,7 +34,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IGasHandler, IUpgradeTile, ISustainedData public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectricBlock implements ITubeConnection, IRedstoneControl, IGasHandler, IUpgradeTile, ISustainedData
{ {
public GasTank injectTank = new GasTank(MAX_GAS); public GasTank injectTank = new GasTank(MAX_GAS);
public GasTank outputTank = new GasTank(MAX_GAS); public GasTank outputTank = new GasTank(MAX_GAS);
@ -65,7 +65,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
public TileEntityChemicalDissolutionChamber() public TileEntityChemicalDissolutionChamber()
{ {
super("ChemicalDissolutionChamber", MachineType.CHEMICAL_DISSOLUTION_CHAMBER.baseEnergy); super("machine.dissolution", "ChemicalDissolutionChamber", MachineType.CHEMICAL_DISSOLUTION_CHAMBER.baseEnergy);
inventory = new ItemStack[5]; inventory = new ItemStack[5];
} }
@ -396,18 +396,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
MekanismUtils.saveChunk(this); MekanismUtils.saveChunk(this);
} }
@Override
public String getSoundPath()
{
return "ChemicalDissolutionChamber.ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public int receiveGas(ForgeDirection side, GasStack stack, boolean doTransfer) public int receiveGas(ForgeDirection side, GasStack stack, boolean doTransfer)
{ {

View file

@ -33,7 +33,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChemicalInfuser extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, ISustainedData public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, ISustainedData
{ {
public GasTank leftTank = new GasTank(MAX_GAS); public GasTank leftTank = new GasTank(MAX_GAS);
public GasTank rightTank = new GasTank(MAX_GAS); public GasTank rightTank = new GasTank(MAX_GAS);
@ -58,7 +58,7 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
public TileEntityChemicalInfuser() public TileEntityChemicalInfuser()
{ {
super("ChemicalInfuser", MachineType.CHEMICAL_INFUSER.baseEnergy); super("machine.cheminfuser", "ChemicalInfuser", MachineType.CHEMICAL_INFUSER.baseEnergy);
inventory = new ItemStack[4]; inventory = new ItemStack[4];
} }
@ -315,21 +315,6 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
return null; return null;
} }
public int getScaledLeftGasLevel(int i)
{
return leftTank != null ? leftTank.getStored()*i / MAX_GAS : 0;
}
public int getScaledRightGasLevel(int i)
{
return rightTank != null ? rightTank.getStored()*i / MAX_GAS : 0;
}
public int getScaledCenterGasLevel(int i)
{
return centerTank != null ? centerTank.getStored()*i / MAX_GAS : 0;
}
@Override @Override
public void setActive(boolean active) public void setActive(boolean active)
{ {
@ -468,18 +453,6 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
return InventoryUtils.EMPTY; return InventoryUtils.EMPTY;
} }
@Override
public String getSoundPath()
{
return "ChemicalInfuser.ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public void writeSustainedData(ItemStack itemStack) public void writeSustainedData(ItemStack itemStack)
{ {

View file

@ -22,7 +22,7 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
{ {
public TileEntityChemicalInjectionChamber() public TileEntityChemicalInjectionChamber()
{ {
super("ChemicalInjectionChamber.ogg", "ChemicalInjectionChamber", usage.chemicalInjectionChamberUsage, 1, 200, MachineType.CHEMICAL_INJECTION_CHAMBER.baseEnergy); super("injection", "ChemicalInjectionChamber", usage.chemicalInjectionChamberUsage, 1, 200, MachineType.CHEMICAL_INJECTION_CHAMBER.baseEnergy);
} }
@Override @Override

View file

@ -33,7 +33,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound, IUpgradeTile, ISustainedData public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock implements ITubeConnection, IRedstoneControl, IUpgradeTile, ISustainedData
{ {
public GasTank gasTank = new GasTank(MAX_GAS); public GasTank gasTank = new GasTank(MAX_GAS);
@ -61,7 +61,7 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
public TileEntityChemicalOxidizer() public TileEntityChemicalOxidizer()
{ {
super("ChemicalOxidizer", MachineType.CHEMICAL_OXIDIZER.baseEnergy); super("machine.oxidiser", "ChemicalOxidizer", MachineType.CHEMICAL_OXIDIZER.baseEnergy);
inventory = new ItemStack[4]; inventory = new ItemStack[4];
} }
@ -295,11 +295,6 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
return MekanismUtils.getMaxEnergy(this, MAX_ELECTRICITY); return MekanismUtils.getMaxEnergy(this, MAX_ELECTRICITY);
} }
public int getScaledGasLevel(int i)
{
return gasTank.getGas() != null ? gasTank.getStored()*i / MAX_GAS : 0;
}
@Override @Override
public void setActive(boolean active) public void setActive(boolean active)
{ {
@ -351,18 +346,6 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
MekanismUtils.saveChunk(this); MekanismUtils.saveChunk(this);
} }
@Override
public String getSoundPath()
{
return "ChemicalInfuser.ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public TileComponentUpgrade getComponent() public TileComponentUpgrade getComponent()
{ {

View file

@ -43,7 +43,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.IFluidHandler;
public class TileEntityChemicalWasher extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound, IFluidHandler, ISustainedData public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandler, ISustainedData
{ {
public FluidTank fluidTank = new FluidTank(MAX_FLUID); public FluidTank fluidTank = new FluidTank(MAX_FLUID);
public GasTank inputTank = new GasTank(MAX_GAS); public GasTank inputTank = new GasTank(MAX_GAS);
@ -71,7 +71,7 @@ public class TileEntityChemicalWasher extends TileEntityElectricBlock implements
public TileEntityChemicalWasher() public TileEntityChemicalWasher()
{ {
super("ChemicalWasher", MachineType.CHEMICAL_WASHER.baseEnergy); super("washer", "ChemicalWasher", MachineType.CHEMICAL_WASHER.baseEnergy);
inventory = new ItemStack[4]; inventory = new ItemStack[4];
} }
@ -533,18 +533,6 @@ public class TileEntityChemicalWasher extends TileEntityElectricBlock implements
return InventoryUtils.EMPTY; return InventoryUtils.EMPTY;
} }
@Override
public String getSoundPath()
{
return "ChemicalWasher.ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{ {

View file

@ -17,7 +17,7 @@ public class TileEntityCombiner extends TileEntityAdvancedElectricMachine
{ {
public TileEntityCombiner() public TileEntityCombiner()
{ {
super("Combiner.ogg", "Combiner", usage.combinerUsage, 1, 200, MachineType.COMBINER.baseEnergy); super("combiner", "Combiner", usage.combinerUsage, 1, 200, MachineType.COMBINER.baseEnergy);
} }
@Override @Override

View file

@ -16,35 +16,11 @@ import cpw.mods.fml.client.FMLClientHandler;
public class TileEntityCrusher extends TileEntityElectricMachine public class TileEntityCrusher extends TileEntityElectricMachine
{ {
public TestSound sfx;
public TileEntityCrusher() public TileEntityCrusher()
{ {
super("Crusher.ogg", "Crusher", usage.crusherUsage, 200, MachineType.CRUSHER.baseEnergy); super("crusher", "Crusher", usage.crusherUsage, 200, MachineType.CRUSHER.baseEnergy);
} }
@Override
public void onUpdate()
{
super.onUpdate();
if(worldObj.isRemote)
{
if(isActive && sfx.isDonePlaying())
{
Mekanism.logger.info("Playing Crusher noise");
sfx.finished = false;
FMLClientHandler.instance().getClient().getSoundHandler().playSound(sfx);
}
else if(!(isActive || sfx.isDonePlaying()))
{
Mekanism.logger.info("Stopping Crusher noise");
sfx.finished = true;
}
}
}
@Override @Override
public Map getRecipes() public Map getRecipes()
{ {
@ -52,22 +28,8 @@ public class TileEntityCrusher extends TileEntityElectricMachine
} }
@Override @Override
public float getVolumeMultiplier() public float getVolume()
{ {
return 0.5F; return 0.5F;
} }
@Override
public void validate()
{
super.validate();
sfx = new TestSound(new ResourceLocation("mekanism", "tile.machine.crusher"), this);
}
@Override
public void invalidate()
{
super.invalidate();
sfx.finished = true;
}
} }

View file

@ -13,7 +13,7 @@ public class TileEntityEnergizedSmelter extends TileEntityElectricMachine
public TileEntityEnergizedSmelter() public TileEntityEnergizedSmelter()
{ {
super("Smelter.ogg", "EnergizedSmelter", usage.energizedSmelterUsage, 200, MachineType.ENERGIZED_SMELTER.baseEnergy); super("smelter", "EnergizedSmelter", usage.energizedSmelterUsage, 200, MachineType.ENERGIZED_SMELTER.baseEnergy);
} }
@Override @Override

View file

@ -10,7 +10,7 @@ public class TileEntityEnrichmentChamber extends TileEntityElectricMachine
{ {
public TileEntityEnrichmentChamber() public TileEntityEnrichmentChamber()
{ {
super("Chamber.ogg", "EnrichmentChamber", usage.enrichmentChamberUsage, 200, MachineType.ENRICHMENT_CHAMBER.baseEnergy); super("enrichment", "EnrichmentChamber", usage.enrichmentChamberUsage, 200, MachineType.ENRICHMENT_CHAMBER.baseEnergy);
} }
@Override @Override
@ -20,7 +20,7 @@ public class TileEntityEnrichmentChamber extends TileEntityElectricMachine
} }
@Override @Override
public float getVolumeMultiplier() public float getVolume()
{ {
return 0.3F; return 0.3F;
} }

View file

@ -39,6 +39,7 @@ import mekanism.api.util.StackUtils;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Interface; import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method; import cpw.mods.fml.common.Optional.Method;
@ -47,7 +48,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") @Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityFactory extends TileEntityElectricBlock implements IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl, IGasHandler, ITubeConnection public class TileEntityFactory extends TileEntityNoisyElectricBlock implements IPeripheral, IInvConfiguration, IUpgradeTile, IRedstoneControl, IGasHandler, ITubeConnection
{ {
/** This Factory's tier. */ /** This Factory's tier. */
public FactoryTier tier; public FactoryTier tier;
@ -114,7 +115,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
public TileEntityFactory(FactoryTier type, MachineType machine) public TileEntityFactory(FactoryTier type, MachineType machine)
{ {
super(type.name + "Factory", machine.baseEnergy); super("null", type.name + "Factory", machine.baseEnergy);
tier = type; tier = type;
inventory = new ItemStack[5+type.processes*2]; inventory = new ItemStack[5+type.processes*2];
@ -829,17 +830,11 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
} }
@Override @Override
public String getSoundPath() public ResourceLocation getSoundLocation()
{ {
return RecipeType.values()[recipeType].getSound(); return RecipeType.values()[recipeType].getSound();
} }
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public boolean renderUpdate() public boolean renderUpdate()
{ {

View file

@ -42,7 +42,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") @Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implements IPeripheral, IActiveState, IInvConfiguration, IUpgradeTile, IHasSound, IRedstoneControl public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock implements IPeripheral, IInvConfiguration, IUpgradeTile, IRedstoneControl
{ {
/** This machine's side configuration. */ /** This machine's side configuration. */
public byte[] sideConfig = new byte[] {2, 1, 0, 5, 3, 4}; public byte[] sideConfig = new byte[] {2, 1, 0, 5, 3, 4};
@ -88,7 +88,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
public TileEntityMetallurgicInfuser() public TileEntityMetallurgicInfuser()
{ {
super("MetallurgicInfuser", MachineType.METALLURGIC_INFUSER.baseEnergy); super("metalinfuser", "MetallurgicInfuser", MachineType.METALLURGIC_INFUSER.baseEnergy);
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {0})); sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {0}));
@ -548,18 +548,6 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
return facing; return facing;
} }
@Override
public String getSoundPath()
{
return "MetallurgicInfuser.ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public boolean renderUpdate() public boolean renderUpdate()
{ {

View file

@ -0,0 +1,107 @@
package mekanism.common.tile;
import mekanism.api.Pos3D;
import mekanism.client.sound.IHasSound;
import mekanism.client.sound.ISoundSource;
import mekanism.client.sound.SoundTile;
import mekanism.common.Mekanism;
import mekanism.common.base.IActiveState;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.ISound.AttenuationType;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.client.FMLClientHandler;
public abstract class TileEntityNoisyElectricBlock extends TileEntityElectricBlock implements IHasSound, ISoundSource, IActiveState
{
/** The ResourceLocation of the machine's sound */
public ResourceLocation soundURL;
/** The bundled URL of this machine's sound effect */
public SoundTile sound;
/**
* The base of all blocks that deal with electricity and make noise.
*
* @param name - full name of this block
* @param maxEnergy - how much energy this block can store
*/
public TileEntityNoisyElectricBlock(String soundPath, String name, double maxEnergy)
{
super(name, maxEnergy);
soundURL = new ResourceLocation("mekanism", "tile." + soundPath);
}
@Override
public ISound getSound()
{
return sound;
}
@Override
public boolean shouldPlaySound()
{
return getActive() && !isInvalid();
}
@Override
public ResourceLocation getSoundLocation()
{
return soundURL;
}
@Override
public float getVolume()
{
return 1F;
}
@Override
public float getPitch()
{
return 1F;
}
@Override
public Pos3D getSoundPosition()
{
return new Pos3D(xCoord+0.5, yCoord+0.5, zCoord+0.5);
}
@Override
public boolean shouldRepeat()
{
return true;
}
@Override
public int getRepeatDelay()
{
return 0;
}
@Override
public AttenuationType getAttenuation()
{
return AttenuationType.LINEAR;
}
@Override
public void validate()
{
super.validate();
sound = new SoundTile(this, this);
}
@Override
public void onUpdate()
{
if(worldObj.isRemote && shouldPlaySound() && sound.isDonePlaying())
{
Mekanism.logger.info("Playing " + this.fullName + " noise");
sound.reset();
FMLClientHandler.instance().getClient().getSoundHandler().playSound(sound);
}
}
}

View file

@ -15,7 +15,7 @@ public class TileEntityOsmiumCompressor extends TileEntityAdvancedElectricMachin
{ {
public TileEntityOsmiumCompressor() public TileEntityOsmiumCompressor()
{ {
super("Compressor.ogg", "OsmiumCompressor", usage.osmiumCompressorUsage, 1, 200, MachineType.OSMIUM_COMPRESSOR.baseEnergy); super("compressor", "OsmiumCompressor", usage.osmiumCompressorUsage, 1, 200, MachineType.OSMIUM_COMPRESSOR.baseEnergy);
} }
@Override @Override

View file

@ -51,7 +51,7 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
public TileEntityPRC() public TileEntityPRC()
{ {
super("PressurizedReactionChamber.ogg", "PressurizedReactionChamber", new ResourceLocation("mekanism", "gui/GuiPRC.png"), usage.pressurizedReactionBaseUsage, 100, MachineType.PRESSURIZED_REACTION_CHAMBER.baseEnergy); super("prc", "PressurizedReactionChamber", new ResourceLocation("mekanism", "gui/GuiPRC.png"), usage.pressurizedReactionBaseUsage, 100, MachineType.PRESSURIZED_REACTION_CHAMBER.baseEnergy);
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY)); sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
sideOutputs.add(new SideData(EnumColor.DARK_RED, new int[] {0})); sideOutputs.add(new SideData(EnumColor.DARK_RED, new int[] {0}));

View file

@ -12,7 +12,7 @@ public class TileEntityPrecisionSawmill extends TileEntityChanceMachine
{ {
public TileEntityPrecisionSawmill() public TileEntityPrecisionSawmill()
{ {
super("PrecisionSawmill.ogg", "PrecisionSawmill", MekanismUtils.getResource(ResourceType.GUI, "GuiBasicMachine.png"), usage.precisionSawmillUsage, 200, MachineType.PRECISION_SAWMILL.baseEnergy); super("sawmill", "PrecisionSawmill", MekanismUtils.getResource(ResourceType.GUI, "GuiBasicMachine.png"), usage.precisionSawmillUsage, 200, MachineType.PRECISION_SAWMILL.baseEnergy);
} }
@Override @Override
@ -22,7 +22,7 @@ public class TileEntityPrecisionSawmill extends TileEntityChanceMachine
} }
@Override @Override
public float getVolumeMultiplier() public float getVolume()
{ {
return 0.7F; return 0.7F;
} }

View file

@ -22,7 +22,7 @@ public class TileEntityPurificationChamber extends TileEntityAdvancedElectricMac
{ {
public TileEntityPurificationChamber() public TileEntityPurificationChamber()
{ {
super("PurificationChamber.ogg", "PurificationChamber", usage.purificationChamberUsage, 1, 200, MachineType.PURIFICATION_CHAMBER.baseEnergy); super("purification", "PurificationChamber", usage.purificationChamberUsage, 1, 200, MachineType.PURIFICATION_CHAMBER.baseEnergy);
} }
@Override @Override

View file

@ -81,7 +81,7 @@ public class GuiWindTurbine extends GuiMekanism
int guiHeight = (height - ySize) / 2; int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize); drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
drawTexturedModalRect(guiWidth + 20, guiHeight + 37, 176, (tileEntity.getVolumeMultiplier() > 0 ? 52 : 64), 12, 12); drawTexturedModalRect(guiWidth + 20, guiHeight + 37, 176, (tileEntity.getActive() ? 52 : 64), 12, 12);
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY); super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
} }

View file

@ -30,16 +30,12 @@ import dan200.computercraft.api.peripheral.IComputerAccess;
public class TileEntityBioGenerator extends TileEntityGenerator implements IFluidHandler, ISustainedData public class TileEntityBioGenerator extends TileEntityGenerator implements IFluidHandler, ISustainedData
{ {
/** The Sound instance for this machine. */
@SideOnly(Side.CLIENT)
public TileSound audio;
/** The FluidSlot biofuel instance for this generator. */ /** The FluidSlot biofuel instance for this generator. */
public FluidSlot bioFuelSlot = new FluidSlot(24000, -1); public FluidSlot bioFuelSlot = new FluidSlot(24000, -1);
public TileEntityBioGenerator() public TileEntityBioGenerator()
{ {
super("BioGenerator", 160000, generators.bioGeneration*2); super("bio", "BioGenerator", 160000, generators.bioGeneration*2);
inventory = new ItemStack[2]; inventory = new ItemStack[2];
} }

View file

@ -39,7 +39,7 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
public TileEntityGasGenerator() public TileEntityGasGenerator()
{ {
super("GasGenerator", general.FROM_H2*100, general.FROM_H2*2); super("gas", "GasGenerator", general.FROM_H2*100, general.FROM_H2*2);
inventory = new ItemStack[2]; inventory = new ItemStack[2];
fuelTank = new GasTank(MAX_GAS); fuelTank = new GasTank(MAX_GAS);
} }

View file

@ -6,18 +6,26 @@ import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.Pos3D;
import mekanism.api.Range4D; import mekanism.api.Range4D;
import mekanism.api.MekanismConfig.general; import mekanism.api.MekanismConfig.general;
import mekanism.client.sound.IHasSound; import mekanism.client.sound.IHasSound;
import mekanism.client.sound.ISoundSource;
import mekanism.client.sound.SoundTile;
import mekanism.common.Mekanism; import mekanism.common.Mekanism;
import mekanism.common.base.IActiveState; import mekanism.common.base.IActiveState;
import mekanism.common.base.IRedstoneControl; import mekanism.common.base.IRedstoneControl;
import mekanism.common.network.PacketTileEntity.TileEntityMessage; import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityElectricBlock; import mekanism.common.tile.TileEntityElectricBlock;
import mekanism.common.tile.TileEntityNoisyElectricBlock;
import mekanism.common.util.CableUtils; import mekanism.common.util.CableUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import net.minecraft.client.audio.ISound;
import net.minecraft.client.audio.ISound.AttenuationType;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Interface; import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.Method; import cpw.mods.fml.common.Optional.Method;
@ -27,7 +35,7 @@ import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral; import dan200.computercraft.api.peripheral.IPeripheral;
@Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft") @Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
public abstract class TileEntityGenerator extends TileEntityElectricBlock implements IPeripheral, IActiveState, IHasSound, IRedstoneControl public abstract class TileEntityGenerator extends TileEntityNoisyElectricBlock implements IPeripheral, IActiveState, IHasSound, ISoundSource, IRedstoneControl
{ {
/** Output per tick this generator can transfer. */ /** Output per tick this generator can transfer. */
public double output; public double output;
@ -49,9 +57,9 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
* @param name - full name of this generator * @param name - full name of this generator
* @param maxEnergy - how much energy this generator can store * @param maxEnergy - how much energy this generator can store
*/ */
public TileEntityGenerator(String name, double maxEnergy, double out) public TileEntityGenerator(String soundPath, String name, double maxEnergy, double out)
{ {
super(name, maxEnergy); super("gen." + soundPath, name, maxEnergy);
if(MekanismUtils.useBuildCraft()) if(MekanismUtils.useBuildCraft())
{ {
@ -123,14 +131,11 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
} }
@Override @Override
public void invalidate() public void validate()
{ {
super.invalidate(); super.validate();
if(worldObj.isRemote) sound = new SoundTile(this, this);
{
Mekanism.proxy.unregisterSound(this);
}
} }
/** /**
@ -239,18 +244,6 @@ public abstract class TileEntityGenerator extends TileEntityElectricBlock implem
return INFINITE_EXTENT_AABB; return INFINITE_EXTENT_AABB;
} }
@Override
public String getSoundPath()
{
return fullName.replace("Advanced", "") + ".ogg";
}
@Override
public float getVolumeMultiplier()
{
return 1;
}
@Override @Override
public boolean renderUpdate() public boolean renderUpdate()
{ {

View file

@ -36,7 +36,7 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements IFlu
public TileEntityHeatGenerator() public TileEntityHeatGenerator()
{ {
super("HeatGenerator", 160000, generators.heatGeneration*2); super("heat", "HeatGenerator", 160000, generators.heatGeneration*2);
inventory = new ItemStack[2]; inventory = new ItemStack[2];
} }

View file

@ -29,14 +29,13 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
public TileEntitySolarGenerator() public TileEntitySolarGenerator()
{ {
super("SolarGenerator", 96000, generators.solarGeneration*2); this("SolarGenerator", 96000, generators.solarGeneration*2);
GENERATION_RATE = generators.solarGeneration; GENERATION_RATE = generators.solarGeneration;
inventory = new ItemStack[1];
} }
public TileEntitySolarGenerator(String name, double maxEnergy, double output) public TileEntitySolarGenerator(String name, double maxEnergy, double output)
{ {
super(name, maxEnergy, output); super("solar", name, maxEnergy, output);
inventory = new ItemStack[1]; inventory = new ItemStack[1];
} }
@ -47,7 +46,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator
} }
@Override @Override
public float getVolumeMultiplier() public float getVolume()
{ {
return 0.05F; return 0.05F;
} }

View file

@ -19,7 +19,7 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound
public TileEntityWindTurbine() public TileEntityWindTurbine()
{ {
super("WindTurbine", 200000, (generators.windGenerationMax)*2); super("wind", "WindTurbine", 200000, (generators.windGenerationMax)*2);
inventory = new ItemStack[1]; inventory = new ItemStack[1];
} }
@ -67,7 +67,7 @@ public class TileEntityWindTurbine extends TileEntityGenerator implements IBound
} }
@Override @Override
public float getVolumeMultiplier() public float getVolume()
{ {
return 1.5F; return 1.5F;
} }

View file

@ -7,5 +7,27 @@
"etc.Hydraulic": {"category": "master","sounds": [{"name": "etc/Hydraulic","stream": false}]}, "etc.Hydraulic": {"category": "master","sounds": [{"name": "etc/Hydraulic","stream": false}]},
"etc.Pop": {"category": "master","sounds": [{"name": "etc/Pop","stream": false}]}, "etc.Pop": {"category": "master","sounds": [{"name": "etc/Pop","stream": false}]},
"etc.Success": {"category": "master","sounds": [{"name": "etc/Success","stream": false}]}, "etc.Success": {"category": "master","sounds": [{"name": "etc/Success","stream": false}]},
"tile.machine.crusher": {"category": "block", "sounds": [{"name": "Crusher","stream": false}]}
"tile.machine.chargepad": {"category": "block", "sounds": [{"name": "Chargepad","stream": false}]},
"tile.machine.crystallizer": {"category": "block", "sounds": [{"name": "ChemicalCrystallizer","stream": false}]},
"tile.machine.dissolution": {"category": "block", "sounds": [{"name": "ChemicalDissolutionChamber","stream": false}]},
"tile.machine.cheminfuser": {"category": "block", "sounds": [{"name": "ChemicalInfuser","stream": false}]},
"tile.machine.injection": {"category": "block", "sounds": [{"name": "ChemicalInjectionChamber","stream": false}]},
"tile.machine.oxidizer": {"category": "block", "sounds": [{"name": "ChemicalOxidizer","stream": false}]},
"tile.machine.washer": {"category": "block", "sounds": [{"name": "ChemicalWasher","stream": false}]},
"tile.machine.combiner": {"category": "block", "sounds": [{"name": "Combiner","stream": false}]},
"tile.machine.compressor": {"category": "block", "sounds": [{"name": "Compressor","stream": false}]},
"tile.machine.crusher": {"category": "block", "sounds": [{"name": "Crusher","stream": false}]},
"tile.machine.enrichment": {"category": "block", "sounds": [{"name": "EnrichmentChamber","stream": false}]},
"tile.machine.metalinfuser": {"category": "block", "sounds": [{"name": "MetallurgicInfuser","stream": false}]},
"tile.machine.sawmill": {"category": "block", "sounds": [{"name": "PrecisionSawmill","stream": false}]},
"tile.machine.prc": {"category": "block", "sounds": [{"name": "PressurizedReactionChamber","stream": false}]},
"tile.machine.purification": {"category": "block", "sounds": [{"name": "PurificationChamber","stream": false}]},
"tile.machine.smelter": {"category": "block", "sounds": [{"name": "Smelter","stream": false}]},
"tile.gen.bio": {"category": "block", "sounds": [{"name": "BioGenerator","stream": false}]},
"tile.gen.gas": {"category": "block", "sounds": [{"name": "GasGenerator","stream": false}]},
"tile.gen.heat": {"category": "block", "sounds": [{"name": "HeatGenerator","stream": false}]},
"tile.gen.solar": {"category": "block", "sounds": [{"name": "SolarGenerator","stream": false}]},
"tile.gen.wind": {"category": "block", "sounds": [{"name": "WindTurbine","stream": false}]}
} }