McJtyMods / RFToolsBuilder

The RFTools Builder, Shield, Projector, Scanner, ...
MIT License
8 stars 14 forks source link

[Cross-mod interactions] Tree decapitations and other cases of mods seeing the builder breaking blocks when it doesn't break them #57

Open TheRealWormbo opened 3 years ago

TheRealWormbo commented 3 years ago

This is a bit of an obscure bug, and I'm not sure how much of it is the RFTools Builder's own fault. Essentially several mods seem to think the builder breaks a block and either generate drops or cause additional effects, even though the builder is told to not harvest those blocks due to a filter.

Examples:

The random items dropped from grass or leaves that themselves don't get removed isn't that bad, but the Treechop interaction causes massive destruction to any trees within the quarry area, even though their blocks are not supposed to be broken.

Setup:

  1. Find an area with trees. Works best with a forest biome.
  2. Place a Builder and give it power and an output container.
  3. Define a Filter and add it to the Builder. I used diamond ore and emerald ore in a vanilla chest.
  4. Define a shape. I used a Clearing Silktouch Quarry card with the dimensions 50/256/50 for a solid box.
  5. Run the builder.

Versions:

TheRealWormbo commented 3 years ago

Oh right, a screenshot of the effect would probably be useful to better understand the kind of devastation this interaction can cause: 2021-05-24_08 38 15

hammertater commented 3 years ago

Hey folks, I work on TreeChop. It intercepts BreakEvents and, if it's a tree, does some fun chopping mechanics. Wombo suggested that I ignore breaks by FakePlayers, and I think that's a great idea, so I'll do that (or make it configurable).

However, I'd hope that BreakEvents would only be fired for blocks that are intended to be broken. For example, if Wombo wanted to break trees, then it wouldn't be terrible if they got "treechopped" like in the picture - it wouldn't leave floating blocks, which I think is nice. Referring to https://github.com/McJtyMods/RFToolsBuilder/blob/b4c9aebf6c407a2d840db7662a805bc63022840f/src/main/java/mcjty/rftoolsbuilder/modules/builder/blocks/BuilderTileEntity.java#L1236-L1237, how about checking the filter before checking allowedToBreak (which fires the BreakEvent)?