add harvest with ease fabric compat

This commit is contained in:
Flemmli97 2023-03-29 23:05:33 +02:00
parent f262668414
commit ce9cff1578
4 changed files with 29 additions and 0 deletions

View File

@ -78,6 +78,8 @@ dependencies {
//CompileOnly cause too many dependency
modCompileOnly goml_reserved
modCompileOnly include("com.jamieswhiteshirt:rtree-3i-lite-fabric:0.3.0")
modCompileOnly harvest_with_ease_fabric
}
processResources {

View File

@ -9,6 +9,7 @@ import io.github.flemmli97.flan.event.EntityInteractEvents;
import io.github.flemmli97.flan.event.ItemInteractEvents;
import io.github.flemmli97.flan.event.PlayerEvents;
import io.github.flemmli97.flan.event.WorldEvents;
import io.github.flemmli97.flan.fabric.integration.HarvestWithEase;
import io.github.flemmli97.flan.fabric.platform.integration.playerability.PlayerAbilityEvents;
import io.github.flemmli97.flan.platform.integration.webmap.BluemapIntegration;
import io.github.flemmli97.flan.platform.integration.webmap.DynmapIntegration;
@ -72,6 +73,8 @@ public class FlanFabric implements ModInitializer {
PlayerAbilityEvents.register();
if (FabricLoader.getInstance().isModLoaded("dynmap"))
DynmapIntegration.reg();
if (FabricLoader.getInstance().isModLoaded("harvestwithease"))
HarvestWithEase.init();
ClaimCriterias.init();
}

View File

@ -0,0 +1,23 @@
package io.github.flemmli97.flan.fabric.integration;
import crystalspider.harvestwithease.api.events.HarvestWithEaseEvents;
import io.github.flemmli97.flan.api.permission.PermissionRegistry;
import io.github.flemmli97.flan.claim.ClaimStorage;
import net.minecraft.server.level.ServerPlayer;
public class HarvestWithEase {
public static void init() {
HarvestWithEaseEvents.HARVEST_CHECK.register((level, blockState, blockPos, player, interactionHand, harvestCheckEvent) -> {
if (player instanceof ServerPlayer serverPlayer) {
ClaimStorage storage = ClaimStorage.get(serverPlayer.getLevel());
if (!storage.getForPermissionCheck(blockPos)
.canInteract(serverPlayer, PermissionRegistry.BREAK, blockPos)) {
harvestCheckEvent.setCanceled(true);
return false;
}
}
return true;
});
}
}

View File

@ -22,6 +22,7 @@ ftb_chunks=1902.3.9-build.168
dicemcmm=curse.maven:dicemcmoney-406972:3827507
dynmap_fabric=curse.maven:dynmap-59433:3840510
diamond_economy=curse.maven:diamondeconomy-534301:3837320
harvest_with_ease_fabric=curse.maven:harvestwithease-602171:4442026
#
octo_economy_api=com.github.ExcessiveAmountsOfZombies:OctoEconomyApi:5137175b1c
eights_economy=curse.maven:eightseconomy-559967:3836124