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:

Spoiler

[00:06:12] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.player.PlayerEvent$Clone@3abddf4c:
java.lang.NullPointerException: null
    at net.minecraft.world.Teleporter.placeInExistingPortal(Teleporter.java:136) ~[Teleporter.class:?]
    at net.minecraft.world.Teleporter.placeInPortal(Teleporter.java:39) ~[Teleporter.class:?]
    at net.minecraft.world.Teleporter.placeEntity(Teleporter.java:443) ~[Teleporter.class:?]
    at net.minecraft.server.management.PlayerList.transferEntityToWorld(PlayerList.java:761) ~[PlayerList.class:?]
    at net.minecraft.server.management.PlayerList.transferPlayerToDimension(PlayerList.java:661) ~[PlayerList.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.changeDimension(EntityPlayerMP.java:745) ~[EntityPlayerMP.class:?]
    at net.minecraft.entity.Entity.changeDimension(Entity.java:2908) ~[Entity.class:?]
    at com.legendgamer.realism.event.EventTeleport.travel(EventTeleport.java:13) ~[EventTeleport.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_10_EventTeleport_travel_Clone.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) [EventBus.class:?]
    at net.minecraftforge.event.ForgeEventFactory.onPlayerClone(ForgeEventFactory.java:536) [ForgeEventFactory.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.copyFrom(EntityPlayerMP.java:1278) [EntityPlayerMP.class:?]
    at net.minecraft.server.management.PlayerList.recreatePlayerEntity(PlayerList.java:578) [PlayerList.class:?]
    at net.minecraft.network.NetHandlerPlayServer.processClientStatus(NetHandlerPlayServer.java:1171) [NetHandlerPlayServer.class:?]
    at net.minecraft.network.play.client.CPacketClientStatus.processPacket(CPacketClientStatus.java:42) [CPacketClientStatus.class:?]
    at net.minecraft.network.play.client.CPacketClientStatus.processPacket(CPacketClientStatus.java:8) [CPacketClientStatus.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) [PacketThreadUtil$1.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_191]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_191]
    at net.minecraft.util.Util.runTask(Util.java:53) [Util.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:796) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_191]
[00:06:12] [Server thread/ERROR] [FML]: Index: 1 Listeners:
[00:06:12] [Server thread/ERROR] [FML]: 0: NORMAL
[00:06:12] [Server thread/ERROR] [FML]: 1: ASM: com.legendgamer.realism.event.EventTeleport@9bd43b7 travel(Lnet/minecraftforge/event/entity/player/PlayerEvent$Clone;)V
[00:06:12] [Server thread/FATAL] [net.minecraft.server.MinecraftServer]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_191]
    at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_191]
    at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:796) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_191]
Caused by: java.lang.NullPointerException
    at net.minecraft.world.Teleporter.placeInExistingPortal(Teleporter.java:136) ~[Teleporter.class:?]
    at net.minecraft.world.Teleporter.placeInPortal(Teleporter.java:39) ~[Teleporter.class:?]
    at net.minecraft.world.Teleporter.placeEntity(Teleporter.java:443) ~[Teleporter.class:?]
    at net.minecraft.server.management.PlayerList.transferEntityToWorld(PlayerList.java:761) ~[PlayerList.class:?]
    at net.minecraft.server.management.PlayerList.transferPlayerToDimension(PlayerList.java:661) ~[PlayerList.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.changeDimension(EntityPlayerMP.java:745) ~[EntityPlayerMP.class:?]
    at net.minecraft.entity.Entity.changeDimension(Entity.java:2908) ~[Entity.class:?]
    at com.legendgamer.realism.event.EventTeleport.travel(EventTeleport.java:13) ~[EventTeleport.class:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_10_EventTeleport_travel_Clone.invoke(.dynamic) ~[?:?]
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) ~[EventBus.class:?]
    at net.minecraftforge.event.ForgeEventFactory.onPlayerClone(ForgeEventFactory.java:536) ~[ForgeEventFactory.class:?]
    at net.minecraft.entity.player.EntityPlayerMP.copyFrom(EntityPlayerMP.java:1278) ~[EntityPlayerMP.class:?]
    at net.minecraft.server.management.PlayerList.recreatePlayerEntity(PlayerList.java:578) ~[PlayerList.class:?]
    at net.minecraft.network.NetHandlerPlayServer.processClientStatus(NetHandlerPlayServer.java:1171) ~[NetHandlerPlayServer.class:?]
    at net.minecraft.network.play.client.CPacketClientStatus.processPacket(CPacketClientStatus.java:42) ~[CPacketClientStatus.class:?]
    at net.minecraft.network.play.client.CPacketClientStatus.processPacket(CPacketClientStatus.java:8) ~[CPacketClientStatus.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_191]
    at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_191]
    at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
    ... 5 more
[00:06:12] [Server thread/WARN] [net.minecraft.server.MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 3155ms behind, skipping 63 tick(s)

 

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
Spoiler

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;
	}
}

 

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.
 

Spoiler

public class RealismWorld extends WorldProvider {

	public RealismWorld() {
		super();
		this.biomeProvider = new BiomeProviderSingle(RegBiomes.MAGMATIC_BIOME);
		
	}
	...

Maybe I'm not registering the biome correctly?
Look at this.:

Spoiler

public class RegBiomes {

	public static final Biome MAGMATIC_BIOME = new MagmaticBiome();
//	public static final Biome SEDIMENTARY_BIOME = new SedimentaryBiome();
//	public static final Biome METAMORPHIC_BIOME = new MetamorhicBiome();
	
	
	public static void registerBiomes() {
		register(MAGMATIC_BIOME, "magmatic_biome", BiomeType.WARM, Type.HILLS);
	
	}
	
	public static Biome register(Biome b, String name, BiomeType bt, Type... types) {
		b.setRegistryName(name);
		ForgeRegistries.BIOMES.register(b);
	
		BiomeDictionary.addTypes(b, types);
		BiomeManager.addBiome(bt, new BiomeEntry(b, 10));
		BiomeManager.addSpawnBiome(b);
		return b;
	}
}

 

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.