fix wrong position check for some items, fix enderpearl no clip

This commit is contained in:
Flemmli97 2021-06-12 00:17:25 +02:00
parent fbed8b8785
commit 7371860654
5 changed files with 32 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Flan 1.4.2
======================
- Fix some items checking for wrong position and thus are able to interact in claims
- Fix enderpearl phasing through blocks
Flan 1.4.2
======================
- Fix a ticking player crash

View File

@ -148,6 +148,8 @@ public class EntityInteractEvents {
pers.setShotFromCrossbow(false);
((IPersistentProjectileVars) pers).resetPiercingStatus();
}
if(proj instanceof EnderPearlEntity)
proj.remove();
//TODO: find a way to properly update chorus fruit break on hit
//player.getServer().send(new ServerTask(player.getServer().getTicks()+2, ()->player.world.updateListeners(pos, state, state, 2)));
}

View File

@ -11,6 +11,7 @@ import io.github.flemmli97.flan.claim.ObjectToPermissionMap;
import io.github.flemmli97.flan.claim.PermHelper;
import io.github.flemmli97.flan.config.ConfigHandler;
import io.github.flemmli97.flan.integration.permissionapi.CommandPermission;
import io.github.flemmli97.flan.mixin.IItemAccessor;
import io.github.flemmli97.flan.player.EnumDisplayType;
import io.github.flemmli97.flan.player.EnumEditMode;
import io.github.flemmli97.flan.player.PlayerClaimData;
@ -65,6 +66,10 @@ public class ItemInteractEvents {
ClaimStorage storage = ClaimStorage.get((ServerWorld) world);
BlockPos pos = player.getBlockPos();
HitResult hitResult = IItemAccessor.getRaycast(world, player, RaycastContext.FluidHandling.SOURCE_ONLY);
if (hitResult.getType() == HitResult.Type.BLOCK) {
pos = new ItemPlacementContext(player, hand, stack, (BlockHitResult) hitResult).getBlockPos();
}
IPermissionContainer claim = storage.getForPermissionCheck(pos);
if (claim == null)
return TypedActionResult.pass(stack);

View File

@ -0,0 +1,18 @@
package io.github.flemmli97.flan.mixin;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.world.RaycastContext;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(Item.class)
public interface IItemAccessor {
@Invoker("raycast")
static BlockHitResult getRaycast(World world, PlayerEntity player, RaycastContext.FluidHandling fluidHandling) {
throw new IllegalStateException();
}
}

View File

@ -18,7 +18,8 @@
"PlayerMixin",
"ItemEntityMixin",
"EndermanPickupMixin",
"EndermanPlaceMixin"
"EndermanPlaceMixin",
"IItemAccessor"
],
"server": [
],