Jump to content

[1.15]How to teleport an Entity hit by an Arrow? I get an error: java.lang.IllegalStateException: Removing entity while ticking!


Recommended Posts

Posted (edited)

I want to teleport the Entity hit by my arrow to be teleported to the nether.

    protected void arrowHit(LivingEntity living) {
        super.arrowHit(living);
        if (!living.world.isRemote()){
            CustomTeleporter t = new CustomTeleporter(living.getServer().getWorld(living.world.dimension.getType() == DimensionType.THE_NETHER ? DimensionType.OVERWORLD : DimensionType.THE_NETHER));
            t.TeleportToNether(living);
        }

    }

This is the line that is causing an error. 

playerEntity.teleport(entity.getServer().getWorld(destination), entity.getPosition().getX() * movementFactor, entity.getPosition().getY(), entity.getPosition().getZ() * movementFactor, entity.rotationYaw, entity.rotationPitch);

The StackTrace:

	at net.minecraft.world.server.ServerWorld.removeEntity(ServerWorld.java:1001) ~[?:?] {re:classloading}
	at net.minecraft.world.server.ServerWorld.removePlayer(ServerWorld.java:1022) ~[?:?] {re:classloading}
	at net.minecraft.entity.player.ServerPlayerEntity.teleport(ServerPlayerEntity.java:1243) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at com.fhannenheim.portablenether.FriederTeleporter.TeleportToNether(FriederTeleporter.java:42) ~[?:?] {re:classloading}
	at com.fhannenheim.portablenether.entities.NetherArrowEntity.arrowHit(NetherArrowEntity.java:37) ~[?:?] {re:classloading}

 

Edited by Frieder Hannenheim

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.