From 8087582519eb65b898950d14ace30a3ebea26130 Mon Sep 17 00:00:00 2001 From: Boblet Date: Wed, 28 Jan 2026 10:52:00 +0100 Subject: [PATCH] yankee with no brim --- changelog | 2 + .../machine/MachineAssemblyFactory.java | 13 ++- .../machine/MachineChemicalFactory.java | 11 +++ .../com/hbm/render/anim/HbmAnimations.java | 2 + .../java/com/hbm/tileentity/DoorDecl.java | 88 +++---------------- .../TileEntityMachineAssemblyFactory.java | 38 +++++++- .../TileEntityMachineChemicalFactory.java | 36 +++++++- 7 files changed, 107 insertions(+), 83 deletions(-) diff --git a/changelog b/changelog index e00fab8cc..62af5f90a 100644 --- a/changelog +++ b/changelog @@ -20,6 +20,7 @@ * Increased the power draw on the osmiridium welding recipe * Bullet casings now make sounds when falling to the ground * Most ammo types now have QMAW pages, including information on whether or not they are a war crime +* Both assembly and chemical factories now have four special ports that only allow items inserted to go into one recipe group # Fixed * Potentially fixed yet another issue regarding crates @@ -34,3 +35,4 @@ * Fixed arc furnace IO slots stacking items with incompatible NBT * Fixed a bounding box issue with casing particles, causing them to slide sideways on the first tick, making trajectories weird * Fixed some turrets not using the more modern casing spawner system which allows casings to have a smoke trail +* Fixed incorrect tooltip on the upgrade stat screen for assembly factories diff --git a/src/main/java/com/hbm/blocks/machine/MachineAssemblyFactory.java b/src/main/java/com/hbm/blocks/machine/MachineAssemblyFactory.java index 409be9874..b46acb2c6 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineAssemblyFactory.java +++ b/src/main/java/com/hbm/blocks/machine/MachineAssemblyFactory.java @@ -72,8 +72,9 @@ public class MachineAssemblyFactory extends BlockDummyable implements ITooltipPr TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]); if(!(te instanceof TileEntityMachineAssemblyFactory)) return; TileEntityMachineAssemblyFactory assemfac = (TileEntityMachineAssemblyFactory) te; - + DirPos[] cool = assemfac.getCoolPos(); + DirPos[] io = assemfac.getIOPos(); for(DirPos dirPos : cool) if(dirPos.compare(x + dirPos.getDir().offsetX, y, z + dirPos.getDir().offsetZ)) { List text = new ArrayList(); @@ -84,5 +85,15 @@ public class MachineAssemblyFactory extends BlockDummyable implements ITooltipPr ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); break; } + + for(int i = 0; i < io.length; i++) { + DirPos port = io[i]; + if(port.compare(x + port.getDir().offsetX, y, z + port.getDir().offsetZ)) { + List text = new ArrayList(); + text.add(EnumChatFormatting.YELLOW + "-> " + EnumChatFormatting.RESET + "Recipe field [" + (i + 1) + "]"); + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); + break; + } + } } } diff --git a/src/main/java/com/hbm/blocks/machine/MachineChemicalFactory.java b/src/main/java/com/hbm/blocks/machine/MachineChemicalFactory.java index d08619616..114f5ac6b 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineChemicalFactory.java +++ b/src/main/java/com/hbm/blocks/machine/MachineChemicalFactory.java @@ -74,6 +74,7 @@ public class MachineChemicalFactory extends BlockDummyable implements ITooltipPr TileEntityMachineChemicalFactory chemfac = (TileEntityMachineChemicalFactory) te; DirPos[] cool = chemfac.getCoolPos(); + DirPos[] io = chemfac.getIOPos(); for(DirPos dirPos : cool) if(dirPos.compare(x + dirPos.getDir().offsetX, y, z + dirPos.getDir().offsetZ)) { List text = new ArrayList(); @@ -84,5 +85,15 @@ public class MachineChemicalFactory extends BlockDummyable implements ITooltipPr ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); break; } + + for(int i = 0; i < io.length; i++) { + DirPos port = io[i]; + if(port.compare(x + port.getDir().offsetX, y, z + port.getDir().offsetZ)) { + List text = new ArrayList(); + text.add(EnumChatFormatting.YELLOW + "-> " + EnumChatFormatting.RESET + "Recipe field [" + (i + 1) + "]"); + ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text); + break; + } + } } } diff --git a/src/main/java/com/hbm/render/anim/HbmAnimations.java b/src/main/java/com/hbm/render/anim/HbmAnimations.java index c4783ed9e..932bae747 100644 --- a/src/main/java/com/hbm/render/anim/HbmAnimations.java +++ b/src/main/java/com/hbm/render/anim/HbmAnimations.java @@ -1,5 +1,6 @@ package com.hbm.render.anim; +import com.hbm.interfaces.NotableComments; import com.hbm.util.Clock; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; @@ -7,6 +8,7 @@ import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; +@NotableComments public class HbmAnimations { //in flans mod and afaik also MW, there's an issue that there is only one diff --git a/src/main/java/com/hbm/tileentity/DoorDecl.java b/src/main/java/com/hbm/tileentity/DoorDecl.java index 816688ead..2330611db 100644 --- a/src/main/java/com/hbm/tileentity/DoorDecl.java +++ b/src/main/java/com/hbm/tileentity/DoorDecl.java @@ -139,15 +139,6 @@ public abstract class DoorDecl { return super.getBlockBound(x, y, z, open, forCollision); } } - - @Deprecated - @Override - @SideOnly(Side.CLIENT) - public ResourceLocation getTextureForPart(int skinIndex, String partName) { return null; } - @Deprecated - @Override - @SideOnly(Side.CLIENT) - public IModelCustomNamed getModel() { return null; } }; public static final DoorDecl SLIDE_DOOR = new DoorDecl() { @@ -412,45 +403,6 @@ public abstract class DoorDecl { return null; } - @Override - @SideOnly(Side.CLIENT) - public void getTranslation(String partName, float openTicks, boolean child, float[] trans) { - if("bolt".equals(partName)) { - set(trans, 0, 0, 0.4F * Library.smoothstep(getNormTime(openTicks, 0, 30), 0, 1)); - } else { - set(trans, 0, 0, 0); - } - }; - - @Override - @SideOnly(Side.CLIENT) - public void getOrigin(String partName, float[] orig) { - if("door".equals(partName) || "bolt".equals(partName)) { - set(orig, 0.125F, 1.5F, 1.18F); - return; - } else if("spinny_upper".equals(partName)) { - set(orig, 0.041499F, 2.43569F, -0.587849F); - return; - } else if("spinny_lower".equals(partName)) { - set(orig, 0.041499F, 0.571054F, -0.587849F); - return; - } - super.getOrigin(partName, orig); - }; - - @Override - @SideOnly(Side.CLIENT) - public void getRotation(String partName, float openTicks, float[] rot) { - if(partName.startsWith("spinny")) { - set(rot, Library.smoothstep(getNormTime(openTicks, 0, 30), 0, 1) * 360, 0, 0); - return; - } else if("door".equals(partName) || "bolt".equals(partName)) { - set(rot, 0, Library.smoothstep(getNormTime(openTicks, 30, 60), 0, 1) * -134, 0); - return; - } - super.getRotation(partName, openTicks, rot); - }; - @Override public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) { if(!open) { @@ -510,12 +462,6 @@ public abstract class DoorDecl { super.getRotation(partName, openTicks, rot); }; - @Override - @SideOnly(Side.CLIENT) - public boolean doesRender(String partName, boolean child) { - return true; - }; - @Override public int timeToOpen() { return 60; }; @Override public int[][] getDoorOpenRanges() { return new int[][] { { 1, 0, 1, -3, 3, 0 }, { 0, 0, 1, -3, 3, 0 }, { -1, 0, 1, -3, 3, 0 } }; } @Override public float getDoorRangeOpenTime(int ticks, int idx) { return getNormTime(ticks, 20, 20); }; @@ -570,12 +516,6 @@ public abstract class DoorDecl { super.getRotation(partName, openTicks, rot); }; - @Override - @SideOnly(Side.CLIENT) - public boolean doesRender(String partName, boolean child) { - return true; - }; - @Override public int timeToOpen() { return 60; }; @Override public int[][] getDoorOpenRanges() { return new int[][] { { 2, 0, 1, -3, 3, 0 }, { 1, 0, 2, -5, 3, 0 }, { 0, 0, 2, -5, 3, 0 }, { -1, 0, 2, -5, 3, 0 }, { -2, 0, 1, -3, 3, 0 } }; } @Override public float getDoorRangeOpenTime(int ticks, int idx) { return getNormTime(ticks, 20, 20); }; @@ -627,11 +567,10 @@ public abstract class DoorDecl { }; - // Format: x, y, z, tangent amount 1 (how long the door would be if it moved - // up), tangent amount 2 (door places blocks in this direction), axis (0-x, - // 1-y, 2-z) + /** Format: x, y, z, tangent amount 1 (how long the door would be if it moved + up), tangent amount 2 (door places blocks in this direction), axis (0-x, + 1-y, 2-z) */ public abstract int[][] getDoorOpenRanges(); - public abstract int[] getDimensions(); public int getBlockOffset() { return 0; } @@ -664,23 +603,16 @@ public abstract class DoorDecl { @SideOnly(Side.CLIENT) public AnimatedModel getAnimatedModel() { return null; } @SideOnly(Side.CLIENT) public Animation getAnim() { return null; } - @SideOnly(Side.CLIENT) - public void getTranslation(String partName, float openTicks, boolean child, float[] trans) { set(trans, 0, 0, 0); } - @SideOnly(Side.CLIENT) - public void getRotation(String partName, float openTicks, float[] rot) { set(rot, 0, 0, 0); } - @SideOnly(Side.CLIENT) - public void getOrigin(String partName, float[] orig) { set(orig, 0, 0, 0); } - @SideOnly(Side.CLIENT) - public boolean doesRender(String partName, boolean child) { return true; } + @SideOnly(Side.CLIENT) public void getTranslation(String partName, float openTicks, boolean child, float[] trans) { set(trans, 0, 0, 0); } + @SideOnly(Side.CLIENT) public void getRotation(String partName, float openTicks, float[] rot) { set(rot, 0, 0, 0); } + @SideOnly(Side.CLIENT) public void getOrigin(String partName, float[] orig) { set(orig, 0, 0, 0); } + @SideOnly(Side.CLIENT) public boolean doesRender(String partName, boolean child) { return true; } private static final String[] nothing = new String[] {}; - @SideOnly(Side.CLIENT) - public String[] getChildren(String partName) { return nothing; } - @SideOnly(Side.CLIENT) - public double[][] getClippingPlanes() { return new double[][] {}; } - @SideOnly(Side.CLIENT) - public void doOffsetTransform() { } + @SideOnly(Side.CLIENT) public String[] getChildren(String partName) { return nothing; } + @SideOnly(Side.CLIENT) public double[][] getClippingPlanes() { return new double[][] {}; } + @SideOnly(Side.CLIENT) public void doOffsetTransform() { } public AxisAlignedBB getBlockBound(int x, int y, int z, boolean open, boolean forCollision) { return open ? AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0) : AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java index 5184c3291..2dee3764f 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineAssemblyFactory.java @@ -21,6 +21,7 @@ import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.module.machine.ModuleMachineAssembler; import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.IConditionalInvAccess; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IUpgradeInfoProvider; import com.hbm.tileentity.TileEntityMachineBase; @@ -45,7 +46,7 @@ import net.minecraftforge.common.util.ForgeDirection; // TODO: make a base class because 90% of this is just copy pasted from the chemfac @NotableComments -public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider { +public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider, IConditionalInvAccess { public FluidTank[] allTanks; public FluidTank[] inputTanks; @@ -122,6 +123,26 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl }; // ho boy, a big fucking array of hand-written values, surely this isn't gonna bite me in the ass some day } + /// CONDITIONAL ACCESS /// + @Override public boolean isItemValidForSlot(int x, int y, int z, int slot, ItemStack stack) { return this.isItemValidForSlot(slot, stack); } + @Override public boolean canInsertItem(int x, int y, int z, int slot, ItemStack stack, int side) { return this.canInsertItem(slot, stack, side); } + @Override public boolean canExtractItem(int x, int y, int z, int slot, ItemStack stack, int side) { return this.canExtractItem(slot, stack, side); } + + @Override public int[] getAccessibleSlotsFromSide(int x, int y, int z, int side) { + DirPos[] io = getIOPos(); + for(int i = 0; i < io.length; i++) { + if(io[i].compare(x + io[i].getDir().offsetX, y, z + io[i].getDir().offsetZ)) { + return new int[] { + 5 + i * 14, 6 + i * 14, 7 + i * 14, 8 + i * 14, + 9 + i * 14, 10 + i * 14, 11 + i * 14, 12 + i * 14, + 13 + i * 14, 14 + i * 14, 15 + i * 14, 16 + i * 14, + 17, 31, 45, 59 // entering flavor town... + }; + } + } + return this.getAccessibleSlotsFromSide(side); + } + @Override public String getName() { return "container.machineAssemblyFactory"; @@ -252,7 +273,6 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl new DirPos(xCoord - dir.offsetX - rot.offsetX * 3, yCoord, zCoord - dir.offsetZ - rot.offsetZ * 3, rot.getOpposite()), }; } - public DirPos[] getCoolPos() { ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); @@ -265,6 +285,18 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl new DirPos(xCoord - rot.offsetX - dir.offsetX * 3, yCoord, zCoord - rot.offsetZ - dir.offsetZ * 3, dir.getOpposite()), }; } + + public DirPos[] getIOPos() { + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + + return new DirPos[] { + 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()), + }; + } @Override public void serialize(ByteBuf buf) { @@ -368,7 +400,7 @@ public class TileEntityMachineAssemblyFactory extends TileEntityMachineBase impl @Override public void provideInfo(UpgradeType type, int level, List info, boolean extendedInfo) { - info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_chemical_factory)); + info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_assembly_factory)); if(type == UpgradeType.SPEED) { info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(KEY_SPEED, "+" + (level * 100 / 3) + "%")); info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(KEY_CONSUMPTION, "+" + (level * 50) + "%")); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java index 9a5accaf1..f54917c97 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineChemicalFactory.java @@ -19,6 +19,7 @@ import com.hbm.lib.Library; import com.hbm.main.MainRegistry; import com.hbm.module.machine.ModuleMachineChemplant; import com.hbm.sound.AudioWrapper; +import com.hbm.tileentity.IConditionalInvAccess; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IUpgradeInfoProvider; import com.hbm.tileentity.TileEntityMachineBase; @@ -41,7 +42,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityMachineChemicalFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider { +public class TileEntityMachineChemicalFactory extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IUpgradeInfoProvider, IControlReceiver, IGUIProvider, IProxyDelegateProvider, IConditionalInvAccess { public FluidTank[] allTanks; public FluidTank[] inputTanks; @@ -121,6 +122,27 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl }; } + /// CONDITIONAL ACCESS /// + @Override public boolean isItemValidForSlot(int x, int y, int z, int slot, ItemStack stack) { return this.isItemValidForSlot(slot, stack); } + @Override public boolean canInsertItem(int x, int y, int z, int slot, ItemStack stack, int side) { return this.canInsertItem(slot, stack, side); } + @Override public boolean canExtractItem(int x, int y, int z, int slot, ItemStack stack, int side) { return this.canExtractItem(slot, stack, side); } + + @Override public int[] getAccessibleSlotsFromSide(int x, int y, int z, int side) { + DirPos[] io = getIOPos(); + for(int i = 0; i < io.length; i++) { + if(io[i].compare(x + io[i].getDir().offsetX, y, z + io[i].getDir().offsetZ)) { + return new int[] { + 5 + i * 7, 6 + i * 7, 7 + i * 7, + 8, 9, 10, + 15, 16, 17, + 22, 23, 24, + 29, 30, 31 + }; + } + } + return this.getAccessibleSlotsFromSide(side); + } + @Override public String getName() { return "container.machineChemicalFactory"; @@ -288,6 +310,18 @@ public class TileEntityMachineChemicalFactory extends TileEntityMachineBase impl new DirPos(xCoord - rot.offsetX - dir.offsetX * 3, yCoord, zCoord - rot.offsetZ - dir.offsetZ * 3, dir.getOpposite()), }; } + + public DirPos[] getIOPos() { + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + + return new DirPos[] { + 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()), + }; + } @Override public void serialize(ByteBuf buf) {