Added Vein Mining

This commit is contained in:
2025-03-26 10:56:16 +01:00
parent 645529a9f6
commit 73b8be0930
13 changed files with 526 additions and 1 deletions

View File

@ -3,12 +3,18 @@ package wtf.hak.survivalfabric;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.minecraft.entity.Entity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import wtf.hak.survivalfabric.commands.ReloadConfigCommand;
import wtf.hak.survivalfabric.commands.SlimeChunkCommand;
import wtf.hak.survivalfabric.commands.SpectatorCommand;
import wtf.hak.survivalfabric.sharedenderchest.SharedEnderChest;
import wtf.hak.survivalfabric.veinminer.VeinMinerEvents;
import static wtf.hak.survivalfabric.config.ConfigManager.getConfig;
@ -26,5 +32,18 @@ public class SurvivalFabric implements ModInitializer {
if(getConfig().sharedEnderChestEnabled)
new SharedEnderChest().onInitialize();
if(getConfig().veinMinerEnabled) {
PlayerBlockBreakEvents.BEFORE.register((world, player, pos, state, blockEntity) -> {
if (player instanceof ServerPlayerEntity serverPlayer) {
return VeinMinerEvents.beforeBlockBreak(world, serverPlayer, pos, state);
}
else {
return true;
}
});
ServerEntityEvents.ENTITY_LOAD.register(VeinMinerEvents::onEntityLoad);
}
}
}