Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

"Player moved wrongly"" causes teleportation to dimension to not work properly


ForgingMan
 Share

Recommended Posts

Trying to create a portal (using this tutorial) to another dimension that teleports back and forth like a nether portal. The portal works fine in creative mode, but in survival, it triggers a "Player moved wrongly!" message and sends the player to the coordinates of the Overworld portal in the other dimension, usually resulting in the player being spawned in the sky or underground (causing the player to suffocate).

 

Took a look at this post, which is a similar issue, but the solutions provided don't seem to be working.

 

Code:

 

Portal Tile Entity:

public class TileEntityDim extends TileEntity
{
	
	private static final String S_PLAYER_X = "PlayerPrevX";
	private static final String S_PLAYER_Y = "PlayerPrevY";
	private static final String S_PLAYER_Z = "PlayerPrevZ";
	private static final String S_PLAYER_X2 = "PlayerPrevX2";
	private static final String S_PLAYER_Y2 = "PlayerPrevY2";
	private static final String S_PLAYER_Z2 = "PlayerPrevZ2";
	private static final String dme = "DimEnter";
	private static int offsetX;
	private static int offsetZ;	
	public static double prevX;
	public static double prevY;
	public static double prevZ;
	public static double prevX2;
	public static double prevY2;
	public static double prevZ2;
	public static int dme2;
	
	public TileEntityDim()
	{
		super();
	}
	

	@Override
	public void readFromNBT(NBTTagCompound nbt)
	{
		super.readFromNBT(nbt);
		this.prevX = nbt.getDouble(S_PLAYER_X);
		this.prevY = nbt.getDouble(S_PLAYER_Y);
		this.prevZ = nbt.getDouble(S_PLAYER_Z);
		this.prevX2 = nbt.getDouble(S_PLAYER_X2);
		this.prevY2 = nbt.getDouble(S_PLAYER_Y2);
		this.prevZ2 = nbt.getDouble(S_PLAYER_Z2);
		this.dme2 = nbt.getInteger(dme);
	}

	@Override
	public NBTTagCompound writeToNBT(NBTTagCompound nbt)
	{
		super.writeToNBT(nbt);
		nbt.setDouble(S_PLAYER_X, prevX);
		nbt.setDouble(S_PLAYER_Y, prevY);
		nbt.setDouble(S_PLAYER_Z, prevZ);
		nbt.setDouble(S_PLAYER_X2, prevX2);
		nbt.setDouble(S_PLAYER_Y2, prevY2);
		nbt.setDouble(S_PLAYER_Z2, prevZ2);
		nbt.setInteger(dme, 2);
		return nbt;
	}

	public static void setOverworldXYZ(double posX, double posY, double posZ)
	{
		prevX = posX;
		prevY = posY;
		prevZ = posZ;
	}
	
	public static void setTestXYZ(double posX2, double posY2, double posZ2)
	{
		prevX2 = posX2;
		prevY2 = posY2;
		prevZ2 = posZ2;
	}

	public static void setDme22()
	{
		
		dme2 = 2;
		
	}
	
	public static void setDme21()
	{
		
		dme2 = 0;
		
	}
	
	public boolean onPlayerActivate(EntityPlayer player)
	{
		
		return true;
	}
	
	public static void tele(EntityPlayer player)
	{
		
		
		if ((player.getRidingEntity() == null) && ((player instanceof EntityPlayerMP)))
		{
			
			EntityPlayerMP player1 = (EntityPlayerMP)player;
			MinecraftServer mcServer = player1.getServer();
			
			if(player1.timeUntilPortal > 0)
			{
				
				player1.timeUntilPortal = 10;
				
			}else if(player1.dimension != Main.dimId){
				
				player1.timeUntilPortal = 10;
				
				if(prevX2 == 0.0 && prevY2 == 0.0 && prevZ2 == 0.0)
				{
					player1.timeUntilPortal = 10;
					setDme21();
					setOverworldXYZ(player1.posX, player1.posY, player1.posZ);
					mcServer.getPlayerList().transferPlayerToDimension(player1, Main.dimId, new TestTeleporter(mcServer.worldServerForDimension(Main.dimId), dme2, 0, 0 ,0));
					setTestXYZ(player1.posX, player1.posY, player1.posZ);
					
					
				}else if(prevX2 != 0.0 && prevY2 != 0.0 && prevZ2 != 0.0){
					player1.timeUntilPortal = 10;
					setDme22();
					setOverworldXYZ(player1.posX, player1.posY, player1.posZ);
mcServer.getPlayerList().transferPlayerToDimension(player1, Main.dimId, new TestTeleporter(mcServer.worldServerForDimension(Main.dimId), dme2, prevX2, prevY2, prevZ2));
					
				}
				
			}else if(player1.dimension == Main.dimId){
				
				player1.timeUntilPortal = 10;
				setDme22();
				setTestXYZ(player1.posX, player1.posY, player1.posZ);
				mcServer.getPlayerList().transferPlayerToDimension(player1, 0, new TestTeleporter(mcServer.worldServerForDimension(0), dme2, prevX, prevY, prevZ));
				
			}
		
		}
	}
}

 

