Digger Zombies bypasss FTB Chunk claims
Saereth opened this issue ยท 5 comments
Describe the bug
A clear and concise description of what the bug is.
Digger zombies are able to mine into your base even with the area claimed which should protect blocks.
Versions where you encountered the problem (Use the exact version numbers, not 'latest' or similar):
- Minecraft: 1.19.2
- Forge: 43.2.21
- Enhanced AI: EnhancedAI-1.8.3-mc1.19.2.jar
- InsaneLib: InsaneLib-1.7.5-mc1.19.2.jar
Steps to reproduce
- Load up an instance with ftbchunks, enhancedai
- claim an area
- wait and watch as zombies bypass your claims
Can the issue be reproduced with EnhancedAI only (or with a minimal set of mods)?
Yes
Addiitonal
This implementation bypasses the forge break events where protections etc would normally be checked
https://github.com/Insane96/EnhancedAI/blob/67afd9bd9dc2711bc858ceec89a9d65712b507fa/src/main/java/insane96mcp/enhancedai/modules/mobs/miner/BlockBreakerGoal.java#L134C1-L147
Because people claim chunks to prevent griefing and having the builds destroyed, it prevents explosions or other players maliciously griefing you by for instance sending an army of computer craft turtles into your base or capturing half a dozen digger zombies and dropping them into your base.
Yeah it is for player but also fake player which is what most mods do in this situation to check for protections, implement a temporary fakeplayer, check if the block event is canceled and then proceed or cancel the action.
something like
// create fakePlayer from entity
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, fakePlayer);
MinecraftForge.EVENT_BUS.post(event);
if (event.isCanceled()) {
return skip("Break was canceled!");
}