Applied Energistics 2

Applied Energistics 2

156M Downloads

[1.19.2] Multi Item Fluid Containers dupe fluids

Speiger opened this issue ยท 7 comments

commented

Describe the bug

When you click with a stackable fluid container on to a skystone tank to dump fluids into it it will consume 1x the container but 2x insert the fluid.

How to reproduce the bug

  • 1: Implement a simple stackable fluid container that is like a bucket.
  • 2: Try to drain the stackable container into skystone tank.
  • 3: Magic!

Expected behavior

That stackable containers don't dupe fluids

Additional details

This only happens if the stacksize of the container is greater then 1

My best guess is that this is a forge bug.
But since I have a no forge bugreport policy and it only happens with your mod, you get it instead.

Also code line in question.
https://github.com/AppliedEnergistics/Applied-Energistics-2/blob/forge/master/src/main/java/appeng/blockentity/storage/SkyStoneTankBlockEntity.java#L58

A additonal bug, offhand support?

Which minecraft version are you using?

1.19

On which mod loaders does it happen?

Forge

Crash log

No Crash.

commented

Hi, thanks for the code suggestion. However I would rather PR the fix to Forge, which I just did (PR 9004).

Edit: I have known this bug since 1.14... And nobody found it so far?
(And a few other bugs that are still addressed in ic2c itself as i found them)

It seems that many people find these bugs, but instead of reporting them, they just implement a workaround on their end. Then people like me come along and try to use these methods. ๐Ÿ˜ข

Closing as this should be addressed by Forge and not by AE2.

commented

@Technici4n I am physically unable to report bugs to forge xD

  • 1: Forge doesn't want my bugreports
  • 2: I don't want to deal with their bullshit that reminds me of a certain year in germany.

I see it as a mutual understanding that forge and i don't talk xD

Ok so lets hope they accept this patch xD

commented

Looks like a Forge bug indeed, but I will investigate. Which container did you use here?

commented

Confirmed Forge bug.

image

fluidDestination is NOT a copy, so it's NOT ok to pass doDrain = true.

commented

@Technici4n i have solved the problem by wrapping/copying the target container on the first attempt...

This is IC2Classics solution to deal with forges bug...

	public static boolean drainContainers(ItemStack source, Player player, IFluidHandler handler)
	{
		if(source.isEmpty())
		{
			return false;
		}
		IItemTransporter transporter = TransporterManager.getTransporter(player.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).orElse(null));
		if(transporter == null)
		{
			return false;
		}
		FluidActionResult emptyingResult = FluidUtil.tryEmptyContainer(source, new FillHandlerWrapper(handler), handler.getTankCapacity(0), null, true);
		if(!emptyingResult.isSuccess())
		{
			return false;
		}
		if(transporter.addItem(emptyingResult.getResult(), Direction.DOWN, true) <= 0)
		{
			return false;
		}
		emptyingResult = FluidUtil.tryEmptyContainer(source, handler, handler.getTankCapacity(0), null, true);
		source.shrink(1);
		transporter.addItem(emptyingResult.getResult(), Direction.DOWN, false);
		return true;
	}

The FillHandlerWrapper turns all "Actions" to Simulate forcefully.

commented

@Su5eD If you want to report this bug to forge, go ahead, but i am not reporting bugs to forge anymore ever since i realized how shitty they are.
I rather implement fixes on my end then deal with their "We are gods" bullshit.

Edit: I have known this bug since 1.14... And nobody found it so far?
(And a few other bugs that are still addressed in ic2c itself as i found them)

commented

The latest 1.19 Forge contains the fix. :)