Jump to content

Recommended Posts

Posted

Good afternoon, 

 

I hope someone will be able to help me address this issue, its been driving me nuts. 

I've been working on a little cross world teleport command. Not knowing how it was done, I started off by looking around in the existing minecraft/forge code to see what was available. 

As a result I came across this method:
FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().transferPlayerToDimension(EntityPlayer, DimID, Teleporter)

After creating my own extended version of Teleporter(copied into a spoiler below), I tried it out and it works... most of the time. When it works, it works great, no issues. However randomly it just kills the client/server with the following error: 

Spoiler

---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.

Time: 11/12/17 1:34 PM
Description: Exception ticking world

java.util.ConcurrentModificationException
   at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:966)
   at java.util.LinkedList$ListItr.next(LinkedList.java:888)
   at net.minecraft.server.management.PlayerChunkMap.tick(PlayerChunkMap.java:210)
   at net.minecraft.world.WorldServer.tick(WorldServer.java:236)
   at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:829)
   at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
   at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
   at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
   at java.lang.Thread.run(Thread.java:748)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
   at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:966)
   at java.util.LinkedList$ListItr.next(LinkedList.java:888)
   at net.minecraft.server.management.PlayerChunkMap.tick(PlayerChunkMap.java:210)
   at net.minecraft.world.WorldServer.tick(WorldServer.java:236)

-- Affected level --
Details:
   Level name: New World
   All players: 0 total; []
   Chunk stats: ServerChunkCache: 907 Drop: 625
   Level seed: 4041886264837728842
   Level generator: ID 00 - default, ver 1. Features enabled: true
   Level generator options: 
   Level spawn location: World: (96,64,248), Chunk: (at 0,4,8 in 6,15; contains blocks 96,0,240 to 111,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
   Level time: 7076 game time, 7076 day time
   Level dimension: -1
   Level storage version: 0x04ABD - Anvil
   Level weather: Rain time: 150310 (now: false), thunder time: 120985 (now: false)
   Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: true
Stacktrace:
   at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:829)
   at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
   at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
   at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
   at java.lang.Thread.run(Thread.java:748)

 

Here is my reduced teleporter: 

Spoiler

public class CrossDimTeleporter extends Teleporter {
    private double x, y, z;

    public CrossDimTeleporter(WorldServer worldIn, double x, double y, double z) {
        super(worldIn);
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @Override
    public void placeInPortal(Entity entityIn, float rotationYaw) {

        //((EntityPlayerMP)entityIn).connection.setPlayerLocation(x, y, z, rotationYaw, 0);
        //entityIn.setLocationAndAngles(this.x, this.y,this.z, 90F, 0.0F);
        entityIn.setPositionAndUpdate(x, y, z);
        entityIn.motionX = 0.0D;
        entityIn.motionY = 0.0D;
        entityIn.motionZ = 0.0D;

    }
}

As you can see I've tried different methods of the actual movement of the player. 

 

As I understand it, the error is due to a sudden change in a list that is being iterated over, however I don't have a clue on how to work around or resolve that. 

Any help would be appreciated. 

 

My target version of forge right now is: 1.12.2-14.23.0.2491

Posted

More or less a command.

The reason I have it on a different thread is due to what I'm trying to do. My goal is to be able to run this teleport command from outside of minecraft.

I have a Netty listener receiving and parsing input. This is being run on another thread to not block the normal game flow. That part works as far as I know.

It listens for a specific trigger and executes the 

FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().transferPlayerToDimension(EntityPlayer, DimID, Teleporter) command passing in the desired coordinates to the Teleporter class I listed in my first post. 

  • 6 months later...

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.