yeet players off riding entities when teleporting fix #114

This commit is contained in:
Flemmli97 2022-01-04 18:52:08 +01:00
parent 09fd55b64d
commit 9dcc69392e
5 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,7 @@
Flan 1.6.7
======================
- Yeet players off riding entities when teleporting
Flan 1.6.6 Flan 1.6.6
====================== ======================
- Fix blockentity interaction not working - Fix blockentity interaction not working

View File

@ -4,6 +4,7 @@ import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
@ -46,4 +47,8 @@ public class CrossPlatformStuff {
public static boolean blockDataContains(CompoundTag nbt, String tag) { public static boolean blockDataContains(CompoundTag nbt, String tag) {
throw new AssertionError(); throw new AssertionError();
} }
public static boolean isRealPlayer(Player player) {
throw new AssertionError();
}
} }

View File

@ -329,6 +329,8 @@ public class EntityInteractEvents {
if (!currentClaim.canInteract(player, PermissionRegistry.CANSTAY, bPos, true)) { if (!currentClaim.canInteract(player, PermissionRegistry.CANSTAY, bPos, true)) {
Claim sub = currentClaim.getSubClaim(bPos); Claim sub = currentClaim.getSubClaim(bPos);
Vec3 tp = TeleportUtils.getTeleportPos(player, pos, storage, sub != null ? sub.getDimensions() : currentClaim.getDimensions(), true, bPos, (claim, nPos) -> claim.canInteract(player, PermissionRegistry.CANSTAY, nPos, false)); Vec3 tp = TeleportUtils.getTeleportPos(player, pos, storage, sub != null ? sub.getDimensions() : currentClaim.getDimensions(), true, bPos, (claim, nPos) -> claim.canInteract(player, PermissionRegistry.CANSTAY, nPos, false));
if(player.isPassenger())
player.stopRiding();
player.teleportToWithTicket(tp.x(), tp.y(), tp.z()); player.teleportToWithTicket(tp.x(), tp.y(), tp.z());
} }
if (player.getAbilities().flying && !player.isCreative() && !currentClaim.canInteract(player, PermissionRegistry.FLIGHT, rounded, true)) { if (player.getAbilities().flying && !player.isCreative() && !currentClaim.canInteract(player, PermissionRegistry.FLIGHT, rounded, true)) {

View File

@ -306,12 +306,16 @@ public class PlayerClaimData implements IPlayerData {
tpTo.set(tpTo.getX(), tpTo.getY() + 1, tpTo.getZ()); tpTo.set(tpTo.getX(), tpTo.getY() + 1, tpTo.getZ());
} else } else
tpTo.set(tpTo.getX(), yHighest, tpTo.getZ()); tpTo.set(tpTo.getX(), yHighest, tpTo.getZ());
if(this.player.isPassenger())
this.player.stopRiding();
this.player.teleportToWithTicket(tpTo.getX() + 0.5, tpTo.getY(), tpTo.getZ() + 0.5); this.player.teleportToWithTicket(tpTo.getX() + 0.5, tpTo.getY(), tpTo.getZ() + 0.5);
this.tpPos = null; this.tpPos = null;
} else { } else {
Vec3 tp = TeleportUtils.getTeleportPos(this.player, this.player.position(), ClaimStorage.get(this.player.getLevel()), Vec3 tp = TeleportUtils.getTeleportPos(this.player, this.player.position(), ClaimStorage.get(this.player.getLevel()),
((IPlayerClaimImpl) this.player).getCurrentClaim().getDimensions(), ((IPlayerClaimImpl) this.player).getCurrentClaim().getDimensions(),
TeleportUtils.roundedBlockPos(this.player.position()).mutable(), (claim, nPos) -> false); TeleportUtils.roundedBlockPos(this.player.position()).mutable(), (claim, nPos) -> false);
if(this.player.isPassenger())
this.player.stopRiding();
this.player.teleportToWithTicket(tp.x(), tp.y(), tp.z()); this.player.teleportToWithTicket(tp.x(), tp.y(), tp.z());
} }
} else if (this.player.position().distanceToSqr(this.trappedPos) > 0.15) { } else if (this.player.position().distanceToSqr(this.trappedPos) > 0.15) {

View File

@ -10,7 +10,7 @@ forge_version=38.0.8
loader_version=0.12.8 loader_version=0.12.8
# Mod Properties # Mod Properties
mod_version=1.6.6 mod_version=1.6.7
maven_group=io.github.flemmli97 maven_group=io.github.flemmli97
archives_base_name=flan archives_base_name=flan