question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Protection Issue] Chisel is not checking if a block is protected before chiseling

See original GitHub issue

After triaging and investigating a SpongeForge interoperability issue when protection plugins wish to keep blocks from being modified/broken, I’ve since resolved parts of the issue reported to us https://github.com/SpongePowered/SpongeForge/issues/2167, however a new issue is arising and I think I know why:

When an already chiseled block is being interacted by another player (regardless whether Sponge is installed at this point or not), there’s a succeed fast check whether a block can be chiseled: https://github.com/AlgorithmX2/Chisels-and-Bits/blob/1.12/src/main/java/mod/chiselsandbits/items/ItemChisel.java#L397-L410

The issue with the line:

state.getBlock() instanceof BlockChiseled

is short circuiting any protection or harvestability checks for the desired block position, so even though the block is already chiseled, the drops (bits) can be cancelled, but the block modification can still go through.

I’d go as far as eliminating the succeed fast check since protection would then be able to determine that the chisel can be used at that time (and Forge’s harvest block event can be thrown).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

1reaction
gabizoucommented, Jun 4, 2018

That works! Many thanks for adding the various checks!

1reaction
gabizoucommented, May 25, 2018

Ok, so I think the original issue is resolved with the chisel, but now it’s a matter of the bits being placed on an existing chiseled block. I haven’t explored the source or threaded through yet to see if any events are thrown, but that might be what’s going on.

To clarify: The original issue was that you could chisel blocks regardless whether they were owned because no events or harvest checks were being called.

The new issue is that you can modify chiseled blocks, as it appears there’s no event check present. I’m going to dig further and see if I can narrow down where we can add some block modification check of sorts.

From a cursory glance, I’m under the belief that this block of code is where bits are being either placed to create a new block, or being placed into an existing chiseled block? I’m suspecting some sort of block check (maybe server.isBlockProtected()) before performing additional changes?

Read more comments on GitHub >

github_iconTop Results From Across the Web

blocks disappearing (not visible) · Issue #118 · ChiselsAndBits ...
I just woke up so i haven't gotten to testing yet but by the sounds of it everything is fine (besides the server...
Read more >
How To Download & Install Chisels & Bits in Minecraft 1.16.5
This video shows you how to download and install Chisels and Bits in Minecraft 1.16.5. Chisels and Bits is one of the best...
Read more >
How To Download & Install Chisels & Bits in Minecraft 1.18.1
This video shows you how to download and install Chisels & Bits in Minecraft 1.18.1. Chisels & Bits is a Minecraft block customization...
Read more >
A Guide to Chisel Types and How to Use Them | RS
A square can be used to check the flatness of the blade. It may be necessary to sharpen the chisel to ensure that...
Read more >
Hand Tools - Wood Chisels : OSH Answers
Place chisels safely within the plastic protective caps to cover cutting edges when not in use. Replace any chisel that is bent or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found