Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. package com.biom4st3r.dynocaps;
  2.  
  3. import com.biom4st3r.dynocaps.components.IDynocapComponent;
  4. import com.jamieswhiteshirt.rtree3i.Entry;
  5. import com.jamieswhiteshirt.rtree3i.Selection;
  6.  
  7. import draylar.goml.api.ClaimInfo;
  8. import draylar.goml.api.ClaimUtils;
  9. import it.unimi.dsi.fastutil.booleans.BooleanArrayList;
  10. import net.fabricmc.loader.api.FabricLoader;
  11. import net.minecraft.entity.player.PlayerEntity;
  12. import net.minecraft.util.math.BlockPos;
  13. import net.minecraft.util.math.Box;
  14. import net.minecraft.world.World;
  15.  
  16. public final class ModCompat {
  17.  
  18.     public static boolean hasGOML = FabricLoader.getInstance().isModLoaded("goml");;
  19.  
  20.     public static boolean hasGolmProtection(Box box,IDynocapComponent newComponent,PlayerEntity user,World world)
  21.     {
  22.         BlockPos bottom = new BlockPos(box.x1, box.y1, box.z1);
  23.         BlockPos top = new BlockPos(box.x1+newComponent.getHeight(),box.y1+newComponent.getHeight(),box.z1+newComponent.getWidth());
  24.         Selection<Entry<com.jamieswhiteshirt.rtree3i.Box, ClaimInfo>> claims = ClaimUtils.getClaimsInBox(world, bottom, top);
  25.         BooleanArrayList list = new BooleanArrayList();
  26.         claims.forEach((entry)->
  27.         {
  28.             list.add(ClaimUtils.playerHasPermission(entry, user));
  29.         });
  30.         return list.contains(false);
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement