From 3fa52859d7f70beb6d57d2fe598ca890576e1abf Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Sun, 10 Mar 2024 13:42:52 +0800 Subject: [PATCH] Fix mixin conflict with Spelunkery (#1253) --- .../entity/vehicle/AbstractMinecartMixin.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/vehicle/AbstractMinecartMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/vehicle/AbstractMinecartMixin.java index 8c7c35ee6..72c2a8341 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/vehicle/AbstractMinecartMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/vehicle/AbstractMinecartMixin.java @@ -2,7 +2,6 @@ import io.izzel.arclight.common.bridge.core.entity.EntityBridge; import io.izzel.arclight.common.bridge.core.entity.vehicle.AbstractMinecartBridge; -import io.izzel.arclight.common.bridge.core.world.WorldBridge; import io.izzel.arclight.common.bridge.core.world.level.block.BlockBridge; import net.minecraft.core.BlockPos; import net.minecraft.tags.BlockTags; @@ -74,17 +73,15 @@ public abstract class AbstractMinecartMixin extends VehicleEntityMixin implement maxSpeed = 0.4D; } + private transient Location arclight$prevLocation; + /** * @author IzzelAliz * @reason */ @Overwrite public void tick() { - double prevX = this.getX(); - double prevY = this.getY(); - double prevZ = this.getZ(); - float prevYaw = this.getYRot(); - float prevPitch = this.getXRot(); + this.arclight$prevLocation = new Location(null, this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); if (this.getHurtTime() > 0) { this.setHurtTime(this.getHurtTime() - 1); } @@ -142,8 +139,10 @@ public void tick() { this.flipped = !this.flipped; } this.setRot(this.getYRot(), this.getXRot()); - org.bukkit.World bworld = ((WorldBridge) this.level()).bridge$getWorld(); - Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch); + org.bukkit.World bworld = this.level().bridge$getWorld(); + Location from = this.arclight$prevLocation; + this.arclight$prevLocation = null; + from.setWorld(bworld); Location to = new Location(bworld, this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); Vehicle vehicle = (Vehicle) this.getBukkitEntity(); Bukkit.getPluginManager().callEvent(new VehicleUpdateEvent(vehicle));