Switch dimension for entity procedure block not working

Submitted by mario2582 on Mon, 04/08/2019 - 02:24
Upvotes: 6
Issue description

Using the following procedure in the image attached causes the game to crash as soon as you enter the custom dimension i designed. Using the regular portal works fine with it, as soon as a procedure is used to change dimension ID (with or without entering the custom dimension via portal first) the game crashes upon the procedure being triggered and the dimension loading, if you reload the world after it crashes you spawn in the custom dimension via a nether portal.

i want this fixed as soon as possible because i am trying to create a mod where if you fall below the -40 y limit you get teleported to a very weird custom dimension called the Under

Procedure block

 

Issue comments

Submitted by Klemen on Mon, 04/08/2019 - 18:24

This is a known bug but with the current implementation, we don't have a good fix for this yet.

Submitted by Nuparu00 on Mon, 04/22/2019 - 20:42

Create a new class called TeleporterEmpty (for example). You have to extend net.minecraft.world.Teleporter and override several methods, like this:

package net.nuparu.finalscience.util;

import net.minecraft.world.WorldServer;
import net.minecraft.world.Teleporter;
import net.minecraft.entity.Entity;

public class TeleporterEmpty extends Teleporter {

	public TeleporterEmpty(WorldServer worldIn) {
		super(worldIn);
	}

	public void placeInPortal(Entity entityIn, float rotationYaw) {
	}

	public boolean placeInExistingPortal(Entity entityIn, float rotationYaw) {
		return true;
	}

	public boolean makePortal(Entity entityIn) {
		return true;
	}
}

 

Then create in whatever class you want a static function, that will handle the teleportation:

public static void switchDimension(MinecraftServer server, EntityPlayerMP entity, int dim) {
		PlayerList list = server.getPlayerList();
		list.transferPlayerToDimension(entity, dim, new TeleporterEmpty(server.getWorld(0)));
	}

 

And then just call the function when you want to switch dimension. (Of course use name of your the class where you have created the method instead of "TimeUtils")

TimeUtils.switchDimension(server, (EntityPlayerMP) player, 0);

 

Submitted by Klemen on Tue, 04/23/2019 - 09:59

Thank you Nuparu00 for your code example :) I will change the teleport procedure as you suggested so it will work properly.

Submitted by YoshiMochi on Mon, 06/03/2019 - 14:11

Can someone fix this bug in a more... well... simple way?

Submitted by Klemen on Mon, 06/03/2019 - 17:32

This bug will be fixed in the future updates.

It's because of the way Minecraft uses travelling between dimensions. Mcreator uses only 'Nether-like' dimensions in terms of portals, so they will search for nearby portals to go through. It's not programmed to do anything else. The End can be gone to via this procedure block, because it uses a different system. Instead of searching for a portal, it just puts you in a specific location. However, this does not scale with the Overworld, so it wouldn't teleport you back very well.

Submitted by Klemen on Sat, 06/22/2019 - 14:28

This bug will be fixed in MCreator 1.9.0.

Thank you for fixing this :D

Now different portal shapes, enderdragon return portals-like, spaceships, time machines and much more will be possible to be made! :D