Portal Block coded for colliding with portal:

 

public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
    {	
 
		if ((entityIn.getRidingEntity() == null) && ((entityIn instanceof EntityPlayerMP)))
		{
			
			EntityPlayerMP player1 = (EntityPlayerMP)entityIn;
		
			TileEntityDim.tele(player1);
		
		}
		
    }

 

 

Link to comment
Share on other sites

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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • crashes and shows this "The game crashed whilst rendering overlay Error: com.electronwill.nightconfig.core.io.WritingException: An I/O error occured Exit Code: 255" heres the crash report https://pastebin.com/NHGPeLjM
    • Hello, I am trying to run the Forge [1.15.5] edition, I keep getting the following: The game crashed whilst initializing game Error: java.lang.IllegalStateException: GLFW error before init:[0x10008]Cocoa: Failed to find service port for display Exit Code: 255   I'm not very good with these types of things, so any help would be greatly appreciated!
    • Well, tbh I do not understand what does it mean. Yeah, there is vanilla class MinecartItem and it is used to connect vanilla items to vanilla carts) All of these I've said in P.S. It's impossible to use MinecartItem in my situation, because it requires AbstractMinecart.Type as the first parameter. If I type e.g. AbstractMinecart.Type.FURNACE then item which was registered via MinecartItem will be connected to vanilla furnace_minecrat, not my custom cart. If I'm not right and you know the way to reach my goals using MinecartItem, could you please share this way?)
    • I have a crash as well.  No mods on the client or server.   Pre-existing world, just upgraded the server to spigot-1.18. ---- Minecraft Crash Report ---- // Don't be sad, have a hug! <3 Time: 11/30/21, 7:43 PM Description: Unexpected error java.lang.NoSuchFieldError: factory     at net.minecraft.world.level.chunk.PalettedContainer$Configuration.equals(PalettedContainer.java:280) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.world.level.chunk.PalettedContainer.m_188051_(PalettedContainer.java:76) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.world.level.chunk.PalettedContainer.m_63118_(PalettedContainer.java:149) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.world.level.chunk.LevelChunkSection.m_63004_(LevelChunkSection.java:157) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.world.level.chunk.LevelChunk.m_187971_(LevelChunk.java:431) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.client.multiplayer.ClientChunkCache.m_194116_(ClientChunkCache.java:96) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.multiplayer.ClientPacketListener.m_194198_(ClientPacketListener.java:607) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.multiplayer.ClientPacketListener.m_183388_(ClientPacketListener.java:602) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket.m_5797_(ClientboundLevelChunkWithLightPacket.java:45) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket.m_5797_(ClientboundLevelChunkWithLightPacket.java:12) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.network.protocol.PacketUtils.m_131356_(PacketUtils.java:21) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:151) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:125) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.util.thread.BlockableEventLoop.m_18699_(BlockableEventLoop.java:110) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1009) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:660) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:205) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:45) ~[fmlloader-1.18-38.0.1.jar%2322!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at net.minecraft.world.level.chunk.PalettedContainer$Configuration.equals(PalettedContainer.java:280) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.world.level.chunk.PalettedContainer.m_188051_(PalettedContainer.java:76) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.world.level.chunk.PalettedContainer.m_63118_(PalettedContainer.java:149) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.world.level.chunk.LevelChunkSection.m_63004_(LevelChunkSection.java:157) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.world.level.chunk.LevelChunk.m_187971_(LevelChunk.java:431) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.client.multiplayer.ClientChunkCache.m_194116_(ClientChunkCache.java:96) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.multiplayer.ClientPacketListener.m_194198_(ClientPacketListener.java:607) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.multiplayer.ClientPacketListener.m_183388_(ClientPacketListener.java:602) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket.m_5797_(ClientboundLevelChunkWithLightPacket.java:45) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket.m_5797_(ClientboundLevelChunkWithLightPacket.java:12) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.network.protocol.PacketUtils.m_131356_(PacketUtils.java:21) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:151) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B}     at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading}     at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:125) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B} -- Affected level -- Details:     All players: 1 total; [LocalPlayer['lennox15'/3231, l='ClientLevel', x=-52.32, y=70.00, z=-60.36]]     Chunk stats: 729, 0     Level dimension: minecraft:overworld     Level spawn location: World: (8,64,8), Section: (at 8,0,8 in 0,4,0; chunk contains blocks 0,-64,0 to 15,319,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511)     Level time: 0 game time, 0 day time     Server brand: Spigot     Server type: Non-integrated multiplayer server Stacktrace:     at net.minecraft.client.multiplayer.ClientLevel.m_6026_(ClientLevel.java:407) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.m_91354_(Minecraft.java:2249) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:682) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:205) ~[client-1.18-20211130.085255-srg.jar%2352!:?] {re:classloading,pl:runtimedistcleaner:A}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:45) ~[fmlloader-1.18-38.0.1.jar%2322!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {} -- Last reload -- Details:     Reload number: 1     Reload reason: initial     Finished: Yes     Packs: Mod Resources, Default -- System Details -- Details:     Minecraft Version: 1.18     Minecraft Version ID: 1.18     Operating System: Windows 10 (amd64) version 10.0     Java Version: 17.0.1, Microsoft     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft     Memory: 467812952 bytes (446 MiB) / 1375731712 bytes (1312 MiB) up to 2147483648 bytes (2048 MiB)     CPUs: 8     Processor Vendor: GenuineIntel     Processor Name: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz     Identifier: Intel64 Family 6 Model 142 Stepping 10     Microarchitecture: Coffee Lake     Frequency (GHz): 2.11     Number of physical packages: 1     Number of physical CPUs: 4     Number of logical CPUs: 8     Graphics card #0 name: DisplayLink USB Device     Graphics card #0 vendor: DisplayLink (0x17e9)     Graphics card #0 VRAM (MB): 0.00     Graphics card #0 deviceId: 0x4302     Graphics card #0 versionInfo: DriverVersion=9.3.3324.0     Graphics card #1 name: DisplayLink USB Device     Graphics card #1 vendor: DisplayLink (0x17e9)     Graphics card #1 VRAM (MB): 0.00     Graphics card #1 deviceId: 0x4302     Graphics card #1 versionInfo: DriverVersion=9.3.3324.0     Graphics card #2 name: Intel(R) UHD Graphics 620     Graphics card #2 vendor: Intel Corporation (0x8086)     Graphics card #2 VRAM (MB): 1024.00     Graphics card #2 deviceId: 0x5917     Graphics card #2 versionInfo: DriverVersion=27.20.100.9664     Memory slot #0 capacity (MB): 16384.00     Memory slot #0 clockSpeed (GHz): 2.40     Memory slot #0 type: DDR4     Memory slot #1 capacity (MB): 8192.00     Memory slot #1 clockSpeed (GHz): 2.13     Memory slot #1 type: DDR4     Virtual memory max (MB): 28018.48     Virtual memory used (MB): 21184.61     Swap memory total (MB): 3584.00     Swap memory used (MB): 191.53     JVM Flags: 9 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     Launched Version: 1.18-forge-38.0.1     Backend library: LWJGL version 3.2.2 SNAPSHOT     Backend API: Intel(R) UHD Graphics 620 GL version 3.2.0 - Build 27.20.100.9664, Intel     Window size: 854x480     GL Caps: Using framebuffer using OpenGL 3.2     GL debug messages:      Using VBOs: Yes     Is Modded: Definitely; Client brand changed to 'forge'     Type: Client (map_client.txt)     Graphics mode: fancy     Resource Packs: vanilla     Current Language: English (US)     CPU: 8x Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz     ModLauncher: 9.0.7+91+master.8569cdf     ModLauncher launch target: forgeclient     ModLauncher naming: srg     ModLauncher services:           mixin PLUGINSERVICE           eventbus PLUGINSERVICE           object_holder_definalize PLUGINSERVICE           runtime_enum_extender PLUGINSERVICE           capability_token_subclass PLUGINSERVICE           accesstransformer PLUGINSERVICE           runtimedistcleaner PLUGINSERVICE           mixin TRANSFORMATIONSERVICE           fml TRANSFORMATIONSERVICE      FML Language Providers:          minecraft@1.0         javafml@null     Mod List:          client-1.18-20211130.085255-srg.jar               |Minecraft                     |minecraft                     |1.18                |DONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f         forge-1.18-38.0.1-universal.jar                   |Forge                         |forge                         |38.0.1              |DONE      |Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90     Crash Report UUID: 524d3bf5-8871-419a-9252-30ac9fddbaf4     FML: 38.0     Forge: net.minecraftforge:38.0.1
    • I donwloaded forge 38.0.1 double-clicked it Installed server, chose a new path Once done, I ran "run.bat"   Debug.log here
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.