mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 11:59:17 +00:00
Switch sound system to use Strings instead of RLs
This commit is contained in:
1 parent
d0a2e97b5d
commit
345f1bc108
4 files changed
+13
-21
No files matched your search
@@ -72,6 +72,9 @@ 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);
|
||||
}
|
||||
@@ -83,6 +86,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
powerHandler = PowerHandlerUtil.createHandler(capacitorType.capacitor, this, powerType);
|
||||
inventory = new ItemStack[slotDefinition.getNumSlots()];
|
||||
redstoneControlMode = RedstoneControlMode.IGNORE;
|
||||
soundRes = getSoundFor(getSoundName());
|
||||
|
||||
allSlots = new int[slotDefinition.getNumSlots()];
|
||||
for (int i = 0; i < allSlots.length; i++) {
|
||||
@@ -205,13 +209,13 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
public abstract float getProgress();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getSound() {
|
||||
public String getSoundName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasSound() {
|
||||
return getSound() != null;
|
||||
return getSoundName() != null;
|
||||
}
|
||||
|
||||
public float getVolume() {
|
||||
@@ -226,7 +230,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
|
||||
private void updateSound() {
|
||||
if(isActive() && !isInvalid()) {
|
||||
if(sound == null) {
|
||||
sound = new MachineSound(getSound(), xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, getVolume(), getPitch());
|
||||
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) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package crazypants.enderio.machine.crusher;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.ModObject;
|
||||
@@ -22,8 +21,6 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
|
||||
protected int lastSendGbScaled = 0;
|
||||
private boolean useGrindingBall;
|
||||
|
||||
private static final ResourceLocation sound = getSoundFor("machine.sagmill");
|
||||
|
||||
public TileCrusher() {
|
||||
super(new SlotDefinition(2, 4));
|
||||
}
|
||||
@@ -142,8 +139,8 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public ResourceLocation getSound() {
|
||||
return sound;
|
||||
public String getSoundName() {
|
||||
return "machine.sagmill";
|
||||
}
|
||||
|
||||
public float getVolume() {
|
||||
|
||||
+2
-5
@@ -5,7 +5,6 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.power.IPowerEmitter;
|
||||
import buildcraft.api.power.PowerHandler.Type;
|
||||
@@ -29,8 +28,6 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
|
||||
public int totalBurnTime;
|
||||
|
||||
private PowerDistributor powerDis;
|
||||
|
||||
private static final ResourceLocation sound = getSoundFor("generator.stirling");
|
||||
|
||||
public TileEntityStirlingGenerator() {
|
||||
super(new SlotDefinition(1, 0), Type.ENGINE);
|
||||
@@ -108,8 +105,8 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getSound() {
|
||||
return sound;
|
||||
public String getSoundName() {
|
||||
return "generator.stirling";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,11 +2,9 @@ package crazypants.enderio.machine.still;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
@@ -26,15 +24,11 @@ import crazypants.util.FluidUtil;
|
||||
|
||||
public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler {
|
||||
|
||||
private static final FluidStack WATER = new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
||||
final FluidTank inputTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 8);
|
||||
final FluidTank outputTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME * 8);
|
||||
|
||||
private static int IO_MB_TICK = 100;
|
||||
|
||||
private static final ResourceLocation sound = getSoundFor("machine.vat");
|
||||
|
||||
boolean tanksDirty = false;
|
||||
|
||||
public TileVat() {
|
||||
@@ -313,8 +307,8 @@ public class TileVat extends AbstractPoweredTaskEntity implements IFluidHandler
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public ResourceLocation getSound() {
|
||||
return sound;
|
||||
public String getSoundName() {
|
||||
return "machine.vat";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user