pet interaction in claims. fix #5

This commit is contained in:
Flemmli97 2020-09-18 22:29:11 +02:00
parent dba1c75833
commit 2f9da2f0ce
3 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,7 @@
Flan 1.0.7
======================
- Enable tamed pet interaction in claims for the owner
Flan 1.0.6
======================
- Update Fabric API to use the new PlayerBlockBreakEvent

View File

@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx2G
loader_version=0.9.1+build.205
# Mod Properties
mod_version = 1.0.6
mod_version = 1.0.7
maven_group = com.flemmli97.flan
archives_base_name = flan

View File

@ -13,7 +13,9 @@ import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.decoration.ItemFrameEntity;
import net.minecraft.entity.mob.Monster;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.passive.WolfEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PersistentProjectileEntity;
import net.minecraft.entity.projectile.ProjectileEntity;
@ -74,6 +76,11 @@ public class EntityInteractEvents {
return claim.canInteract(player, EnumPermission.TRADING, pos, true) ? ActionResult.PASS : ActionResult.FAIL;
if (entity instanceof ItemFrameEntity)
return claim.canInteract(player, EnumPermission.ITEMFRAMEROTATE, pos, true) ? ActionResult.PASS : ActionResult.FAIL;
if(entity instanceof TameableEntity){
TameableEntity tame = (TameableEntity) entity;
if(tame.isOwner(player))
return ActionResult.PASS;
}
return claim.canInteract(player, EnumPermission.ANIMALINTERACT, pos, true) ? ActionResult.PASS : ActionResult.FAIL;
}
return ActionResult.PASS;