yet more chemfac crap

This commit is contained in:
Bob 2025-06-19 21:27:56 +02:00
parent 570ad03802
commit 381ef334b2
16 changed files with 197 additions and 30 deletions

View File

@ -7,6 +7,11 @@
* Upgrades stack with the double base speed * Upgrades stack with the double base speed
* Stackable! * Stackable!
* Water consumption rate is fixed at 100mB/t for each active recipe * 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 ## Changed
* The DNT suit now has a damage threshold of 1,000 * The DNT suit now has a damage threshold of 1,000
@ -20,6 +25,9 @@
* Improved threaded Mk5, should be a smidge faster now * Improved threaded Mk5, should be a smidge faster now
* Spires no longer progress phases on peaceful difficulty * Spires no longer progress phases on peaceful difficulty
* Spires now have a 20% chance of coming with instructions * 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 ## Fixed
* Chemical plant ports. For real this time. * Chemical plant ports. For real this time.

View File

@ -10,6 +10,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public class MachineChemfac extends BlockDummyable { public class MachineChemfac extends BlockDummyable {
public MachineChemfac(Material mat) { public MachineChemfac(Material mat) {

View File

@ -1,16 +1,26 @@
package com.hbm.blocks.machine; package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.tileentity.TileEntityProxyDyn; import com.hbm.tileentity.TileEntityProxyDyn;
import com.hbm.tileentity.machine.TileEntityMachineChemicalFactory; 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.block.material.Material;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class MachineChemicalFactory extends BlockDummyable { public class MachineChemicalFactory extends BlockDummyable implements ITooltipProvider, ILookOverlay {
public MachineChemicalFactory(Material mat) { public MachineChemicalFactory(Material mat) {
super(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++) { 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); 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<String> 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;
}
} }
} }

View File

@ -34,8 +34,8 @@ public class GUIMachineChemicalFactory extends GuiInfoContainer {
super.drawScreen(mouseX, mouseY, f); super.drawScreen(mouseX, mouseY, f);
for(int i = 0; i < 3; i++) for(int j = 0; j < 4; j++) { 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.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, 4, 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); 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++) { 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.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, 4, 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); chemplant.water.renderTank(guiLeft + 224, guiTop + 177, this.zLevel, 7, 52);

View File

@ -276,11 +276,6 @@ public class GUIScreenRecipeSelector extends GuiScreen {
else else
this.selection = NULL_SELECTION; 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(); click();
return; 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(guiLeft + 151 <= x && guiLeft + 151 + 18 > x && guiTop + 71 < y && guiTop + 71 + 18 >= y) {
if(!NULL_SELECTION.equals(this.selection)) { if(!NULL_SELECTION.equals(this.selection)) {
this.selection = this.NULL_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(); click();
return; 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 @Override
protected void keyTyped(char typedChar, int keyCode) { protected void keyTyped(char typedChar, int keyCode) {
@ -321,8 +322,6 @@ public class GUIScreenRecipeSelector extends GuiScreen {
FMLCommonHandler.instance().showGuiScreen(previousScreen); FMLCommonHandler.instance().showGuiScreen(previousScreen);
} }
} }
@Override public void onGuiClosed() { Keyboard.enableRepeatEvents(false); }
@Override public boolean doesGuiPauseGame() { return false; } @Override public boolean doesGuiPauseGame() { return false; }
public void click() { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } public void click() { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); }

View File

@ -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_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_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_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_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_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); 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) new ComparableStack(ModItems.circuit, 16, EnumCircuitType.BASIC)
}, 400); }, 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[] { makeRecipe(new ComparableStack(ModItems.missile_shuttle, 1), new AStack[] {
new ComparableStack(ModItems.missile_generic, 2), new ComparableStack(ModItems.missile_generic, 2),
new ComparableStack(ModItems.missile_strong, 1), new ComparableStack(ModItems.missile_strong, 1),

View File

@ -36,8 +36,20 @@ public class RenderChemicalFactory extends TileEntitySpecialRenderer implements
bindTexture(ResourceManager.chemical_factory_tex); bindTexture(ResourceManager.chemical_factory_tex);
ResourceManager.chemical_factory.renderPart("Base"); ResourceManager.chemical_factory.renderPart("Base");
if(chemplant.frame) ResourceManager.chemical_factory.renderPart("Frame"); 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"); 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"); ResourceManager.chemical_factory.renderPart("Fan2");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT); GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix(); GL11.glPopMatrix();

View File

@ -556,7 +556,6 @@ public class TileEntityHadron extends TileEntityMachineBase implements IEnergyRe
for(int c = z - dZ * 2; c <= z + dZ * 2;c++) { for(int c = z - dZ * 2; c <= z + dZ * 2;c++) {
Block block = worldObj.getBlock(a, b, c); Block block = worldObj.getBlock(a, b, c);
int meta = worldObj.getBlockMetadata(a, b, c);
/** ignore the center for now */ /** ignore the center for now */
if(a == x && b == y && c == z) { if(a == x && b == y && c == z) {

View File

@ -33,6 +33,7 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase implements IUpgradeInfoProvider, IFluidCopiable { public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase implements IUpgradeInfoProvider, IFluidCopiable {
float rotSpeed; float rotSpeed;

View File

@ -13,7 +13,9 @@ import com.hbm.inventory.gui.GUIMachineChemicalFactory;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.module.ModuleMachineChemplant; import com.hbm.module.ModuleMachineChemplant;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IUpgradeInfoProvider; import com.hbm.tileentity.IUpgradeInfoProvider;
import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.TileEntityMachineBase;
@ -52,6 +54,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
public boolean frame = false; public boolean frame = false;
public int anim; public int anim;
public int prevAnim; public int prevAnim;
private AudioWrapper audio;
public ModuleMachineChemplant[] chemplantModule; public ModuleMachineChemplant[] chemplantModule;
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this); public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
@ -89,9 +92,9 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
@Override @Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) { public boolean canExtractItem(int i, ItemStack itemStack, int j) {
if(i >= 8 && i <= 10) return true; if(i >= 8 && i <= 10) return true;
if(i >= 12 && i <= 14) return true; if(i >= 15 && i <= 17) return true;
if(i >= 19 && i <= 21) return true; if(i >= 22 && i <= 24) return true;
if(i >= 26 && i <= 28) return true; if(i >= 29 && i <= 31) return true;
return false; return false;
} }
@ -145,7 +148,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
for(DirPos pos : getCoolPos()) { for(DirPos pos : getCoolPos()) {
delegate.trySubscribe(worldObj, pos); delegate.trySubscribe(worldObj, pos);
delegate.trySubscribe(water.getTankType(), worldObj, pos); delegate.trySubscribe(water.getTankType(), worldObj, pos);
this.tryProvide(lps, worldObj, pos); delegate.tryProvide(lps, worldObj, pos);
} }
double speed = 1D; 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(); if(markDirty) this.markDirty();
this.networkPackNT(100); this.networkPackNT(100);
@ -177,13 +190,44 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl
} else { } else {
this.prevAnim = this.anim; 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) { if(worldObj.getTotalWorldTime() % 20 == 0) {
frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord); 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() { public boolean canCool() {
return water.getFill() >= 100 && lps.getFill() <= lps.getMaxFill() - 100; 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 + 0, yCoord, zCoord - 3, Library.NEG_Z),
new DirPos(xCoord + 2, 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), 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()), new DirPos(xCoord + dir.offsetX - rot.offsetX * 3, yCoord, zCoord + dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()),

View File

@ -13,7 +13,9 @@ import com.hbm.inventory.gui.GUIMachineChemicalPlant;
import com.hbm.items.machine.ItemMachineUpgrade; import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library; import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.module.ModuleMachineChemplant; import com.hbm.module.ModuleMachineChemplant;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IUpgradeInfoProvider; import com.hbm.tileentity.IUpgradeInfoProvider;
import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.TileEntityMachineBase;
@ -46,6 +48,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
public boolean frame = false; public boolean frame = false;
public int anim; public int anim;
public int prevAnim; public int prevAnim;
private AudioWrapper audio;
public ModuleMachineChemplant chemplantModule; public ModuleMachineChemplant chemplantModule;
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this); public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
@ -120,8 +123,38 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
if(worldObj.getTotalWorldTime() % 20 == 0) { if(worldObj.getTotalWorldTime() % 20 == 0) {
frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord); 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() { public DirPos[] getConPos() {
return new DirPos[] { return new DirPos[] {

View File

@ -372,6 +372,7 @@ container.machineAmmoPress=Munitionspresse
container.machineArcWelder=Lichtbogenschweißer container.machineArcWelder=Lichtbogenschweißer
container.machineArcFurnaceLarge=Lichtbogenofen container.machineArcFurnaceLarge=Lichtbogenofen
container.machineBoiler=Ölwärmer container.machineBoiler=Ölwärmer
container.machineChemicalFactory=Chemiefabrik
container.machineChemicalPlant=Chemiewerk container.machineChemicalPlant=Chemiewerk
container.machineCMB=CMB-Stahl Hochofen container.machineCMB=CMB-Stahl Hochofen
container.machineCoal=Verbrennungsgenerator 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_cracker.name=Katalytischer Cracking-Turm
tile.machine_catalytic_reformer.name=Katalytischer Reformer tile.machine_catalytic_reformer.name=Katalytischer Reformer
tile.machine_centrifuge.name=Zentrifuge tile.machine_centrifuge.name=Zentrifuge
tile.machine_chemfac.name=Chemiefabrik tile.machine_chemfac.name=Chemiefabrik (Legacy)
tile.machine_chemical_plant.name=Chemiewerk 2: Electric Boogaloo tile.machine_chemical_factory.name=Chemiefabrik
tile.machine_chemplant.name=Chemiewerk tile.machine_chemical_plant.name=Chemiewerk
tile.machine_chemplant.name=Chemiewerk (Legacy)
tile.machine_chungus.name=Leviathan-Dampfturbine tile.machine_chungus.name=Leviathan-Dampfturbine
tile.machine_chungus.desc=Effizienz: 85%% tile.machine_chungus.desc=Effizienz: 85%%
tile.machine_coal_off.name=Verbrennungsgenerator tile.machine_coal_off.name=Verbrennungsgenerator

View File

@ -774,6 +774,7 @@ container.machineAmmoPress=Ammo Press
container.machineArcWelder=Arc Welder container.machineArcWelder=Arc Welder
container.machineArcFurnaceLarge=Arc Furnace container.machineArcFurnaceLarge=Arc Furnace
container.machineBoiler=Oil Heater container.machineBoiler=Oil Heater
container.machineChemicalFactory=Chemical Factory
container.machineChemicalPlant=Chemical Plant container.machineChemicalPlant=Chemical Plant
container.machineCMB=CMB Steel Furnace container.machineCMB=CMB Steel Furnace
container.machineCoal=Combustion Generator 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_cracker.name=Catalytic Cracking Tower
tile.machine_catalytic_reformer.name=Catalytic Reformer tile.machine_catalytic_reformer.name=Catalytic Reformer
tile.machine_centrifuge.name=Centrifuge tile.machine_centrifuge.name=Centrifuge
tile.machine_chemfac.name=Chemical Factory tile.machine_chemfac.name=Chemical Factory (Legacy)
tile.machine_chemical_plant.name=Chemical Plant 2: Electric Boogaloo tile.machine_chemical_factory.name=Chemical Factory
tile.machine_chemplant.name=Chemical Plant 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.name=Leviathan Steam Turbine
tile.machine_chungus.desc=Efficiency: 85%% tile.machine_chungus.desc=Efficiency: 85%%
tile.machine_coal_off.name=Combustion Generator tile.machine_coal_off.name=Combustion Generator

View File

@ -67,6 +67,7 @@
"block.pyroOperate": {"category": "block", "sounds": [{"name": "block/pyroOperate", "stream": false}]}, "block.pyroOperate": {"category": "block", "sounds": [{"name": "block/pyroOperate", "stream": false}]},
"block.motor": {"category": "block", "sounds": [{"name": "block/motor", "stream": false}]}, "block.motor": {"category": "block", "sounds": [{"name": "block/motor", "stream": false}]},
"block.engine": {"category": "block", "sounds": [{"name": "block/engine", "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.TransitionSealOpen": {"category": "block", "sounds": [{"name": "block/door/transition_seal_open", "stream": true}]},
"door.wghStart": {"category": "block", "sounds": [{"name": "block/door/wgh_start", "stream": true}]}, "door.wghStart": {"category": "block", "sounds": [{"name": "block/door/wgh_start", "stream": true}]},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB