diff --git a/changelog b/changelog index fd3dc6df8..fac243f1a 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 @@ -18,6 +23,14 @@ * I don't know why people wanted this, but here you go * The alternate recipe for oxyhydrogen now uses compressed air instead of nothing * 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 +* The memespoon is now safe(tm) + * Instead of using a bugged instakill implementation, a fall distance of >2 now deals 50 extra melee damage + * Instead of blowing up like a nuke with a fall distance of >20, it now explodes similarly to a non-HE artillery grenade. This deals 150 damage in an AoE, has armor piercing properties and is, like the original functionality, still lethal to the user ## Fixed * Chemical plant ports. For real this time. @@ -27,4 +40,5 @@ * Potentially fixed shift clicking issue with the new chemical plant * Fixed blowtorch having a minimum gas requirement of 1,000mB despite only using 250mB * The gas turbine now uses audio with a 20 tick timeout, fixing a rare issue where the loop gets stuck and never ends -* Potentially fixed a dupe caused by using InventoryBogoSorter in combination with crates \ No newline at end of file +* Potentially fixed a dupe caused by using InventoryBogoSorter in combination with crates +* Rapidly spinning dyx should no longer have a state leak that would rotate lighting of unrelated TESRs with it \ No newline at end of file diff --git a/src/main/java/api/hbm/fluidmk2/IFluidRegisterListener.java b/src/main/java/api/hbm/fluidmk2/IFluidRegisterListener.java new file mode 100644 index 000000000..2fb0a4b66 --- /dev/null +++ b/src/main/java/api/hbm/fluidmk2/IFluidRegisterListener.java @@ -0,0 +1,9 @@ +package api.hbm.fluidmk2; + +public interface IFluidRegisterListener { + + /** + * Called when the fluid registry initializes all fluids. Use CompatFluidRegistry to create new instances of FluidType, which are automatically registered. + */ + public void onFluidsLoad(); +} diff --git a/src/main/java/api/hbm/fluidmk2/IFluidUserMK2.java b/src/main/java/api/hbm/fluidmk2/IFluidUserMK2.java index 755c415c5..1e60f7585 100644 --- a/src/main/java/api/hbm/fluidmk2/IFluidUserMK2.java +++ b/src/main/java/api/hbm/fluidmk2/IFluidUserMK2.java @@ -9,7 +9,7 @@ public interface IFluidUserMK2 extends IFluidConnectorMK2, ILoadedTile { public static final int HIGHEST_VALID_PRESSURE = 5; public static final int[] DEFAULT_PRESSURE_RANGE = new int[] {0, 0}; - public static final boolean particleDebug = true; + public static final boolean particleDebug = false; public FluidTank[] getAllTanks(); } diff --git a/src/main/java/com/hbm/blocks/generic/DungeonSpawner.java b/src/main/java/com/hbm/blocks/generic/DungeonSpawner.java index 65f4ef5e5..4a6fc10d8 100644 --- a/src/main/java/com/hbm/blocks/generic/DungeonSpawner.java +++ b/src/main/java/com/hbm/blocks/generic/DungeonSpawner.java @@ -81,6 +81,7 @@ public class DungeonSpawner extends BlockContainer { public static Function CON_ABERRATOR = (tile) -> { World world = tile.getWorldObj(); + if(world.difficultySetting.ordinal() == 0) return false; int x = tile.xCoord; int y = tile.yCoord; int z = tile.zCoord; @@ -122,7 +123,11 @@ public class DungeonSpawner extends BlockContainer { TileEntity te = world.getTileEntity(x, y + 18, z); if(te instanceof TileEntitySkeletonHolder) { TileEntitySkeletonHolder skeleton = (TileEntitySkeletonHolder) te; - skeleton.item = new ItemStack(ModItems.item_secret, 1, EnumSecretType.ABERRATOR.ordinal()); + if(world.rand.nextInt(5) == 0) { + skeleton.item = new ItemStack(ModItems.item_secret, 1, EnumSecretType.ABERRATOR.ordinal()); + } else { + skeleton.item = new ItemStack(ModItems.clay_tablet, 1, 1); + } skeleton.markDirty(); world.markBlockForUpdate(x, y + 18, z); } 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/fluid/FluidType.java b/src/main/java/com/hbm/inventory/fluid/FluidType.java index 93c9e565a..4cecc13a5 100644 --- a/src/main/java/com/hbm/inventory/fluid/FluidType.java +++ b/src/main/java/com/hbm/inventory/fluid/FluidType.java @@ -43,7 +43,7 @@ public class FluidType { public int flammability; public int reactivity; public EnumSymbol symbol; - public boolean customFluid = false; + public boolean renderWithTint = false; public static final int ROOM_TEMPERATURE = 20; @@ -81,7 +81,7 @@ public class FluidType { this.texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/fluids/" + texName + ".png"); this.guiTint = tint; this.localizedOverride = displayName; - this.customFluid = true; + this.renderWithTint = true; this.id = id; Fluids.register(this, id); @@ -95,6 +95,22 @@ public class FluidType { } } + /** For CompatFluidRegistry */ + public FluidType(String name, int id, int color, int p, int f, int r, EnumSymbol symbol, ResourceLocation texture) { + this.stringId = name; + this.color = color; + this.unlocalized = "hbmfluid." + name.toLowerCase(Locale.US); + this.poison = p; + this.flammability = f; + this.reactivity = r; + this.symbol = symbol; + this.texture = texture; + this.renderWithTint = true; + + this.id = id; + Fluids.register(this, id); + } + public FluidType setTemp(int temperature) { this.temperature = temperature; return this; diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index 37c68f121..1a0b5dcd2 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -28,12 +28,15 @@ import com.hbm.inventory.fluid.trait.FT_Toxin.*; import com.hbm.render.util.EnumSymbol; import com.hbm.util.ArmorRegistry.HazardClass; +import api.hbm.fluidmk2.IFluidRegisterListener; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; public class Fluids { public static final Gson gson = new Gson(); + + public static List additionalListeners = new ArrayList(); public static FluidType NONE; public static FluidType AIR; @@ -197,8 +200,10 @@ public class Fluids { private static final HashMap idMapping = new HashMap(); private static final HashMap nameMapping = new HashMap(); + /** Inconsequential, only actually used when listing all fluids with niceOrder disabled */ protected static final List registerOrder = new ArrayList(); - protected static final List metaOrder = new ArrayList(); + /** What's used to list fluids with niceOrder enabled */ + public static final List metaOrder = new ArrayList(); public static final FT_Liquid LIQUID = new FT_Liquid(); public static final FT_Viscous VISCOUS = new FT_Viscous(); @@ -588,6 +593,8 @@ public class Fluids { // LEGACY ACID = PEROXIDE; + + for(IFluidRegisterListener listener : additionalListeners) listener.onFluidsLoad(); for(FluidType custom : customFluids) metaOrder.add(custom); 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/inventory/recipes/loader/SerializableRecipe.java b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java index 46f9aa47c..a89e19b26 100644 --- a/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java +++ b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java @@ -34,10 +34,10 @@ import net.minecraft.item.ItemStack; public abstract class SerializableRecipe { public static final Gson gson = new Gson(); - public static List recipeHandlers = new ArrayList<>(); - public static List additionalListeners = new ArrayList<>(); + public static List recipeHandlers = new ArrayList(); + public static List additionalListeners = new ArrayList(); - public static Map recipeSyncHandlers = new HashMap<>(); + public static Map recipeSyncHandlers = new HashMap(); public boolean modified = false; diff --git a/src/main/java/com/hbm/items/tool/WeaponSpecial.java b/src/main/java/com/hbm/items/tool/WeaponSpecial.java index 49041e842..faba31497 100644 --- a/src/main/java/com/hbm/items/tool/WeaponSpecial.java +++ b/src/main/java/com/hbm/items/tool/WeaponSpecial.java @@ -4,11 +4,13 @@ import java.util.List; import java.util.Random; import com.google.common.collect.Multimap; -import com.hbm.entity.effect.EntityNukeTorex; -import com.hbm.entity.logic.EntityNukeExplosionMK5; import com.hbm.entity.projectile.EntityRubble; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth; +import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.items.ModItems; import com.hbm.main.MainRegistry; +import com.hbm.particle.helper.ExplosionCreator; import com.hbm.potion.HbmPotion; import com.hbm.util.ArmorUtil; @@ -23,21 +25,21 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.Vec3; import net.minecraft.world.World; public class WeaponSpecial extends ItemSword { - + Random rand = new Random(); public WeaponSpecial(ToolMaterial p_i45356_1_) { super(p_i45356_1_); } - - @Override - public EnumRarity getRarity(ItemStack p_77613_1_) - { + + @Override + public EnumRarity getRarity(ItemStack p_77613_1_) { if(this == ModItems.schrabidium_hammer) { return EnumRarity.rare; } @@ -47,26 +49,23 @@ public class WeaponSpecial extends ItemSword { if(this == ModItems.shimmer_sledge || this == ModItems.shimmer_axe) { return EnumRarity.epic; } - + return EnumRarity.common; - } - - @Override - public boolean hitEntity(ItemStack stack, EntityLivingBase entity, EntityLivingBase entityPlayer) - { - World world = entity.worldObj; + } + + @Override + public boolean hitEntity(ItemStack stack, EntityLivingBase entity, EntityLivingBase entityPlayer) { + World world = entity.worldObj; if(this == ModItems.schrabidium_hammer) { - if (!world.isRemote) - { - entity.setHealth(0.0F); - } - world.playSoundAtEntity(entity, "hbm:weapon.bonk", 3.0F, 1.0F); + if(!world.isRemote) { + entity.setHealth(0.0F); + } + world.playSoundAtEntity(entity, "hbm:weapon.bonk", 3.0F, 1.0F); } if(this == ModItems.bottle_opener) { - if (!world.isRemote) - { + if(!world.isRemote) { int i = rand.nextInt(7); if(i == 0) entity.addPotionEffect(new PotionEffect(Potion.blindness.id, 5 * 60 * 20, 0)); @@ -76,19 +75,18 @@ public class WeaponSpecial extends ItemSword { entity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 5 * 60 * 20, 2)); if(i == 3) entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 1 * 60 * 20, 0)); - } - world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 1.F); + } + world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 1.F); } - + if(this == ModItems.ullapool_caber) { - if (!world.isRemote) - { + if(!world.isRemote) { world.createExplosion(null, entity.posX, entity.posY, entity.posZ, 7.5F, true); - } - + } + stack.damageItem(505, entityPlayer); } - + if(this == ModItems.shimmer_sledge) { Vec3 vec = entityPlayer.getLookVec(); double dX = vec.xCoord * 5; @@ -98,37 +96,37 @@ public class WeaponSpecial extends ItemSword { entity.motionX += dX; entity.motionY += dY; entity.motionZ += dZ; - world.playSoundAtEntity(entity, "hbm:weapon.bang", 3.0F, 1.F); + world.playSoundAtEntity(entity, "hbm:weapon.bang", 3.0F, 1.F); } - + if(this == ModItems.shimmer_axe) { entity.setHealth(entity.getHealth() / 2); - - world.playSoundAtEntity(entity, "hbm:weapon.slice", 3.0F, 1.F); + + world.playSoundAtEntity(entity, "hbm:weapon.slice", 3.0F, 1.F); } - + if(this == ModItems.wood_gavel) { - world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F); + world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F); } - + if(this == ModItems.lead_gavel) { - world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F); - + world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F); + entity.addPotionEffect(new PotionEffect(HbmPotion.lead.id, 15 * 20, 4)); } - + if(this == ModItems.diamond_gavel) { - + float ded = entity.getMaxHealth() / 3; entity.setHealth(entity.getHealth() - ded); - - world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F); + + world.playSoundAtEntity(entity, "hbm:weapon.whack", 3.0F, 1.F); } - + if(this == ModItems.wrench) { Vec3 vec = entityPlayer.getLookVec(); - + double dX = vec.xCoord * 0.5; double dY = vec.yCoord * 0.5; double dZ = vec.zCoord * 0.5; @@ -136,47 +134,47 @@ public class WeaponSpecial extends ItemSword { entity.motionX += dX; entity.motionY += dY; entity.motionZ += dZ; - world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 0.75F); + world.playSoundAtEntity(entity, "random.anvil_land", 3.0F, 0.75F); } - - if(this == ModItems.memespoon) { + + if(this == ModItems.memespoon && !world.isRemote) { + + if(!(entityPlayer instanceof EntityPlayer)) + return false; if(entityPlayer.fallDistance >= 2) { world.playSoundAtEntity(entity, "hbm:weapon.bang", 3.0F, 0.75F); - entity.setHealth(0); + entity.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) entityPlayer), 50F); } - - if(!(entityPlayer instanceof EntityPlayer)) - return false; - - if(entityPlayer.fallDistance >= 20 && !((EntityPlayer)entityPlayer).capabilities.isCreativeMode) { - if(!world.isRemote) { - world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, 100, entity.posX, entity.posY, entity.posZ)); - EntityNukeTorex.statFacStandard(world, entity.posX, entity.posY, entity.posZ, 100); - } + + if(entityPlayer.fallDistance >= 20 && !((EntityPlayer) entityPlayer).capabilities.isCreativeMode) { + ExplosionVNT vnt = new ExplosionVNT(world, entity.posX, entity.posY + entity.height / 2D, entity.posZ, 15, entityPlayer); + vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, 150).setupPiercing(25, 0.5F)); + vnt.setPlayerProcessor(new PlayerProcessorStandard()); + ExplosionCreator.composeEffectSmall(world, entity.posX, entity.posY + entity.height / 2D, entity.posZ); + vnt.explode(); } } if(this == ModItems.stopsign || this == ModItems.sopsign) - world.playSoundAtEntity(entity, "hbm:weapon.stop", 1.0F, 1.0F); - + world.playSoundAtEntity(entity, "hbm:weapon.stop", 1.0F, 1.0F); + return false; - } - + } + @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f1, float f2, float f3) - { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f1, float f2, float f3) { if(this == ModItems.shimmer_sledge) { if(world.getBlock(x, y, z) != Blocks.air && world.getBlock(x, y, z).getExplosionResistance(null) < 6000) { - + EntityRubble rubble = new EntityRubble(world); rubble.posX = x + 0.5F; rubble.posY = y; rubble.posZ = z + 0.5F; - + rubble.setMetaBasedOnBlock(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); - + Vec3 vec = player.getLookVec(); double dX = vec.xCoord * 5; double dY = vec.yCoord * 5; @@ -185,22 +183,22 @@ public class WeaponSpecial extends ItemSword { rubble.motionX += dX; rubble.motionY += dY; rubble.motionZ += dZ; - world.playSoundAtEntity(rubble, "hbm:weapon.bang", 3.0F, 1.0F); - - if(!world.isRemote) { - - world.spawnEntityInWorld(rubble); + world.playSoundAtEntity(rubble, "hbm:weapon.bang", 3.0F, 1.0F); + + if(!world.isRemote) { + + world.spawnEntityInWorld(rubble); world.func_147480_a(x, y, z, false); - } + } } return true; } - + if(this == ModItems.shimmer_axe) { - world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.kapeng", 3.0F, 1.0F); + world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.kapeng", 3.0F, 1.0F); - if(!world.isRemote) { + if(!world.isRemote) { if(world.getBlock(x, y, z) != Blocks.air && world.getBlock(x, y, z).getExplosionResistance(null) < 6000) { world.func_147480_a(x, y, z, false); } @@ -210,17 +208,16 @@ public class WeaponSpecial extends ItemSword { if(world.getBlock(x, y - 1, z) != Blocks.air && world.getBlock(x, y - 1, z).getExplosionResistance(null) < 6000) { world.func_147480_a(x, y - 1, z, false); } - } + } return true; } - + return false; - } - - @Override - public Multimap getItemAttributeModifiers() - { - Multimap multimap = super.getItemAttributeModifiers(); + } + + @Override + public Multimap getItemAttributeModifiers() { + Multimap multimap = super.getItemAttributeModifiers(); if(this == ModItems.schrabidium_hammer) { multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", -0.5, 1)); } @@ -230,24 +227,23 @@ public class WeaponSpecial extends ItemSword { if(this == ModItems.wrench || this == ModItems.wrench_flipped) { multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", -0.1, 1)); } - return multimap; - } - - @Override + return multimap; + } + + @Override public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) { - if(entity instanceof EntityPlayer) { - if(ArmorUtil.checkForFiend((EntityPlayer) entity)) { - ((EntityPlayer) entity).triggerAchievement(MainRegistry.achFiend); - } else if(ArmorUtil.checkForFiend2((EntityPlayer) entity)) { - ((EntityPlayer) entity).triggerAchievement(MainRegistry.achFiend2); - } - } - } - + if(entity instanceof EntityPlayer) { + if(ArmorUtil.checkForFiend((EntityPlayer) entity)) { + ((EntityPlayer) entity).triggerAchievement(MainRegistry.achFiend); + } else if(ArmorUtil.checkForFiend2((EntityPlayer) entity)) { + ((EntityPlayer) entity).triggerAchievement(MainRegistry.achFiend2); + } + } + } + @Override - public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) - { + public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { if(this == ModItems.schrabidium_hammer) { list.add("Even though it says \"+1000000000"); list.add("damage\", it's actually \"onehit anything\""); 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/render/tileentity/RenderFluidTank.java b/src/main/java/com/hbm/render/tileentity/RenderFluidTank.java index acb9a0b0c..924bd7998 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFluidTank.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFluidTank.java @@ -83,7 +83,7 @@ public class RenderFluidTank extends TileEntitySpecialRenderer implements IItemR public String getTextureFromType(FluidType type) { - if(type.customFluid) { + if(type.renderWithTint) { int color = type.getTint(); double r = ((color & 0xff0000) >> 16) / 255D; double g = ((color & 0x00ff00) >> 8) / 255D; diff --git a/src/main/java/com/hbm/render/tileentity/RendererObjTester.java b/src/main/java/com/hbm/render/tileentity/RendererObjTester.java index 8762c01c0..450fcd6cb 100644 --- a/src/main/java/com/hbm/render/tileentity/RendererObjTester.java +++ b/src/main/java/com/hbm/render/tileentity/RendererObjTester.java @@ -35,11 +35,8 @@ public class RendererObjTester extends TileEntitySpecialRenderer { public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 1, z + 0.5); - GL11.glRotated(15, 0, 0, 1); GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glRotated(System.currentTimeMillis() / 5D % 360D, 0, -1, 0); - if(world == null) { world = new WorldInAJar(5, 3, 5); for(int i = 0; i < 25; i++) world.setBlock(i / 5, 1, i % 5, Blocks.brick_block, 0); @@ -55,6 +52,8 @@ public class RendererObjTester extends TileEntitySpecialRenderer { RenderHelper.disableStandardItemLighting(); GL11.glPushMatrix(); + GL11.glRotated(15, 0, 0, 1); + GL11.glRotated(System.currentTimeMillis() / 5D % 360D, 0, -1, 0); GL11.glTranslated(-2.5, 0, -2.5); Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); GL11.glShadeModel(GL11.GL_SMOOTH); @@ -73,6 +72,10 @@ public class RendererObjTester extends TileEntitySpecialRenderer { GL11.glPopMatrix(); RenderHelper.enableStandardItemLighting(); + + GL11.glRotated(15, 0, 0, 1); + GL11.glRotated(System.currentTimeMillis() / 5D % 360D, 0, -1, 0); + GL11.glTranslated(0, 2.1, 0.5); this.bindTexture(extra); 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/java/com/hbm/util/CompatExternal.java b/src/main/java/com/hbm/util/CompatExternal.java index 064e7f7eb..7157dcb1d 100644 --- a/src/main/java/com/hbm/util/CompatExternal.java +++ b/src/main/java/com/hbm/util/CompatExternal.java @@ -9,6 +9,7 @@ import java.util.function.Consumer; import api.hbm.energymk2.IEnergyHandlerMK2; import api.hbm.energymk2.IEnergyReceiverMK2; +import api.hbm.fluidmk2.IFluidRegisterListener; import api.hbm.fluidmk2.IFluidUserMK2; import api.hbm.recipe.IRecipeRegisterListener; @@ -16,6 +17,7 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.entity.missile.EntityMissileCustom; import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.inventory.fluid.FluidType; +import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.items.weapon.ItemCustomMissilePart.WarheadType; @@ -198,6 +200,15 @@ public class CompatExternal { public static void registerRecipeRegisterListener(IRecipeRegisterListener listener) { SerializableRecipe.additionalListeners.add(listener); } + + /** + * Registers an IFluidRegisterListener which is called every time the fluid list is loaded, either during startup or when the refresh command is used. + * Ensures that fluids are registered when they should, instead of being purged permanently when the system reloads. + * @param listener + */ + public static void registerFluidRegisterListener(IFluidRegisterListener listener) { + Fluids.additionalListeners.add(listener); + } public static void compatExamples() { // Makes all cows be targeted by turrets if player mode is active in addition to the existing rules. Applies to all entities that inherit EntityCow. diff --git a/src/main/java/com/hbm/util/CompatFluidRegistry.java b/src/main/java/com/hbm/util/CompatFluidRegistry.java new file mode 100644 index 000000000..c683734c9 --- /dev/null +++ b/src/main/java/com/hbm/util/CompatFluidRegistry.java @@ -0,0 +1,17 @@ +package com.hbm.util; + +import com.hbm.inventory.fluid.FluidType; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.render.util.EnumSymbol; + +import net.minecraft.util.ResourceLocation; + +public class CompatFluidRegistry { + + /** Registers a fluid with a custom ID. */ + public static FluidType registerFluid(String name, int id, int color, int p, int f, int r, EnumSymbol symbol, ResourceLocation texture) { + FluidType type = new FluidType(name, id, color, p, f, r, symbol, texture); + Fluids.metaOrder.add(type); + return type; + } +} diff --git a/src/main/java/com/hbm/util/CompatRecipeRegistry.java b/src/main/java/com/hbm/util/CompatRecipeRegistry.java index d6c89ad5d..9c66b9dbf 100644 --- a/src/main/java/com/hbm/util/CompatRecipeRegistry.java +++ b/src/main/java/com/hbm/util/CompatRecipeRegistry.java @@ -29,6 +29,8 @@ import com.hbm.inventory.recipes.anvil.AnvilRecipes; import com.hbm.inventory.recipes.anvil.AnvilRecipes.AnvilConstructionRecipe; import com.hbm.inventory.recipes.anvil.AnvilRecipes.AnvilOutput; import com.hbm.inventory.recipes.anvil.AnvilRecipes.OverlayType; +import com.hbm.inventory.recipes.loader.GenericRecipe; +import com.hbm.inventory.recipes.loader.GenericRecipes.IOutput; import com.hbm.items.machine.ItemStamp.StampType; import com.hbm.util.Tuple.Pair; import com.hbm.util.Tuple.Triplet; @@ -70,8 +72,7 @@ public class CompatRecipeRegistry { SolderingRecipes.recipes.add(new SolderingRecipe(output, time, power, fluid, copyFirst(toppings, 3), copyFirst(pcb, 2), copyFirst(solder, 1))); } - /** Chemplant recipes need unique IDs, game will crash when an ID collision is detected! */ - public static void registerChemplant(int id, String name, int duration, AStack[] inputItems, FluidStack[] inputFluids, ItemStack[] outputItems, FluidStack[] outputFluids) { + @Deprecated public static void registerChemplant(int id, String name, int duration, AStack[] inputItems, FluidStack[] inputFluids, ItemStack[] outputItems, FluidStack[] outputFluids) { ChemRecipe recipe = new ChemRecipe(id, name, duration); if(inputItems != null) recipe.inputItems(copyFirst(inputItems, 4)); if(inputFluids != null) recipe.inputFluids(copyFirst(inputFluids, 2)); @@ -79,6 +80,18 @@ public class CompatRecipeRegistry { if(outputFluids != null) recipe.outputFluids(copyFirst(outputFluids, 2)); ChemplantRecipes.recipes.add(recipe); } + + /** Chemical plant recipe needs a unique name for the registry. Zero length arrays should stay null*/ + public static void registerChemicalPlant(String name, boolean named, ItemStack icon, int duration, long power, AStack[] inputItems, FluidStack[] inputFluids, IOutput[] outputItems, FluidStack[] outputFluids) { + GenericRecipe recipe = new GenericRecipe(name).setDuration(duration).setPower(power); + if(named) recipe.setNamed(); + if(icon != null) recipe.setIcon(icon); + if(inputItems != null && inputItems.length > 0) recipe.inputItems(inputItems); + if(inputFluids != null && inputFluids.length > 0) recipe.inputFluids(inputFluids); + if(outputItems != null && outputItems.length > 0) recipe.outputItems(outputItems); + if(outputFluids != null && outputFluids.length > 0) recipe.outputFluids(outputFluids); + ChemicalPlantRecipes.INSTANCE.register(recipe); + } /** Either solid or liquid output can be null */ public static void registerCombination(AStack input, ItemStack output, FluidStack fluid) { @@ -223,6 +236,7 @@ public class CompatRecipeRegistry { AmmoPressRecipes.recipes.add(new AmmoPressRecipe(output, input)); } + /** Assembler recipes are identified by the output as a ComparableStack, so no two recipes can share output. */ public static void registerAssembler(ItemStack output, AStack[] input, int time) { AssemblerRecipes.makeRecipe(new ComparableStack(output), copyFirst(input, 12), time); } 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..8e915f009 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 need 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/items/gem_erisite_test.png b/src/main/resources/assets/hbm/textures/items/gem_erisite_test.png new file mode 100644 index 000000000..8f4a0983a Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/gem_erisite_test.png 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