mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 13:10:13 +00:00
Fix crash on TE invalidate(), add Vat sounds.
This commit is contained in:
1 parent
d68811e2b2
commit
752ab336e8
6 files changed
+38
-8
No files matched your search
@@ -71,6 +71,10 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private MachineSound sound;
|
||||
|
||||
protected static ResourceLocation getSoundFor(String sound) {
|
||||
return new ResourceLocation(EnderIO.MODID + ":" + sound);
|
||||
}
|
||||
|
||||
public AbstractMachineEntity(SlotDefinition slotDefinition, Type powerType) {
|
||||
this.slotDefinition = slotDefinition;
|
||||
@@ -213,12 +217,16 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
public float getVolume() {
|
||||
return 0.75f;
|
||||
}
|
||||
|
||||
public float getPitch() {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void updateSound() {
|
||||
if(isActive() && !isInvalid()) {
|
||||
if(sound == null) {
|
||||
sound = new MachineSound(getSound(), xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, getVolume());
|
||||
sound = new MachineSound(getSound(), xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, getVolume(), getPitch());
|
||||
FMLClientHandler.instance().getClient().getSoundHandler().playSound(sound);
|
||||
}
|
||||
} else if(sound != null) {
|
||||
@@ -516,7 +524,9 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
@Override
|
||||
public void invalidate() {
|
||||
super.invalidate();
|
||||
updateSound();
|
||||
if (worldObj.isRemote) {
|
||||
updateSound();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user