mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-10-23 18:07:39 +00:00
Add a test for exploding turtles
There's been a couple of bug reports in the past where the game would crash if a turtle is destroyed while breaking a block (typically due to the block exploding). This commit adds a test, to ensure that this is handled gracefully. I'm not entirely sure this is testing the right thing. Looking at the issues in question, it doesn't look like I ever managed to reproduce the bug. However, it's hopefully at least a quick sanity test to check we never break this case.
This commit is contained in:
@@ -14,6 +14,7 @@ import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
|
||||
import net.minecraft.gametest.framework.GameTestRegistry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
@@ -26,6 +27,7 @@ public class TestMod implements ModInitializer, ClientModInitializer {
|
||||
ServerLifecycleEvents.SERVER_STARTED.addPhaseOrdering(Event.DEFAULT_PHASE, phase);
|
||||
ServerLifecycleEvents.SERVER_STARTED.register(phase, TestHooks::onServerStarted);
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> CCTestCommand.register(dispatcher));
|
||||
PlayerBlockBreakEvents.BEFORE.register((level, player, pos, state, blockEntity) -> !TestHooks.onBeforeDestroyBlock(level, pos, state));
|
||||
|
||||
TestHooks.loadTests(GameTestRegistry::register);
|
||||
}
|
||||
|
Reference in New Issue
Block a user