Regrowth

Regrowth

5M Downloads

Random Crash, Skeleton Tried Replacing Mushroom Block With Air Block?

Kaleidio opened this issue ยท 3 comments

commented

Forge Version : 36.1.32
Minecraft Version: 1.16.5
WorldSeed:

Describe the bug
Skeleton tried to override a mushroom block with an air block? the pathtrace blames your mod

** Stack Trace**
crash-2021-07-12_16.13.20-server.txt

Using Kaleidio's Battle Pack at the time with a dedicated server on beta 3.1.0 pre8 (though it's technically pre9 since it was a future to-be-made patch)

commented

This should be fixed now.

Regrowth now ignores creatures which are "on the ground" but standing on a block of air. This case happens when the creature is hanging by the edge of their hit box on to a higher block. The area under their feet is air.

commented

Looking at minecraft 1.16.5 version 19 at lines 177 and 262 of MoveEntity.

commented

The problem is the last line. It should be a mushroom block for sure there but it's not.
It may be a literal edge case where the mushroom is on the edge of a block. I'll add some code around the line to protect ifrom this "impossible" case.

			boolean red = false;
			boolean brown = false;
			BlockPos mtBP = this.getBlockPos(eventEntity);
			Vector3d vM = new Vector3d (0.5,-0.3,-0.3);
			eventEntity.setMotion(eventEntity.getMotion().add(vM));
			sWorld.setBlockState(mtBP.down(), Blocks.MYCELIUM.getDefaultState());
			if (sWorld.rand.nextDouble() * 100.0 > 75.0) {
				sWorld.setBlockState(mtBP, Blocks.RED_MUSHROOM.getDefaultState());
				red = true;
			} else {
				sWorld.setBlockState(mtBP, Blocks.BROWN_MUSHROOM.getDefaultState());
				brown = true;
			}
			MushroomBlock mb = (MushroomBlock) sWorld.getBlockState(getBlockPos(eventEntity)).getBlock();