mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-21 20:52:42 +00:00
Fixed server crashes...
- base TE now properly handles a null getSoundName() - RL of sound is not client only
This commit is contained in:
1 parent
09c45e9fee
commit
6e8beb73d4
4 files changed
+10
-21
No files matched your search
@@ -73,11 +73,10 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
@SideOnly(Side.CLIENT)
|
||||
private MachineSound sound;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private final ResourceLocation soundRes;
|
||||
|
||||
protected static ResourceLocation getSoundFor(String sound) {
|
||||
return new ResourceLocation(EnderIO.MODID + ":" + sound);
|
||||
return sound == null ? null : new ResourceLocation(EnderIO.MODID + ":" + sound);
|
||||
}
|
||||
|
||||
public AbstractMachineEntity(SlotDefinition slotDefinition, Type powerType) {
|
||||
@@ -209,12 +208,10 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
|
||||
public abstract float getProgress();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getSoundName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasSound() {
|
||||
return getSoundName() != null;
|
||||
}
|
||||
@@ -229,14 +226,16 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void updateSound() {
|
||||
if(Config.machineSoundsEnabled && isActive() && !isInvalid()) {
|
||||
if(sound == null) {
|
||||
sound = new MachineSound(soundRes, xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, getVolume(), getPitch());
|
||||
FMLClientHandler.instance().getClient().getSoundHandler().playSound(sound);
|
||||
if(Config.machineSoundsEnabled && hasSound()) {
|
||||
if(isActive() && !isInvalid()) {
|
||||
if(sound == null) {
|
||||
sound = new MachineSound(soundRes, xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, getVolume(), getPitch());
|
||||
FMLClientHandler.instance().getClient().getSoundHandler().playSound(sound);
|
||||
}
|
||||
} else if(sound != null) {
|
||||
sound.endPlaying();
|
||||
sound = null;
|
||||
}
|
||||
} else if(sound != null) {
|
||||
sound.endPlaying();
|
||||
sound = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,6 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public String getSoundName() {
|
||||
return "machine.sagmill";
|
||||
|
||||
-6
@@ -8,8 +8,6 @@ import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.power.IPowerEmitter;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
@@ -104,7 +102,6 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getSoundName() {
|
||||
return "generator.stirling";
|
||||
}
|
||||
@@ -225,7 +222,4 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -9,8 +9,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.AbstractPoweredTaskEntity;
|
||||
@@ -305,7 +303,6 @@ public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler
|
||||
return Config.vatPowerUserPerTick;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public String getSoundName() {
|
||||
return "machine.vat";
|
||||
|
||||
Reference in new issue
Block a user