diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index 94427be2e..b010200e5 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -7,6 +7,20 @@ itemGroup.tabMachine=NTM Templates achievement.getTitanium=It's A Start achievement.getTitanium.desc=Collect titanium ore +hbmfluid.none=None +hbmfluid.water=Water +hbmfluid.lava=Lava +hbmfluid.uf6=Uranium Hexafluoride +hbmfluid.puf6=Plutonium Hexafluoride +hbmfluid.deuterium=Deuterium +hbmfluid.tritium=Tritium +hbmfluid.oil=Crude Oil +hbmfluid.smear=Industrial Oil +hbmfluid.lubricant=Engine Lubricant +hbmfluid.diesel=Diesel +hbmfluid.kerosene=Kerosene +hbmfluid.gas=Natural Gas + item.record.lc.desc=Valve - Diabolic Adrenaline Guitar/Lambda Core item.record.ss.desc=Valve - Sector Sweep item.record.vc.desc=Valve - Vortal Combat diff --git a/com/hbm/handler/FluidTypeHandler.java b/com/hbm/handler/FluidTypeHandler.java index 3353fae93..83b128db8 100644 --- a/com/hbm/handler/FluidTypeHandler.java +++ b/com/hbm/handler/FluidTypeHandler.java @@ -5,21 +5,26 @@ import com.hbm.items.tool.ItemAssemblyTemplate.EnumAssemblyTemplate; public class FluidTypeHandler { public enum FluidType { - NONE(0x888888, 8947848, 0, 0), WATER(0x3333FF, 3355647, 1, 0), - LAVA(0xFF3300, 16724736, 2, 0), UF6(0xD1CEBE, 13749950, 3, 0), - PUF6(0x4C4C4C, 5000268, 0, 1), DEUTERIUM(0x0000FF, 255, 1, 1), - TRITIUM(0x000099, 153, 2, 1); + NONE(0x888888, 8947848, 0, 0, "hbmfluid.none"), WATER(0x3333FF, 3355647, 1, 0, "hbmfluid.water"), + LAVA(0xFF3300, 16724736, 2, 0, "hbmfluid.lava"), UF6(0xD1CEBE, 13749950, 3, 0, "hbmfluid.uf6"), + PUF6(0x4C4C4C, 5000268, 0, 1, "hbmfluid.puf6"), DEUTERIUM(0x0000FF, 255, 1, 1, "hbmfluid.deuterium"), + TRITIUM(0x000099, 153, 2, 1, "hbmfluid.tritium"), OIL(0x020202, 131586, 3, 1, "hbmfluid.oil"), + SMEAR(0x190f01, 1642241, 0, 2, "hbmfluid.smear"), LUBRICANT(0x606060, 6316128, 1, 2, "hbmfluid.lubricant"), + DIESEL(0xf2eed5, 15920853, 2, 2, "hbmfluid.diesel"), KEROSENE(0xffa5d2, 16754130, 3, 2, "hbmfluid.kerosene"), + GAS(0xfffeed, 16776941, 0, 3, "hbmfluid.gas"); private int color; private int msa; private int textureX; private int textureY; + private String name; - private FluidType(int color, int msa, int x, int y) { + private FluidType(int color, int msa, int x, int y, String name) { this.color = color; this.msa = msa; this.textureX = x; this.textureY = y; + this.name = name; } public int getColor() { @@ -34,6 +39,9 @@ public class FluidTypeHandler { public int textureY() { return this.textureY; } + public String getUnlocalizedName() { + return this.name; + } public static FluidType getEnum(int i) { return FluidType.values()[i]; diff --git a/com/hbm/inventory/FluidTank.java b/com/hbm/inventory/FluidTank.java index 5fe9a38d0..13e577f16 100644 --- a/com/hbm/inventory/FluidTank.java +++ b/com/hbm/inventory/FluidTank.java @@ -10,6 +10,7 @@ import com.hbm.packet.TEAssemblerPacket; import com.hbm.packet.TEFluidPacket; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -104,7 +105,7 @@ public class FluidTank { public void renderTankInfo(GuiFluidContainer gui, int mouseX, int mouseY, int x, int y, int width, int height) { if(x <= mouseX && x + width > mouseX && y < mouseY && y + height >= mouseY) - gui.drawFluidInfo(new String[] { this.type.getName(), fluid + "/" + maxFluid + "mB" }, mouseX, mouseY); + gui.drawFluidInfo(new String[] { I18n.format(this.type.getUnlocalizedName()), fluid + "/" + maxFluid + "mB" }, mouseX, mouseY); } //Called by TE to save fillstate diff --git a/com/hbm/items/tool/ItemFluidIdentifier.java b/com/hbm/items/tool/ItemFluidIdentifier.java index 5e0ea5f18..6177ca9f0 100644 --- a/com/hbm/items/tool/ItemFluidIdentifier.java +++ b/com/hbm/items/tool/ItemFluidIdentifier.java @@ -74,7 +74,7 @@ public class ItemFluidIdentifier extends Item { return; list.add("Universal fluid identifier for:"); - list.add(" " + FluidType.getEnum(stack.getItemDamage()).getName()); + list.add(" " + I18n.format(FluidType.getEnum(stack.getItemDamage()).getUnlocalizedName())); } @Override diff --git a/com/hbm/packet/LoopedSoundPacket.java b/com/hbm/packet/LoopedSoundPacket.java new file mode 100644 index 000000000..b813d7f75 --- /dev/null +++ b/com/hbm/packet/LoopedSoundPacket.java @@ -0,0 +1,76 @@ +package com.hbm.packet; + +import java.util.ArrayList; +import java.util.List; + +import com.hbm.sound.SoundLoopMiner; +import com.hbm.tileentity.TileEntityMachineAssembler; +import com.hbm.tileentity.TileEntityMachineIGenerator; +import com.hbm.tileentity.TileEntityMachineMiningDrill; +import com.hbm.tileentity.TileEntityPylonRedWire; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; +import net.minecraft.client.Minecraft; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +public class LoopedSoundPacket implements IMessage { + + int x; + int y; + int z; + + public LoopedSoundPacket() + { + + } + + public LoopedSoundPacket(int x, int y, int z) + { + this.x = x; + this.y = y; + this.z = z; + } + + @Override + public void fromBytes(ByteBuf buf) { + x = buf.readInt(); + y = buf.readInt(); + z = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(x); + buf.writeInt(y); + buf.writeInt(z); + } + + public static class Handler implements IMessageHandler { + + @Override + public IMessage onMessage(LoopedSoundPacket m, MessageContext ctx) { + TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); + + try { + if (te != null && te instanceof TileEntityMachineMiningDrill) { + + boolean flag = true; + for(int i = 0; i < SoundLoopMiner.list.size(); i++) { + if(SoundLoopMiner.list.get(i).getTE() == te && !SoundLoopMiner.list.get(i).isDonePlaying()) + flag = false; + } + + //if(flag && te.getWorldObj().isRemote) + // Minecraft.getMinecraft(). + } + } catch(Exception ex) { + System.out.println("Sorry folks, not today."); + } + return null; + } + } +} diff --git a/com/hbm/packet/PacketDispatcher.java b/com/hbm/packet/PacketDispatcher.java index 1b48a7d49..8d92fd706 100644 --- a/com/hbm/packet/PacketDispatcher.java +++ b/com/hbm/packet/PacketDispatcher.java @@ -35,6 +35,8 @@ public class PacketDispatcher { wrapper.registerMessage(TEMissilePacket.Handler.class, TEMissilePacket.class, i++, Side.CLIENT); //Fluid packet for GUI wrapper.registerMessage(TEFluidPacket.Handler.class, TEFluidPacket.class, i++, Side.CLIENT); + //Sound packet that keeps client and server seperated + wrapper.registerMessage(LoopedSoundPacket.Handler.class, LoopedSoundPacket.class, i++, Side.CLIENT); } } diff --git a/com/hbm/sound/SoundLoopMiner.java b/com/hbm/sound/SoundLoopMiner.java new file mode 100644 index 000000000..76542a30d --- /dev/null +++ b/com/hbm/sound/SoundLoopMiner.java @@ -0,0 +1,36 @@ +package com.hbm.sound; + +import java.util.ArrayList; +import java.util.List; + +import com.hbm.tileentity.TileEntityMachineMiningDrill; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +public class SoundLoopMiner extends SoundLoopMachine { + + public static List list = new ArrayList(); + + public SoundLoopMiner(ResourceLocation path, TileEntity te) { + super(path, te); + list.add(this); + } + + @Override + public void update() { + super.update(); + + if(te instanceof TileEntityMachineMiningDrill) { + TileEntityMachineMiningDrill drill = (TileEntityMachineMiningDrill)te; + + if(drill.torque <= 0.5F) + this.donePlaying = true; + } + } + + public TileEntity getTE() { + return te; + } + +} diff --git a/com/hbm/tileentity/TileEntityMachineMiningDrill.java b/com/hbm/tileentity/TileEntityMachineMiningDrill.java index 014062ad0..fb98db486 100644 --- a/com/hbm/tileentity/TileEntityMachineMiningDrill.java +++ b/com/hbm/tileentity/TileEntityMachineMiningDrill.java @@ -15,6 +15,7 @@ import com.hbm.interfaces.IOilSource; import com.hbm.items.ModItems; import com.hbm.items.special.ItemBattery; import com.hbm.lib.Library; +import com.hbm.packet.LoopedSoundPacket; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.TEDrillPacket; import com.hbm.packet.TEDrillSoundPacket; @@ -460,6 +461,7 @@ public class TileEntityMachineMiningDrill extends TileEntity implements ISidedIn PacketDispatcher.wrapper.sendToAll(new TEDrillPacket(xCoord, yCoord, zCoord, rotation)); PacketDispatcher.wrapper.sendToAll(new TEDrillSoundPacket(xCoord, yCoord, zCoord, torque)); + //PacketDispatcher.wrapper.sendToAll(new LoopedSoundPacket(xCoord, yCoord, zCoord)); } /*if(worldObj.isRemote) { @@ -476,6 +478,7 @@ public class TileEntityMachineMiningDrill extends TileEntity implements ISidedIn } } }*/ + } public boolean tryFillContainer(IInventory inventory, int slot) {