Jump to content

Recommended Posts

Posted

Hello! 

I created my world and now I'm trying to get into it. Is it possible to somehow get into this world without creating a custom Teleporter?

I tried this:

public class EventTeleport {
	@SubscribeEvent
	public void travel(PlayerInteractEvent.Clone e) {
		e.getEntityPlayer().changeDimension(14);
	}
}

My world’s download starts and it hangs. Crash log attached:

  Reveal hidden contents

 

Posted

While I was waiting for an answer, I already did it. Now I have a problem in another. I there is some conflict of dimensions. Getting into my world, it's like I'm in the same place I came from. Besides, miracles happen in it. I do not know how to explain it and what is the error, but I can show:

 

Posted
  Reveal hidden contents

My worldprovider

 

Posted
public class EventTeleport {
	@SubscribeEvent
	public void travel(PlayerInteractEvent.Clone e) {
		sendToDimensionWithoutPortal(e.getEntityPlayer(), 14, e.getEntityPlayer().getPosition().getX(), e.getEntityPlayer().getPosition().getY(), e.getEntityPlayer().getPosition().getZ());
	}

	public static void sendToDimensionWithoutPortal(Entity entity, int dimTo, double x, double y, double z) {
		if (dimTo == entity.dimension) entity.setPosition(x, y, z);
		if (entity instanceof EntityPlayerMP) {
			EntityPlayerMP player = (EntityPlayerMP) entity;
			WorldServer worldTo = player.mcServer.getWorld(dimTo);
			player.mcServer.getPlayerList().transferPlayerToDimension(player, dimTo, new RealTeleporter(worldTo, x, y, z));
		}
	}
}

 

and teleporter
 

public class RealTeleporter extends Teleporter {
	WorldServer world;
	double x, y, z;
	public RealTeleporter(WorldServer worldIn, double x, double y, double z) {
		super(worldIn);
		world = worldIn;
		this.x = x;
		this.y = y;
		this.z = z;
	}
	@Override
	public boolean placeInExistingPortal(Entity entity,  float rotationYaw) {
		entity.posX = this.x;
		entity.posY = this.y;
		entity.posZ = this.z;
		if (entity instanceof EntityPlayer) {
			EntityPlayer player = (EntityPlayer) entity;
			if (player.capabilities.allowFlying) player.capabilities.isFlying = true;
		}
		return true;
	}
}

 

Posted (edited)

Sorry for misleading you. This is the old code, in fact there is now a RightClickBlock
I think I've succeeded. Only that's why this world has exactly the same seed as overworld

 

public class EventTeleport {
	@SubscribeEvent
	public void travel(PlayerInteractEvent.RightClickBlock e) {
		if(e.getEntityPlayer().getEntityWorld().getBlockState(e.getPos()) == Blocks.BEDROCK.getDefaultState()) {
			travelToDimensionWithoutPortal(e.getEntityPlayer(), 14, e.getEntityPlayer().getPosition().getX(), e.getEntityPlayer().getPosition().getY(), e.getEntityPlayer().getPosition().getZ());
		}
		
	}

	public static void travelToDimensionWithoutPortal(Entity entity, int dimTo, double x, double y, double z) {
		if (dimTo == entity.dimension) entity.setPosition(x, y, z);
		if (entity instanceof EntityPlayerMP) {
			EntityPlayerMP player = (EntityPlayerMP) entity;
			WorldServer worldTo = player.mcServer.getWorld(dimTo);
			player.changeDimension(dimTo, new RealTeleporter(worldTo, x, y, z));
		}
	}
}

 

teleporter

public class RealTeleporter implements ITeleporter {
	WorldServer world;
	double x, y, z;
	public RealTeleporter(WorldServer ws, double x, double y, double z) {
		super();
		world = ws;
		this.x = x;
		this.y = y;
		this.z = z;
	}

	@Override
	public void placeEntity(World world, Entity entity, float yaw) {
		entity.posX = this.x;
		entity.posY = this.y;
		entity.posZ = this.z;
		if (entity instanceof EntityPlayer) {
			EntityPlayer player = (EntityPlayer) entity;
			if (player.capabilities.allowFlying) player.capabilities.isFlying = true;
		}
		
	}
}

And in this world there are vanilla biomes. Although I pointed out that need to my.
 

public class RealismWorld extends WorldProvider {

	public RealismWorld() {
		this.biomeProvider = new BiomeProviderSingle(RegBiomes.MAGMATIC_BIOME);
	}
	
	@Override
	public DimensionType getDimensionType() {
		return RegWorlds.REALISM_WORLD;
	}

	@Override
	public IChunkGenerator createChunkGenerator() {
		return new RealismChunkGenerator(world, 1487574, true, "realism_settings");
	}
	
	@Override
	public boolean canRespawnHere() {
		return true;
	}

	
	@Override
	public boolean isSurfaceWorld() {
		return false;
	}
}

 

Edited by Xumuk
Posted (edited)

 

 

Up!
I can not solve this problem. Despite the fact that I'm trying to include my biome. It seems to be a mixture of two worlds: the ordinary and custom

I can't imagine which class is to blame. But I'm pretty sure my WorldProvider should use my biome.
 

  Reveal hidden contents
  Reveal hidden contents

Maybe I'm not registering the biome correctly? please look at this.

And this class I call in CommonProxy#preInit

Edited by Xumuk

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.