diff --git a/changelog b/changelog index c2ba2e7a3..b3a1b847f 100644 --- a/changelog +++ b/changelog @@ -7,6 +7,11 @@ * Upgrades stack with the double base speed * Stackable! * Water consumption rate is fixed at 100mB/t for each active recipe + * Has a dedicated coolant line, so that the coolant water doesn't get used up by recipes + * Coolant line has a tooltip which should make it clear that the machine uses water and produces LPS + * Also has sound, unlike the old chemical factory + * Output fluids are now automatically sent to input tanks, at a rate of up to 50mB/t for somewhat fair fluid sharing + * This means that a chemical factory can make hydrogen peroxide, sulfuric acid and nitric acid, and the only fluid input needed is water ## Changed * The DNT suit now has a damage threshold of 1,000 @@ -20,6 +25,9 @@ * Improved threaded Mk5, should be a smidge faster now * Spires no longer progress phases on peaceful difficulty * Spires now have a 20% chance of coming with instructions +* New chemical plant now has sound +* Old chemical plant and factory have been renamed and their recipes removed +* The new recipe selector no longer changes recipe instantly on click, rather as soon as the selector GUI is closed. This should prevent issues when misclicking, which would destroy buffered fluids ## Fixed * Chemical plant ports. For real this time. diff --git a/src/main/java/com/hbm/blocks/machine/MachineChemfac.java b/src/main/java/com/hbm/blocks/machine/MachineChemfac.java index 60f18617d..fec75ef5b 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineChemfac.java +++ b/src/main/java/com/hbm/blocks/machine/MachineChemfac.java @@ -10,6 +10,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +@Deprecated public class MachineChemfac extends BlockDummyable { public MachineChemfac(Material mat) { diff --git a/src/main/java/com/hbm/blocks/machine/MachineChemicalFactory.java b/src/main/java/com/hbm/blocks/machine/MachineChemicalFactory.java index 787f030b9..d08619616 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineChemicalFactory.java +++ b/src/main/java/com/hbm/blocks/machine/MachineChemicalFactory.java @@ -1,16 +1,26 @@ package com.hbm.blocks.machine; +import java.util.ArrayList; +import java.util.List; + import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.ILookOverlay; +import com.hbm.blocks.ITooltipProvider; import com.hbm.tileentity.TileEntityProxyDyn; import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory; +import com.hbm.util.fauxpointtwelve.DirPos; +import com.hbm.util.i18n.I18nUtil; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; import net.minecraftforge.common.util.ForgeDirection; -public class MachineChemicalFactory extends BlockDummyable { +public class MachineChemicalFactory extends BlockDummyable implements ITooltipProvider, ILookOverlay { public MachineChemicalFactory(Material mat) { super(mat); @@ -41,5 +51,38 @@ public class MachineChemicalFactory extends BlockDummyable { for(int i = -2; i <= 2; i++) for(int j = -2; j <= 2; j++) { if(Math.abs(i) == 2 || Math.abs(j) == 2) this.makeExtra(world, x + i, y, z + j); } + + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + for(int i = -2; i <= 2; i++) { + this.makeExtra(world, x + dir.offsetX * i + rot.offsetX * 2, y + 2, z + dir.offsetZ * i + rot.offsetZ * 2); + this.makeExtra(world, x + dir.offsetX * i - rot.offsetX * 2, y + 2, z + dir.offsetZ * i - rot.offsetZ * 2); + } + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { + this.addStandardInfo(stack, player, list, ext); + } + + @Override + public void printHook(Pre event, World world, int x, int y, int z) { + int[] pos = this.findCore(world, x, y, z); + if(pos == null) return; + + TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); + if(!(te instanceof TileEntityMachineChemicalFactory)) return; + TileEntityMachineChemicalFactory chemfac = (TileEntityMachineChemicalFactory) te; + + DirPos[] cool = chemfac.getCoolPos(); + + for(DirPos dirPos : cool) if(dirPos.compare(x + dirPos.getDir().offsetX, y, z + dirPos.getDir().offsetZ)) { + List text = new ArrayList(); + + text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + chemfac.water.getTankType().getLocalizedName()); + text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + chemfac.lps.getTankType().getLocalizedName()); + + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); + break; + } } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalFactory.java b/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalFactory.java index 4b756e87b..a31917752 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalFactory.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineChemicalFactory.java @@ -34,8 +34,8 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer { super.drawScreen(mouseX, mouseY, f); for(int i = 0; i < 3; i++) for(int j = 0; j < 4; j++) { - chemplant.inputTanks[i + j * 3].renderTankInfo(this, mouseX, mouseY, guiLeft + 60 + i * 5, guiTop + 20 + j * 22, 4, 16); - chemplant.outputTanks[i + j * 3].renderTankInfo(this, mouseX, mouseY, guiLeft + 189 + i * 5, guiTop + 20 + j * 22, 4, 16); + chemplant.inputTanks[i + j * 3].renderTankInfo(this, mouseX, mouseY, guiLeft + 60 + i * 5, guiTop + 20 + j * 22, 3, 16); + chemplant.outputTanks[i + j * 3].renderTankInfo(this, mouseX, mouseY, guiLeft + 189 + i * 5, guiTop + 20 + j * 22, 3, 16); } chemplant.water.renderTankInfo(this, mouseX, mouseY, guiLeft + 224, guiTop + 125, 7, 52); @@ -128,8 +128,8 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer { } for(int i = 0; i < 3; i++) for(int j = 0; j < 4; j++) { - chemplant.inputTanks[i + j * 3].renderTank(guiLeft + 60 + i * 5, guiTop + 36 + j * 22, this.zLevel, 4, 16); - chemplant.outputTanks[i + j * 3].renderTank(guiLeft + 189 + i * 5, guiTop + 36 + j * 22, this.zLevel, 4, 16); + chemplant.inputTanks[i + j * 3].renderTank(guiLeft + 60 + i * 5, guiTop + 36 + j * 22, this.zLevel, 3, 16); + chemplant.outputTanks[i + j * 3].renderTank(guiLeft + 189 + i * 5, guiTop + 36 + j * 22, this.zLevel, 3, 16); } chemplant.water.renderTank(guiLeft + 224, guiTop + 177, this.zLevel, 7, 52); diff --git a/src/main/java/com/hbm/inventory/gui/GUIScreenRecipeSelector.java b/src/main/java/com/hbm/inventory/gui/GUIScreenRecipeSelector.java index 09d20ed64..6f101ef29 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIScreenRecipeSelector.java +++ b/src/main/java/com/hbm/inventory/gui/GUIScreenRecipeSelector.java @@ -276,11 +276,6 @@ public class GUIScreenRecipeSelector extends GuiScreen { else this.selection = NULL_SELECTION; - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("index", this.index); - data.setString("selection", this.selection); - TileEntity te = (TileEntity) tile; - PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, te.xCoord, te.yCoord, te.zCoord)); click(); return; } @@ -289,11 +284,6 @@ public class GUIScreenRecipeSelector extends GuiScreen { if(guiLeft + 151 <= x && guiLeft + 151 + 18 > x && guiTop + 71 < y && guiTop + 71 + 18 >= y) { if(!NULL_SELECTION.equals(this.selection)) { this.selection = this.NULL_SELECTION; - NBTTagCompound data = new NBTTagCompound(); - data.setInteger("index", this.index); - data.setString("selection", this.selection); - TileEntity te = (TileEntity) tile; - PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, te.xCoord, te.yCoord, te.zCoord)); click(); return; } @@ -304,6 +294,17 @@ public class GUIScreenRecipeSelector extends GuiScreen { } } + @Override + public void onGuiClosed() { + Keyboard.enableRepeatEvents(false); + + NBTTagCompound data = new NBTTagCompound(); + data.setInteger("index", this.index); + data.setString("selection", this.selection); + TileEntity te = (TileEntity) tile; + PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, te.xCoord, te.yCoord, te.zCoord)); + } + @Override protected void keyTyped(char typedChar, int keyCode) { @@ -321,8 +322,6 @@ public class GUIScreenRecipeSelector extends GuiScreen { FMLCommonHandler.instance().showGuiScreen(previousScreen); } } - - @Override public void onGuiClosed() { Keyboard.enableRepeatEvents(false); } @Override public boolean doesGuiPauseGame() { return false; } public void click() { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java index 99dbd7251..e1efbf9db 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java @@ -139,7 +139,6 @@ public class AssemblerRecipes extends SerializableRecipe { makeRecipe(new ComparableStack(ModBlocks.machine_coker, 1), new AStack[] {!exp ? new OreDictStack(STEEL.plateWelded(), 3) : new OreDictStack(STEEL.heavyComp(), 2), new OreDictStack(IRON.ingot(), 16), new OreDictStack(CU.plate528(), 8), new OreDictStack(RUBBER.ingot(), 4), new ComparableStack(ModItems.tank_steel, 2), new ComparableStack(ModBlocks.steel_grate, 4) },200); makeRecipe(new ComparableStack(ModBlocks.machine_refinery, 1), new AStack[] {!exp ? new OreDictStack(STEEL.plateWelded(), 3) : new OreDictStack(STEEL.heavyComp(), 1), new OreDictStack(CU.plate528(), 16), new OreDictStack(STEEL.shell(), 6), new OreDictStack(STEEL.pipe(), 12), new ComparableStack(ModItems.plate_polymer, 8), new ComparableStack(ModItems.circuit, 3, EnumCircuitType.ANALOG) },350); makeRecipe(new ComparableStack(ModBlocks.machine_epress, 1), new AStack[] {new OreDictStack(STEEL.plate(), 8), new OreDictStack(ANY_RUBBER.ingot(), 4), new ComparableStack(ModItems.part_generic, 2, EnumPartType.PISTON_HYDRAULIC.ordinal()), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.BASIC) }, 100); - makeRecipe(new ComparableStack(ModBlocks.machine_chemplant, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 12), new OreDictStack(CU.plate528(), 6), new ComparableStack(ModItems.tank_steel, 4), new ComparableStack(ModItems.coil_tungsten, 3), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG), new ComparableStack(ModItems.plate_polymer, 8), },200); makeRecipe(new ComparableStack(ModBlocks.machine_chemical_plant, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.pipe(), 2), new ComparableStack(ModItems.plate_polymer, 16), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.coil_tungsten, 2), new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ANALOG) }, 200); makeRecipe(new ComparableStack(ModBlocks.machine_crystallizer, 1), new AStack[] {new OreDictStack(STEEL.plateWelded(), 2), new OreDictStack(TI.shell(), 3), new OreDictStack(DESH.ingot(), 4), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.circuit, 2, EnumCircuitType.BASIC), },200); makeRecipe(new ComparableStack(ModBlocks.machine_fluidtank, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 2), new OreDictStack(STEEL.plate528(), 6), new OreDictStack(STEEL.shell(), 4), new OreDictStack(ANY_TAR.any(), 4), },150); @@ -865,6 +864,17 @@ public class AssemblerRecipes extends SerializableRecipe { new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC) }, 400); + makeRecipe(new ComparableStack(ModBlocks.machine_chemical_factory, 1), new AStack[] { + new OreDictStack(DURA.ingot(), 16), + new OreDictStack(ANY_RESISTANTALLOY.ingot(), 8), + new OreDictStack(RUBBER.ingot(), 16), + new OreDictStack(STEEL.shell(), 12), + new OreDictStack(CU.pipe(), 8), + new ComparableStack(ModItems.motor_desh, 4), + new ComparableStack(ModItems.coil_tungsten, 16), + new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC) + }, 400); + makeRecipe(new ComparableStack(ModItems.missile_shuttle, 1), new AStack[] { new ComparableStack(ModItems.missile_generic, 2), new ComparableStack(ModItems.missile_strong, 1), diff --git a/src/main/java/com/hbm/render/tileentity/RenderChemicalFactory.java b/src/main/java/com/hbm/render/tileentity/RenderChemicalFactory.java index 7eae5b7ad..ba2ce02b3 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderChemicalFactory.java +++ b/src/main/java/com/hbm/render/tileentity/RenderChemicalFactory.java @@ -36,8 +36,20 @@ public class RenderChemicalFactory extends TileEntitySpecialRenderer implements bindTexture(ResourceManager.chemical_factory_tex); ResourceManager.chemical_factory.renderPart("Base"); if(chemplant.frame) ResourceManager.chemical_factory.renderPart("Frame"); + + GL11.glPushMatrix(); + GL11.glTranslated(1, 0, 0); + GL11.glRotated(-anim * 45 % 360D, 0, 1, 0); + GL11.glTranslated(-1, 0, 0); ResourceManager.chemical_factory.renderPart("Fan1"); + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + GL11.glTranslated(-1, 0, 0); + GL11.glRotated(-anim * 45 % 360D, 0, 1, 0); + GL11.glTranslated(1, 0, 0); ResourceManager.chemical_factory.renderPart("Fan2"); + GL11.glPopMatrix(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glPopMatrix(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java b/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java index 48e9b5535..97b020c12 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityHadron.java @@ -556,7 +556,6 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe for(int c = z - dZ * 2; c <= z + dZ * 2;c++) { Block block = worldObj.getBlock(a, b, c); - int meta = worldObj.getBlockMetadata(a, b, c); /** ignore the center for now */ if(a == x && b == y && c == z) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemfac.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemfac.java index 2d6ff9a14..2fcb3a60c 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemfac.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemfac.java @@ -33,6 +33,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +@Deprecated public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase implements IUpgradeInfoProvider, IFluidCopiable { float rotSpeed; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java index e1b443410..8b31f6f11 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java @@ -13,7 +13,9 @@ import com.hbm.inventory.gui.GUIMachineChemicalFactory; import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.lib.Library; +import com.hbm.main.MainRegistry; import com.hbm.module.ModuleMachineChemplant; +import com.hbm.sound.AudioWrapper; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IUpgradeInfoProvider; import com.hbm.tileentity.TileEntityMachineBase; @@ -52,6 +54,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl public boolean frame = false; public int anim; public int prevAnim; + private AudioWrapper audio; public ModuleMachineChemplant[] chemplantModule; public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this); @@ -89,9 +92,9 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { if(i >= 8 && i <= 10) return true; - if(i >= 12 && i <= 14) return true; - if(i >= 19 && i <= 21) return true; - if(i >= 26 && i <= 28) return true; + if(i >= 15 && i <= 17) return true; + if(i >= 22 && i <= 24) return true; + if(i >= 29 && i <= 31) return true; return false; } @@ -145,7 +148,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl for(DirPos pos : getCoolPos()) { delegate.trySubscribe(worldObj, pos); delegate.trySubscribe(water.getTankType(), worldObj, pos); - this.tryProvide(lps, worldObj, pos); + delegate.tryProvide(lps, worldObj, pos); } double speed = 1D; @@ -170,6 +173,16 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl } } + for(FluidTank in : inputTanks) if(in.getTankType() != Fluids.NONE) for(FluidTank out : outputTanks) { // up to 144 iterations, but most of them are NOP anyway + if(out.getTankType() == Fluids.NONE) continue; + if(out.getTankType() != in.getTankType()) continue; + int toMove = BobMathUtil.min(in.getMaxFill() - in.getFill(), out.getFill(), 50); + if(toMove > 0) { + in.setFill(in.getFill() + toMove); + out.setFill(out.getFill() - toMove); + } + } + if(markDirty) this.markDirty(); this.networkPackNT(100); @@ -177,13 +190,44 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl } else { this.prevAnim = this.anim; - for(boolean n : didProcess) if(n) { this.anim++; break; } + boolean didSomething = didProcess[0] || didProcess[1] || didProcess[2] || didProcess[3]; + if(didSomething) this.anim++; if(worldObj.getTotalWorldTime() % 20 == 0) { frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord); } + + if(didSomething && MainRegistry.proxy.me().getDistance(xCoord , yCoord, zCoord) < 50) { + if(audio == null) { + audio = createAudioLoop(); + audio.startSound(); + } else if(!audio.isPlaying()) { + audio = rebootAudio(audio); + } + audio.keepAlive(); + audio.updateVolume(this.getVolume(1F)); + + } else { + if(audio != null) { + audio.stopSound(); + audio = null; + } + } } } + + @Override public AudioWrapper createAudioLoop() { + return MainRegistry.proxy.getLoopedSound("hbm:block.chemicalPlant", xCoord, yCoord, zCoord, 1F, 15F, 1.0F, 20); + } + + @Override public void onChunkUnload() { + if(audio != null) { audio.stopSound(); audio = null; } + } + + @Override public void invalidate() { + super.invalidate(); + if(audio != null) { audio.stopSound(); audio = null; } + } public boolean canCool() { return water.getFill() >= 100 && lps.getFill() <= lps.getMaxFill() - 100; @@ -206,6 +250,17 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl new DirPos(xCoord + 0, yCoord, zCoord - 3, Library.NEG_Z), new DirPos(xCoord + 2, yCoord, zCoord - 3, Library.NEG_Z), + new DirPos(xCoord + dir.offsetX * 2 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 2 + rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord + dir.offsetX * 1 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 1 + rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord + dir.offsetX * 0 + rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 0 + rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord - dir.offsetX * 1 + rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 1 + rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord - dir.offsetX * 2 + rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 2 + rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord + dir.offsetX * 2 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 2 - rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord + dir.offsetX * 1 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 1 - rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord + dir.offsetX * 0 - rot.offsetX * 2, yCoord + 3, zCoord + dir.offsetZ * 0 - rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord - dir.offsetX * 1 - rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 1 - rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord - dir.offsetX * 2 - rot.offsetX * 2, yCoord + 3, zCoord - dir.offsetZ * 2 - rot.offsetZ * 2, Library.POS_Y), + new DirPos(xCoord + dir.offsetX + rot.offsetX * 3, yCoord, zCoord + dir.offsetZ + rot.offsetZ * 3, rot), new DirPos(xCoord - dir.offsetX + rot.offsetX * 3, yCoord, zCoord - dir.offsetZ + rot.offsetZ * 3, rot), new DirPos(xCoord + dir.offsetX - rot.offsetX * 3, yCoord, zCoord + dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()), diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java index 8047c02e4..838958668 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java @@ -13,7 +13,9 @@ import com.hbm.inventory.gui.GUIMachineChemicalPlant; import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.lib.Library; +import com.hbm.main.MainRegistry; import com.hbm.module.ModuleMachineChemplant; +import com.hbm.sound.AudioWrapper; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IUpgradeInfoProvider; import com.hbm.tileentity.TileEntityMachineBase; @@ -46,6 +48,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem public boolean frame = false; public int anim; public int prevAnim; + private AudioWrapper audio; public ModuleMachineChemplant chemplantModule; public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this); @@ -120,8 +123,38 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem if(worldObj.getTotalWorldTime() % 20 == 0) { frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord); } + + if(this.didProcess && MainRegistry.proxy.me().getDistance(xCoord , yCoord, zCoord) < 50) { + if(audio == null) { + audio = createAudioLoop(); + audio.startSound(); + } else if(!audio.isPlaying()) { + audio = rebootAudio(audio); + } + audio.keepAlive(); + audio.updateVolume(this.getVolume(1F)); + + } else { + if(audio != null) { + audio.stopSound(); + audio = null; + } + } } } + + @Override public AudioWrapper createAudioLoop() { + return MainRegistry.proxy.getLoopedSound("hbm:block.chemicalPlant", xCoord, yCoord, zCoord, 1F, 15F, 1.0F, 20); + } + + @Override public void onChunkUnload() { + if(audio != null) { audio.stopSound(); audio = null; } + } + + @Override public void invalidate() { + super.invalidate(); + if(audio != null) { audio.stopSound(); audio = null; } + } public DirPos[] getConPos() { return new DirPos[] { diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 819c38039..7b00fdbe6 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -372,6 +372,7 @@ container.machineAmmoPress=Munitionspresse container.machineArcWelder=Lichtbogenschweißer container.machineArcFurnaceLarge=Lichtbogenofen container.machineBoiler=Ölwärmer +container.machineChemicalFactory=Chemiefabrik container.machineChemicalPlant=Chemiewerk container.machineCMB=CMB-Stahl Hochofen container.machineCoal=Verbrennungsgenerator @@ -4357,9 +4358,10 @@ tile.machine_boiler_off.name=Alter Boiler tile.machine_catalytic_cracker.name=Katalytischer Cracking-Turm tile.machine_catalytic_reformer.name=Katalytischer Reformer tile.machine_centrifuge.name=Zentrifuge -tile.machine_chemfac.name=Chemiefabrik -tile.machine_chemical_plant.name=Chemiewerk 2: Electric Boogaloo -tile.machine_chemplant.name=Chemiewerk +tile.machine_chemfac.name=Chemiefabrik (Legacy) +tile.machine_chemical_factory.name=Chemiefabrik +tile.machine_chemical_plant.name=Chemiewerk +tile.machine_chemplant.name=Chemiewerk (Legacy) tile.machine_chungus.name=Leviathan-Dampfturbine tile.machine_chungus.desc=Effizienz: 85%% tile.machine_coal_off.name=Verbrennungsgenerator diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index a3a94ae52..6bb6b99ae 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -774,6 +774,7 @@ container.machineAmmoPress=Ammo Press container.machineArcWelder=Arc Welder container.machineArcFurnaceLarge=Arc Furnace container.machineBoiler=Oil Heater +container.machineChemicalFactory=Chemical Factory container.machineChemicalPlant=Chemical Plant container.machineCMB=CMB Steel Furnace container.machineCoal=Combustion Generator @@ -5489,9 +5490,11 @@ tile.machine_boiler_off.name=Old Boiler tile.machine_catalytic_cracker.name=Catalytic Cracking Tower tile.machine_catalytic_reformer.name=Catalytic Reformer tile.machine_centrifuge.name=Centrifuge -tile.machine_chemfac.name=Chemical Factory -tile.machine_chemical_plant.name=Chemical Plant 2: Electric Boogaloo -tile.machine_chemplant.name=Chemical Plant +tile.machine_chemfac.name=Chemical Factory (Legacy) +tile.machine_chemical_factory.name=Chemical Factory +tile.machine_chemical_factory.desc=Quadruple chemical plant.$Recipes process twice as fast,$but needs twice as much power.$Needs to be cooled with water,$produces low-pressure steam. +tile.machine_chemical_plant.name=Chemical Plant +tile.machine_chemplant.name=Chemical Plant (Legacy) tile.machine_chungus.name=Leviathan Steam Turbine tile.machine_chungus.desc=Efficiency: 85%% tile.machine_coal_off.name=Combustion Generator diff --git a/src/main/resources/assets/hbm/sounds.json b/src/main/resources/assets/hbm/sounds.json index 353359465..d7c59ae2c 100644 --- a/src/main/resources/assets/hbm/sounds.json +++ b/src/main/resources/assets/hbm/sounds.json @@ -67,6 +67,7 @@ "block.pyroOperate": {"category": "block", "sounds": [{"name": "block/pyroOperate", "stream": false}]}, "block.motor": {"category": "block", "sounds": [{"name": "block/motor", "stream": false}]}, "block.engine": {"category": "block", "sounds": [{"name": "block/engine", "stream": false}]}, + "block.chemicalPlant": {"category": "block", "sounds": [{"name": "block/chemicalPlant", "stream": false}]}, "door.TransitionSealOpen": {"category": "block", "sounds": [{"name": "block/door/transition_seal_open", "stream": true}]}, "door.wghStart": {"category": "block", "sounds": [{"name": "block/door/wgh_start", "stream": true}]}, diff --git a/src/main/resources/assets/hbm/sounds/block/chemicalPlant.ogg b/src/main/resources/assets/hbm/sounds/block/chemicalPlant.ogg new file mode 100644 index 000000000..ec82f034b Binary files /dev/null and b/src/main/resources/assets/hbm/sounds/block/chemicalPlant.ogg differ diff --git a/src/main/resources/assets/hbm/textures/models/machines/chemical_factory.png b/src/main/resources/assets/hbm/textures/models/machines/chemical_factory.png index ccdf935db..941813a41 100644 Binary files a/src/main/resources/assets/hbm/textures/models/machines/chemical_factory.png and b/src/main/resources/assets/hbm/textures/models/machines/chemical_factory.png differ