Minefactory Reloaded

Minefactory Reloaded

23M Downloads

Block Placer Dupe Bug

Sir-Will opened this issue ยท 5 comments

commented

If the block in front of the block placer get broken by a block breaker for example the one from openblocks it will place the block again but it also keeps the item.
This seems to only work with the combination of OpenBlocks breaker and MFR placer. Useing a other breaker or placer doesn't reproduce this issue.

Setup:
http://i.imgur.com/rzAZ0HS.png

commented

This is an issue with OpenBlocks.

commented

Ok, opened an issue there: OpenMods/OpenBlocks#649

commented

This is an issue with OpenBlocks.

Questionable. MFR is also doing risky operation.

Let me explain how both blocks interact. You probably figured out out same thing before you commented, but it will be easier to discuss if it's written somewhere.

From what I see, you have following code:

  • set block
  • get block
  • if current block is placed one do rest of placing logic (including item decrement)

What actually happens

  • set block
  • cause block update
  • breaker activates (since it's powered)
  • breaker removes block
  • get block (returns air)
  • check fails
  • do nothing

Now, OB block breaker works on updates, without delay. I'm not really sure how most people use it, but I'm almost sure I will get complaints about broken builds if I switch it to "rising edge" instead of "update + high signal" detection.

On the other hand, I'm not really sure that get-set behaviour makes code more secure. Vanilla code has similar check (ItemBlock.placeBlockAt), but skips item stack decrement only if World.setBlock fails (only item callback are skipped). Why your code is more restrictive? There was some bug when item were lost, but no block was placed?

commented

Issues with how other structures would handle replacing destroyed elements and some protection zones. The problem is that the block is broken on the update: if you triggered an update via the standard scheduled block updates or your tile ticks and you set a flag, it would ensure you're not running your logic while someone else's logic is running (see: MFR's block breaker).

commented

And about hour after noticing initial issue I did exactly that.

I was just wondering what made you write that restriction. Most world protection hooks are placed much earlier, so I'm not sure if anything is gained. But that's not in scope of this issue.