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
|
@ -29,7 +29,7 @@ public class ChanceOutput
|
|||
|
||||
public boolean checkSecondary()
|
||||
{
|
||||
return rand.nextDouble() >= secondaryChance;
|
||||
return rand.nextDouble() <= secondaryChance;
|
||||
}
|
||||
|
||||
public boolean hasPrimary()
|
||||
|
|
|
@ -9,8 +9,6 @@ public abstract class PlayerSound extends Sound
|
|||
/** The TileEntity this sound is associated with. */
|
||||
public EntityPlayer player;
|
||||
|
||||
public int ticksSincePlay = 0;
|
||||
|
||||
public PlayerSound(String id, String sound, EntityPlayer entity)
|
||||
{
|
||||
super(id, sound, entity, new Pos3D(entity));
|
||||
|
@ -21,7 +19,7 @@ public abstract class PlayerSound extends Sound
|
|||
@Override
|
||||
public float getMultiplier()
|
||||
{
|
||||
return Math.min(1, ((float)ticksSincePlay/20F))*0.3F;
|
||||
return super.getMultiplier()*0.3F;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,12 +46,4 @@ public abstract class PlayerSound extends Sound
|
|||
{
|
||||
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 */
|
||||
public boolean isPlaying = false;
|
||||
|
||||
public int ticksSincePlay = 0;
|
||||
|
||||
private Object objRef;
|
||||
|
||||
protected Minecraft mc = Minecraft.getMinecraft();
|
||||
|
@ -71,6 +73,8 @@ public abstract class Sound
|
|||
return;
|
||||
}
|
||||
|
||||
ticksSincePlay = 0;
|
||||
|
||||
if(SoundHandler.getSoundSystem() != null)
|
||||
{
|
||||
updateVolume();
|
||||
|
@ -129,7 +133,10 @@ public abstract class Sound
|
|||
|
||||
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.
|
||||
|
|
|
@ -38,7 +38,7 @@ public class TileSound extends Sound
|
|||
@Override
|
||||
public float getMultiplier()
|
||||
{
|
||||
return ((IHasSound)tileEntity).getVolumeMultiplier();
|
||||
return super.getMultiplier()*((IHasSound)tileEntity).getVolumeMultiplier();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,6 +76,11 @@ public class TileSound extends Sound
|
|||
}
|
||||
}
|
||||
|
||||
if(isPlaying)
|
||||
{
|
||||
ticksSincePlay++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,30 +151,36 @@ public class TileEntityChanceMachine extends TileEntityBasicMachine
|
|||
|
||||
if(output.hasPrimary())
|
||||
{
|
||||
if(inventory[2] != null && !inventory[2].isItemEqual(output.primaryOutput))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(inventory[2].stackSize + output.primaryOutput.stackSize > inventory[2].getMaxStackSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(inventory[2] != null)
|
||||
{
|
||||
if(!inventory[2].isItemEqual(output.primaryOutput))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(inventory[2].stackSize + output.primaryOutput.stackSize > inventory[2].getMaxStackSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(output.hasSecondary())
|
||||
{
|
||||
if(inventory[4] != null && !inventory[4].isItemEqual(output.secondaryOutput))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(inventory[4].stackSize + output.secondaryOutput.stackSize > inventory[4].getMaxStackSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(inventory[4] != null)
|
||||
{
|
||||
if(!inventory[4].isItemEqual(output.secondaryOutput))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(inventory[4].stackSize + output.secondaryOutput.stackSize > inventory[4].getMaxStackSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -11,7 +11,11 @@ import mekanism.api.gas.GasTransmission;
|
|||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
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.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
|
@ -27,7 +31,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
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 rightTank = new GasTank(MAX_GAS);
|
||||
|
@ -61,6 +65,8 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
|
|||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
Mekanism.proxy.registerSound(this);
|
||||
|
||||
if(updateDelay > 0)
|
||||
{
|
||||
updateDelay--;
|
||||
|
@ -456,4 +462,16 @@ public class TileEntityChemicalInfuser extends TileEntityElectricBlock implement
|
|||
|
||||
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.IGasItem;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.client.sound.IHasSound;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.Mekanism;
|
||||
|
@ -28,7 +29,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
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);
|
||||
|
||||
|
@ -63,6 +64,8 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
|
|||
{
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
Mekanism.proxy.registerSound(this);
|
||||
|
||||
if(updateDelay > 0)
|
||||
{
|
||||
updateDelay--;
|
||||
|
@ -337,4 +340,16 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
|
|||
controlType = type;
|
||||
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 Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.9 KiB |
Loading…
Reference in a new issue