Fix EndGateway teleporting
This commit is contained in:
parent
285f9f7f73
commit
9b4cfe81f0
|
@ -6,6 +6,7 @@ import io.izzel.arclight.common.bridge.world.WorldBridge;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.tileentity.EndGatewayTileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v.entity.CraftPlayer;
|
||||
|
@ -15,16 +16,17 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(EndGatewayTileEntity.class)
|
||||
public abstract class EndGatewayTileEntityMixin extends TileEntityMixin {
|
||||
|
||||
// @formatter:off
|
||||
@Shadow public abstract boolean isCoolingDown();
|
||||
@Shadow public abstract void triggerCooldown();
|
||||
// @formatter:on
|
||||
|
||||
@Inject(method = "teleportEntity", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;teleportKeepLoaded(DDD)V"))
|
||||
public void arclight$portal(Entity entityIn, CallbackInfo ci) {
|
||||
@Inject(method = "teleportEntity", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;teleportKeepLoaded(DDD)V"))
|
||||
public void arclight$portal(Entity entityIn, CallbackInfo ci, BlockPos pos) {
|
||||
if (entityIn instanceof ServerPlayerEntity) {
|
||||
CraftPlayer player = ((ServerPlayerEntityBridge) entityIn).bridge$getBukkitEntity();
|
||||
Location location = new Location(((WorldBridge) world).bridge$getWorld(), pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D);
|
||||
|
@ -39,7 +41,7 @@ public abstract class EndGatewayTileEntityMixin extends TileEntityMixin {
|
|||
}
|
||||
|
||||
((ServerPlayNetHandlerBridge) (((ServerPlayerEntity) entityIn)).connection).bridge$teleport(event.getTo());
|
||||
this.isCoolingDown(); // CraftBukkit - call at end of method
|
||||
this.triggerCooldown(); // CraftBukkit - call at end of method
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user