Better textures, sounds for Chemical Infuser, Chemical Oxidizer & Precision Sawmill, sounds now fade in
This commit is contained in:
parent
8f6b618328
commit
71cfd3cd84
11 changed files with 78 additions and 37 deletions
common/mekanism
api
client/sound
common/tile
resources/assets/mekanism
|
@ -29,7 +29,7 @@ public class ChanceOutput
|
||||||
|
|
||||||
public boolean checkSecondary()
|
public boolean checkSecondary()
|
||||||
{
|
{
|
||||||
return rand.nextDouble() >= secondaryChance;
|
return rand.nextDouble() <= secondaryChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPrimary()
|
public boolean hasPrimary()
|
||||||
|
|
|
@ -9,8 +9,6 @@ public abstract class PlayerSound extends Sound
|
||||||
/** The TileEntity this sound is associated with. */
|
/** The TileEntity this sound is associated with. */
|
||||||
public EntityPlayer player;
|
public EntityPlayer player;
|
||||||
|
|
||||||
public int ticksSincePlay = 0;
|
|
||||||
|
|
||||||
public PlayerSound(String id, String sound, EntityPlayer entity)
|
public PlayerSound(String id, String sound, EntityPlayer entity)
|
||||||
{
|
{
|
||||||
super(id, sound, entity, new Pos3D(entity));
|
super(id, sound, entity, new Pos3D(entity));
|
||||||
|
@ -21,7 +19,7 @@ public abstract class PlayerSound extends Sound
|
||||||
@Override
|
@Override
|
||||||
public float getMultiplier()
|
public float getMultiplier()
|
||||||
{
|
{
|
||||||
return Math.min(1, ((float)ticksSincePlay/20F))*0.3F;
|
return super.getMultiplier()*0.3F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,12 +46,4 @@ public abstract class PlayerSound extends Sound
|
||||||
{
|
{
|
||||||
return new Pos3D(player);
|
return new Pos3D(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void play()
|
|
||||||
{
|
|
||||||
super.play();
|
|
||||||
|
|
||||||
ticksSincePlay = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ public abstract class Sound
|
||||||
/** Whether or not this sound is playing */
|
/** Whether or not this sound is playing */
|
||||||
public boolean isPlaying = false;
|
public boolean isPlaying = false;
|
||||||
|
|
||||||
|
public int ticksSincePlay = 0;
|
||||||
|
|
||||||
private Object objRef;
|
private Object objRef;
|
||||||
|
|
||||||
protected Minecraft mc = Minecraft.getMinecraft();
|
protected Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
@ -71,6 +73,8 @@ public abstract class Sound
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ticksSincePlay = 0;
|
||||||
|
|
||||||
if(SoundHandler.getSoundSystem() != null)
|
if(SoundHandler.getSoundSystem() != null)
|
||||||
{
|
{
|
||||||
updateVolume();
|
updateVolume();
|
||||||
|
@ -129,7 +133,10 @@ public abstract class Sound
|
||||||
|
|
||||||
public abstract Pos3D getLocation();
|
public abstract Pos3D getLocation();
|
||||||
|
|
||||||
public abstract float getMultiplier();
|
public float getMultiplier()
|
||||||
|
{
|
||||||
|
return Math.min(1, ((float)ticksSincePlay/30F));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the volume based on how far away the player is from the machine.
|
* Updates the volume based on how far away the player is from the machine.
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class TileSound extends Sound
|
||||||
@Override
|
@Override
|
||||||
public float getMultiplier()
|
public float getMultiplier()
|
||||||
{
|
{
|
||||||
return ((IHasSound)tileEntity).getVolumeMultiplier();
|
return super.getMultiplier()*((IHasSound)tileEntity).getVolumeMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,6 +76,11 @@ public class TileSound extends Sound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isPlaying)
|
||||||
|
{
|
||||||
|
ticksSincePlay++;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,30 +151,36 @@ public class TileEntityChanceMachine extends TileEntityBasicMachine
|
||||||
|
|
||||||
if(output.hasPrimary())
|
if(output.hasPrimary())
|
||||||
{
|
{
|
||||||
if(inventory[2] != null && !inventory[2].isItemEqual(output.primaryOutput))
|
if(inventory[2] != null)
|
||||||
{
|
{
|
||||||
return false;
|
if(!inventory[2].isItemEqual(output.primaryOutput))
|
||||||
}
|
{
|
||||||
else {
|
return false;
|
||||||
if(inventory[2].stackSize + output.primaryOutput.stackSize > inventory[2].getMaxStackSize())
|
}
|
||||||
{
|
else {
|
||||||
return false;
|
if(inventory[2].stackSize + output.primaryOutput.stackSize > inventory[2].getMaxStackSize())
|
||||||
}
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(output.hasSecondary())
|
if(output.hasSecondary())
|
||||||
{
|
{
|
||||||
if(inventory[4] != null && !inventory[4].isItemEqual(output.secondaryOutput))
|
if(inventory[4] != null)
|
||||||
{
|
{
|
||||||
return false;
|
if(!inventory[4].isItemEqual(output.secondaryOutput))
|
||||||
}
|
{
|
||||||
else {
|
return false;
|
||||||
if(inventory[4].stackSize + output.secondaryOutput.stackSize > inventory[4].getMaxStackSize())
|
}
|
||||||
{
|
else {
|
||||||
return false;
|
if(inventory[4].stackSize + output.secondaryOutput.stackSize > inventory[4].getMaxStackSize())
|
||||||
}
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -11,7 +11,11 @@ import mekanism.api.gas.GasTransmission;
|
||||||
import mekanism.api.gas.IGasHandler;
|
import mekanism.api.gas.IGasHandler;
|
||||||
import mekanism.api.gas.IGasItem;
|
import mekanism.api.gas.IGasItem;
|
||||||
import mekanism.api.gas.ITubeConnection;
|
import mekanism.api.gas.ITubeConnection;
|
||||||
import mekanism.common.*;
|
import mekanism.client.sound.IHasSound;
|
||||||
|
import mekanism.common.IActiveState;
|
||||||
|
import mekanism.common.IRedstoneControl;
|
||||||
|
import mekanism.common.Mekanism;
|
||||||
|
import mekanism.common.PacketHandler;
|
||||||
import mekanism.common.PacketHandler.Transmission;
|
import mekanism.common.PacketHandler.Transmission;
|
||||||
import mekanism.common.block.BlockMachine.MachineType;
|
import mekanism.common.block.BlockMachine.MachineType;
|
||||||
import mekanism.common.network.PacketTileEntity;
|
import mekanism.common.network.PacketTileEntity;
|
||||||
|
@ -27,7 +31,7 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
public class TileEntityChemicalInfuser extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl
|
public class TileEntityChemicalInfuser extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IHasSound
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
@ -61,6 +65,8 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
|
||||||
{
|
{
|
||||||
if(worldObj.isRemote)
|
if(worldObj.isRemote)
|
||||||
{
|
{
|
||||||
|
Mekanism.proxy.registerSound(this);
|
||||||
|
|
||||||
if(updateDelay > 0)
|
if(updateDelay > 0)
|
||||||
{
|
{
|
||||||
updateDelay--;
|
updateDelay--;
|
||||||
|
@ -456,4 +462,16 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import mekanism.api.gas.GasTransmission;
|
||||||
import mekanism.api.gas.IGasHandler;
|
import mekanism.api.gas.IGasHandler;
|
||||||
import mekanism.api.gas.IGasItem;
|
import mekanism.api.gas.IGasItem;
|
||||||
import mekanism.api.gas.ITubeConnection;
|
import mekanism.api.gas.ITubeConnection;
|
||||||
|
import mekanism.client.sound.IHasSound;
|
||||||
import mekanism.common.IActiveState;
|
import mekanism.common.IActiveState;
|
||||||
import mekanism.common.IRedstoneControl;
|
import mekanism.common.IRedstoneControl;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
@ -28,7 +29,7 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl
|
public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implements IActiveState, ITubeConnection, IRedstoneControl, IHasSound
|
||||||
{
|
{
|
||||||
public GasTank gasTank = new GasTank(MAX_GAS);
|
public GasTank gasTank = new GasTank(MAX_GAS);
|
||||||
|
|
||||||
|
@ -63,6 +64,8 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
|
||||||
{
|
{
|
||||||
if(worldObj.isRemote)
|
if(worldObj.isRemote)
|
||||||
{
|
{
|
||||||
|
Mekanism.proxy.registerSound(this);
|
||||||
|
|
||||||
if(updateDelay > 0)
|
if(updateDelay > 0)
|
||||||
{
|
{
|
||||||
updateDelay--;
|
updateDelay--;
|
||||||
|
@ -337,4 +340,16 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
|
||||||
controlType = type;
|
controlType = type;
|
||||||
MekanismUtils.saveChunk(this);
|
MekanismUtils.saveChunk(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSoundPath()
|
||||||
|
{
|
||||||
|
return "ChemicalInfuser.ogg";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getVolumeMultiplier()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
resources/assets/mekanism/sound/ChemicalInfuser.ogg
Normal file
BIN
resources/assets/mekanism/sound/ChemicalInfuser.ogg
Normal file
Binary file not shown.
BIN
resources/assets/mekanism/sound/ChemicalOxidizer.ogg
Normal file
BIN
resources/assets/mekanism/sound/ChemicalOxidizer.ogg
Normal file
Binary file not shown.
BIN
resources/assets/mekanism/sound/PrecisionSawmill.ogg
Normal file
BIN
resources/assets/mekanism/sound/PrecisionSawmill.ogg
Normal file
Binary file not shown.
Binary file not shown.
Before (image error) Size: 3.5 KiB After (image error) Size: 2.9 KiB |
Loading…
Add table
Reference in a new issue