From ff75e7662ecca0e7700fd91065b049ca95e13e63 Mon Sep 17 00:00:00 2001 From: Boblet Date: Mon, 1 Sep 2025 09:35:41 +0200 Subject: [PATCH] and then i went to the store to buy some gloop --- changelog | 33 ++++++------------- .../com/hbm/blocks/generic/BlockRebar.java | 1 + .../blocks/machine/MachineSolarBoiler.java | 8 ++--- .../java/com/hbm/config/ClientConfig.java | 4 +++ .../com/hbm/handler/nei/PWRRecipeHandler.java | 32 ++++++++++++++++++ .../hbm/handler/nei/WatzRecipeHandler.java | 32 ++++++++++++++++++ .../recipes/loader/GenericRecipe.java | 5 ++- .../com/hbm/items/tool/ItemMirrorTool.java | 12 ++++--- src/main/java/com/hbm/main/NEIRegistry.java | 2 ++ .../hbm/module/machine/ModuleMachineBase.java | 7 ++++ .../render/tileentity/RenderSolarBoiler.java | 6 ++++ .../TileEntityMachineAssemblyMachine.java | 2 +- .../TileEntityMachineChemicalFactory.java | 1 + .../TileEntityMachineChemicalPlant.java | 2 +- .../machine/TileEntityMachinePUREX.java | 2 +- .../machine/TileEntitySolarBoiler.java | 8 ++--- src/main/resources/assets/hbm/lang/en_US.lang | 2 ++ 17 files changed, 116 insertions(+), 43 deletions(-) create mode 100644 src/main/java/com/hbm/handler/nei/PWRRecipeHandler.java create mode 100644 src/main/java/com/hbm/handler/nei/WatzRecipeHandler.java diff --git a/changelog b/changelog index 5d4eaf7ab..e4cfeea5a 100644 --- a/changelog +++ b/changelog @@ -1,26 +1,13 @@ -## Added -* N I 4 N I - * It's that one gun from that one game, you throw coins and your shots bounce around - * Needs no introduction - * Can be upgraded with nickels or gold doubloons for more pocket change to yeet - * Found in airdrop supply crates, about 10x rarer than a double barrel shotgun -* More structures - * I haven't even looked at them so it's a surprise for everyone -* PWR printer - * Using it on a PWR controller will cause the game to generate images of each layer of the reactor - ## Changed -* Updated ukrainian, chinese and russian localization, including QMAW -* Some previously hardcoded lang strings are now affected by translations -* Due to severe issues with ticking order as well as a crash caused by certain tiles that uses threaded packets, Torcherino accelerator torches no longer affect NTM machines -* RBMK control rod colors and auto control rod settings are now copiable -* Murky wings no longer have slowfall, and using shift+space cancels the momentum -* Murky wings are now slow by default and speed up when sprinting -* The arc furnace can now be used with AE2 buses, which was previously not possible due to the unique stacksize limitations +* The amount of filled rebar that can be rendered at once is now capped (can be changed with the client config `RENDER_REBAR_LIMIT`) + * This causes holes and looks a bit buggy, but for now it's better than lagging the game out +* The amount of light beams per solar boiler is now limited (can be changed with the client config `RENDER_HELIOSTAT_BEAM_LIMIT`) +* Changed the way mirror linking works for the solar boiler + * The max range is now 100m (instead of 25m) + * There is now an angle requirement, mirrors cannot be rotated more than 45° + * This means that the solar boiler can use more mirrors, the higher up it is + * Existing setups will continue to function, as these rules only apply during the linking process +* The PWR and watz now have NEI handlers, showing the fuel to depleted fuel process ## Fixed -* Fixed conveyor grabber dropping items off at an offset when placing them on a conveyor belt due to a client desync -* Fixed occasional crash caused by using the settings tool on the autoloader -* Fixed QMAW not correctly working with other languages -* Fixed QMAW loading breaking entirely due to file encoding -* Fixed PWR fuel rod textures being 18x18 instead of 16x16 \ No newline at end of file +* Fixed broken localization in the recipe selector GUI \ No newline at end of file diff --git a/src/main/java/com/hbm/blocks/generic/BlockRebar.java b/src/main/java/com/hbm/blocks/generic/BlockRebar.java index 391533e0a..0ced0a653 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockRebar.java +++ b/src/main/java/com/hbm/blocks/generic/BlockRebar.java @@ -372,6 +372,7 @@ public class BlockRebar extends BlockContainer implements ISBRHUniversal { if(!(o instanceof TileEntityRebar)) continue; TileEntityRebar rebar = (TileEntityRebar) o; if(rebar.progress > 0) rebars.add(rebar); + if(rebars.size() >= ClientConfig.RENDER_REBAR_LIMIT.get()) break; } Minecraft mc = Minecraft.getMinecraft(); diff --git a/src/main/java/com/hbm/blocks/machine/MachineSolarBoiler.java b/src/main/java/com/hbm/blocks/machine/MachineSolarBoiler.java index c97620d2b..17d6cb928 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineSolarBoiler.java +++ b/src/main/java/com/hbm/blocks/machine/MachineSolarBoiler.java @@ -26,12 +26,8 @@ public class MachineSolarBoiler extends BlockDummyable implements ILookOverlay { @Override public TileEntity createNewTileEntity(World world, int meta) { - - if(meta >= 12) - return new TileEntitySolarBoiler(); - if(meta >= extra) - return new TileEntityProxyCombo(false, false, true); - + if(meta >= 12) return new TileEntitySolarBoiler(); + if(meta >= extra) return new TileEntityProxyCombo(false, false, true); return null; } diff --git a/src/main/java/com/hbm/config/ClientConfig.java b/src/main/java/com/hbm/config/ClientConfig.java index 0dc370790..e1e8dd407 100644 --- a/src/main/java/com/hbm/config/ClientConfig.java +++ b/src/main/java/com/hbm/config/ClientConfig.java @@ -33,6 +33,8 @@ public class ClientConfig extends RunningConfig { public static ConfigWrapper NEI_HIDE_SECRETS = new ConfigWrapper(true); public static ConfigWrapper COOLING_TOWER_PARTICLES = new ConfigWrapper(true); public static ConfigWrapper RENDER_REBAR_SIMPLE = new ConfigWrapper(false); + public static ConfigWrapper RENDER_HELIOSTAT_BEAM_LIMIT = new ConfigWrapper(250); + public static ConfigWrapper RENDER_REBAR_LIMIT = new ConfigWrapper(250); private static void initDefaults() { configMap.put("GEIGER_OFFSET_HORIZONTAL", GEIGER_OFFSET_HORIZONTAL); @@ -55,6 +57,8 @@ public class ClientConfig extends RunningConfig { configMap.put("NEI_HIDE_SECRETS", NEI_HIDE_SECRETS); configMap.put("COOLING_TOWER_PARTICLES", COOLING_TOWER_PARTICLES); configMap.put("RENDER_REBAR_SIMPLE", RENDER_REBAR_SIMPLE); + configMap.put("RENDER_HELIOSTAT_BEAM_LIMIT", RENDER_HELIOSTAT_BEAM_LIMIT); + configMap.put("RENDER_REBAR_LIMIT", RENDER_REBAR_LIMIT); } /** Initializes defaults, then reads the config file if it exists, then writes the config file. */ diff --git a/src/main/java/com/hbm/handler/nei/PWRRecipeHandler.java b/src/main/java/com/hbm/handler/nei/PWRRecipeHandler.java new file mode 100644 index 000000000..0125f2b1f --- /dev/null +++ b/src/main/java/com/hbm/handler/nei/PWRRecipeHandler.java @@ -0,0 +1,32 @@ +package com.hbm.handler.nei; + +import java.util.HashMap; + +import com.hbm.blocks.ModBlocks; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemPWRFuel.EnumPWRFuel; + +import net.minecraft.item.ItemStack; + +public class PWRRecipeHandler extends NEIUniversalHandler { + + public PWRRecipeHandler() { + super(ModBlocks.pwr_controller.getLocalizedName(), ModBlocks.pwr_controller, getFuelRecipes()); + } + + @Override + public String getKey() { + return "ntmPWR"; + } + + public static HashMap getFuelRecipes() { + + HashMap map = new HashMap(); + + for(EnumPWRFuel fuel : EnumPWRFuel.values()) { + map.put(new ItemStack(ModItems.pwr_fuel, 1, fuel.ordinal()), new ItemStack(ModItems.pwr_fuel_hot, 1, fuel.ordinal())); + } + + return map; + } +} diff --git a/src/main/java/com/hbm/handler/nei/WatzRecipeHandler.java b/src/main/java/com/hbm/handler/nei/WatzRecipeHandler.java new file mode 100644 index 000000000..52b7ac819 --- /dev/null +++ b/src/main/java/com/hbm/handler/nei/WatzRecipeHandler.java @@ -0,0 +1,32 @@ +package com.hbm.handler.nei; + +import java.util.HashMap; + +import com.hbm.blocks.ModBlocks; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemWatzPellet.EnumWatzType; + +import net.minecraft.item.ItemStack; + +public class WatzRecipeHandler extends NEIUniversalHandler { + + public WatzRecipeHandler() { + super(ModBlocks.watz.getLocalizedName(), ModBlocks.watz, getFuelRecipes()); + } + + @Override + public String getKey() { + return "ntmWatz"; + } + + public static HashMap getFuelRecipes() { + + HashMap map = new HashMap(); + + for(EnumWatzType fuel : EnumWatzType.values()) { + map.put(new ItemStack(ModItems.watz_pellet, 1, fuel.ordinal()), new ItemStack(ModItems.watz_pellet_depleted, 1, fuel.ordinal())); + } + + return map; + } +} diff --git a/src/main/java/com/hbm/inventory/recipes/loader/GenericRecipe.java b/src/main/java/com/hbm/inventory/recipes/loader/GenericRecipe.java index 53a0bb7a2..e62af83f6 100644 --- a/src/main/java/com/hbm/inventory/recipes/loader/GenericRecipe.java +++ b/src/main/java/com/hbm/inventory/recipes/loader/GenericRecipe.java @@ -116,7 +116,7 @@ public class GenericRecipe { List list = new ArrayList(); list.add(EnumChatFormatting.YELLOW + this.getLocalizedName()); - // autoswitch group (two lines: label + "Enabled for") + // autoswitch group if(this.autoSwitchGroup != null) { String[] lines = I18nUtil.resolveKeyArray("autoswitch", I18nUtil.resolveKey(this.autoSwitchGroup)); for(String line : lines) list.add(EnumChatFormatting.GOLD + line); @@ -146,10 +146,9 @@ public class GenericRecipe { if(outputItem != null) for(IOutput output : outputItem) for(String line : output.getLabel()) list.add(" " + line); if(outputFluid != null) for(FluidStack fluid : outputFluid) { - String mB = I18nUtil.resolveKey("gui.recipe.mB"); String pressurePart = fluid.pressure == 0 ? "" : " " + I18nUtil.resolveKey("gui.recipe.atPressure") + " " + EnumChatFormatting.RED + fluid.pressure + " PU"; - list.add(" " + EnumChatFormatting.BLUE + fluid.fill + mB + " " + fluid.type.getLocalizedName() + pressurePart); + list.add(" " + EnumChatFormatting.BLUE + fluid.fill + "mB " + fluid.type.getLocalizedName() + pressurePart); } return list; diff --git a/src/main/java/com/hbm/items/tool/ItemMirrorTool.java b/src/main/java/com/hbm/items/tool/ItemMirrorTool.java index 5387a1a82..6e3be9078 100644 --- a/src/main/java/com/hbm/items/tool/ItemMirrorTool.java +++ b/src/main/java/com/hbm/items/tool/ItemMirrorTool.java @@ -50,20 +50,24 @@ public class ItemMirrorTool extends Item { if(b == ModBlocks.solar_mirror && stack.hasTagCompound()) { if(!world.isRemote) { - TileEntitySolarMirror mirror = (TileEntitySolarMirror)world.getTileEntity(x, y, z); + TileEntitySolarMirror mirror = (TileEntitySolarMirror) world.getTileEntity(x, y, z); int tx = stack.stackTagCompound.getInteger("posX"); int ty = stack.stackTagCompound.getInteger("posY"); int tz = stack.stackTagCompound.getInteger("posZ"); + + boolean withinReach = Vec3.createVectorHelper(x - tx, y - ty, z - tz).lengthVector() <= 100; + boolean withinAngle = (x - tx) * (x - tx) + (z - tz) * (z - tz) <= (y - ty) * (y - ty); - if(Vec3.createVectorHelper(x - tx, y - ty, z - tz).lengthVector() < 25) - mirror.setTarget(tx, ty, tz); + if(!withinReach) player.addChatComponentMessage(new ChatComponentTranslation(this.getUnlocalizedName() + ".reach").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + else if(!withinAngle) player.addChatComponentMessage(new ChatComponentTranslation(this.getUnlocalizedName() + ".angle").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + else mirror.setTarget(tx, ty, tz); } return true; } return false; - } + } @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { diff --git a/src/main/java/com/hbm/main/NEIRegistry.java b/src/main/java/com/hbm/main/NEIRegistry.java index efc36e201..14cd7f7e7 100644 --- a/src/main/java/com/hbm/main/NEIRegistry.java +++ b/src/main/java/com/hbm/main/NEIRegistry.java @@ -50,6 +50,8 @@ public class NEIRegistry { //universal boyes handlers.add(new ZirnoxRecipeHandler()); + handlers.add(new PWRRecipeHandler()); + handlers.add(new WatzRecipeHandler()); if(VersatileConfig.rtgDecay()) handlers.add(new RTGRecipeHandler()); handlers.add(new LiquefactionHandler()); handlers.add(new SolidificationHandler()); diff --git a/src/main/java/com/hbm/module/machine/ModuleMachineBase.java b/src/main/java/com/hbm/module/machine/ModuleMachineBase.java index 0a27c56d6..be42eb9b0 100644 --- a/src/main/java/com/hbm/module/machine/ModuleMachineBase.java +++ b/src/main/java/com/hbm/module/machine/ModuleMachineBase.java @@ -199,6 +199,13 @@ public abstract class ModuleMachineBase { return false; } + /** Returns true if the supplied slot is occupied with an item that does not match the recipe */ + public boolean isSlotClogged(int slot) { + ItemStack stack = slots[slot]; + if(stack == null) return false; + return !isItemValid(slot, stack); // we need to use this because it also handles autoswitch correctly, otherwise autoswitch items may be ejected instantly + } + public void serialize(ByteBuf buf) { buf.writeDouble(progress); ByteBufUtils.writeUTF8String(buf, recipe); diff --git a/src/main/java/com/hbm/render/tileentity/RenderSolarBoiler.java b/src/main/java/com/hbm/render/tileentity/RenderSolarBoiler.java index f15a7d778..1e1bb613b 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderSolarBoiler.java +++ b/src/main/java/com/hbm/render/tileentity/RenderSolarBoiler.java @@ -3,6 +3,7 @@ package com.hbm.render.tileentity; import org.lwjgl.opengl.GL11; import com.hbm.blocks.BlockDummyable; +import com.hbm.config.ClientConfig; import com.hbm.main.ResourceManager; import com.hbm.tileentity.machine.TileEntitySolarBoiler; @@ -51,7 +52,12 @@ public class RenderSolarBoiler extends TileEntitySpecialRenderer { GL11.glAlphaFunc(GL11.GL_GREATER, 0); GL11.glDepthMask(false); + int beamCount = 0; + for(ChunkCoordinates co : boiler.secondary) { + beamCount ++; + + if(beamCount > ClientConfig.RENDER_HELIOSTAT_BEAM_LIMIT.get()) break; int dx = boiler.xCoord - co.posX; int dy = boiler.yCoord - co.posY; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyMachine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyMachine.java index ecc1c787c..4ac660a73 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyMachine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyMachine.java @@ -282,7 +282,7 @@ public class TileEntityMachineAssemblyMachine extends TileEntityMachineBase impl @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { - return i == 16; + return i == 16 || this.assemblerModule.isSlotClogged(i); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java index ca0c259c7..09141b42b 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java @@ -98,6 +98,7 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl if(i >= 15 && i <= 17) return true; if(i >= 22 && i <= 24) return true; if(i >= 29 && i <= 31) return true; + for(int k = 0; k < 4; k++) if(this.chemplantModule[k].isSlotClogged(i)) return true; return false; } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java index 97ebd11bf..c03957d26 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalPlant.java @@ -250,7 +250,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { - return i >= 7 && i <= 9; + return (i >= 7 && i <= 9) || this.chemplantModule.isSlotClogged(i); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePUREX.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePUREX.java index 45a476b35..0aca4f5b6 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePUREX.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachinePUREX.java @@ -208,7 +208,7 @@ public class TileEntityMachinePUREX extends TileEntityMachineBase implements IEn @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { - return i >= 7 && i <= 12; + return (i >= 7 && i <= 12) || this.purexModule.isSlotClogged(i); } @Override diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntitySolarBoiler.java b/src/main/java/com/hbm/tileentity/machine/TileEntitySolarBoiler.java index 296d236db..e162fa205 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntitySolarBoiler.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntitySolarBoiler.java @@ -9,7 +9,7 @@ import com.hbm.tileentity.IBufPacketReceiver; import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.TileEntityLoadedBase; -import api.hbm.fluid.IFluidStandardTransceiver; +import api.hbm.fluidmk2.IFluidStandardTransceiverMK2; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; @@ -17,7 +17,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChunkCoordinates; -public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFluidStandardTransceiver, IBufPacketReceiver, IFluidCopiable { +public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFluidStandardTransceiverMK2, IBufPacketReceiver, IFluidCopiable { private FluidTank water; private FluidTank steam; @@ -50,8 +50,8 @@ public class TileEntitySolarBoiler extends TileEntityLoadedBase implements IFlui water.setFill(water.getFill() - process); steam.setFill(steam.getFill() + process * 100); - this.sendFluid(steam, worldObj, xCoord, yCoord + 3, zCoord, Library.POS_Y); - this.sendFluid(steam, worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y); + this.tryProvide(steam, worldObj, xCoord, yCoord + 3, zCoord, Library.POS_Y); + this.tryProvide(steam, worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y); heat = 0; diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index b3448d753..faa7f8bb0 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -3355,6 +3355,8 @@ item.mike_deut.name=Deuterium Tank item.mike_kit.name=Ivy Mike Kit item.mirror_tool.name=Mirror Adjustment Tool item.mirror_tool.linked=Alignment position set! +item.mirror_tool.reach=Mirror out of range! (max 100m) +item.mirror_tool.angle=Mirror angle too shallow! (min 45°) item.mirror_tool.desc=Right-click boiler to memorize the position.$Click on mirrors to turn them towards the boiler. item.missile_anti_ballistic.name=Anti-Ballistic Missile item.missile_assembly.name=Small Missile Assembly