Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Multiblock Item/Fluid IO blocks don't have comparator output #1702

Open
TheRo-bot opened this issue Aug 1, 2021 · 2 comments
Open
Labels
status: unverified type: bug Something isn't working

Comments

@TheRo-bot
Copy link

Describe the bug
All forms multiblock items (Item input/Output bus, Fluid input/output hatch) don't output a comparator signal akin to other container-like blocks

Versions
Forge:
GTCE: 1.8.419
Modpack:: Omnifactory (1.2.2)
Addons:: N/A

Setup
In any world, on any server, in any scenario

Steps To Reproduce

  1. Placing a comparator next to an input bus with some quantity of items inside

Expected behavior
A redstone signal akin to the percentage filled the container is, you know what a comparator does

Screenshots
N/A

Additional context
In my attempts to fix this problem, I noticed (through this deobfuscated, decompiled minecraft source repo) that the comparator retrieves a block to process the methods hasComparatorInputOverride() and getComparatorInputOverride(World, BlockPos) through a world call to getBlockState(BlockPos): IBlockState. As far as i'm aware, MetaTileEntityItemBus - and any hatch that extends MetaTileEntityMultiblockPart - isn't and doesn't inherit IBlockState in any capacity, so World.getBlockState(BlockPos) doesn't return the MetaTileEntityItemBus instance to get the input bus / whatever MetaTileEntityMultiblockPart extension under gregtech.common.metatileentities.electric.multiblockpart to call the right methods

I would attempt to fix this problem myself, but I'm not experienced with modding Minecraft, so I'll leave it as a bug here, apologies if this disregards an intended format

@TheRo-bot TheRo-bot added status: unverified type: bug Something isn't working labels Aug 1, 2021
@warjort
Copy link
Contributor

warjort commented Aug 1, 2021

You are looking in the wrong place. :-)
But it is still a bug, or at least an unimplemented feature.

The buses and hatches are tile entities, while the IBlockState is for the block.
For GTCE all the blocks for its tile entities are gregtech.api.block.machines.BlockMachine
where you can see it has an override.

public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) {

This delegates to the tile entity which after some caching eventually gets to this method (default implementation is 0 output):

public int getActualComparatorValue() {

The issue is, the buses and hatches don't override that method.

For the item bus, it should be easy to implement by doing something similar to the chests:

For the fluid hatches, it would need to do something similar to the tanks:

And for the energy hatches something similar to what the abstract tiered metatileentity does with its energy container

Be careful though. This might not be as straightforward as I describe.
Unlike the examples I posted above, multiblocks can have multiple buses/hatches which can get amalgamated into a single combined item/fluid/energy container in places.
So make sure you are looking at the right one if you attempt to implement this.

Or maybe it should show the values from the whole multiblock and not just the single bus/hatch?
There are arguments both ways.
e.g. I want the output to be the total energy of the MB not just one energy hatch (that needs the combined energy container).
e.g.2. I want to see if one of my ingredients has run out (that needs the value from just 1 input bus not all inputs)

@TheRo-bot
Copy link
Author

Thank you so much for giving such a comprehensive response so quickly! I've been reinvigorated to get this working haha

I see what you mean on implementation, and i think you could achieve the total output scenario by simply combining single comparator functionality on multiple blocks if you need (running something like EnderIO with redstone conduits and sensor upgrades would make that not look horrendous and be somewhat compact) but even still, a "Redstone IO Hatch" for reading specific things would be interesting too

thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: unverified type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants