Jump to content

The default spawn point in the custom world


Xumuk

Recommended Posts

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)

 

Link to comment
Share on other sites

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:

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

 

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They were already updated, and just to double check I even did a cleanup and fresh update from that same page. I'm quite sure drivers are not the problem here. 
    • i tried downloading the drivers but it says no AMD graphics hardware has been detected    
    • Update your AMD/ATI drivers - get the drivers from their website - do not update via system  
    • As the title says i keep on crashing on forge 1.20.1 even without any mods downloaded, i have the latest drivers (nvidia) and vanilla minecraft works perfectly fine for me logs: https://pastebin.com/5UR01yG9
    • Hello everyone, I'm making this post to seek help for my modded block, It's a special block called FrozenBlock supposed to take the place of an old block, then after a set amount of ticks, it's supposed to revert its Block State, Entity, data... to the old block like this :  The problem I have is that the system breaks when handling multi blocks (I tried some fix but none of them worked) :  The bug I have identified is that the function "setOldBlockFields" in the item's "setFrozenBlock" function gets called once for the 1st block of multiblock getting frozen (as it should), but gets called a second time BEFORE creating the first FrozenBlock with the data of the 1st block, hence giving the same data to the two FrozenBlock :   Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=head] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@73681674 BlockEntityData : id:"minecraft:bed",x:3,y:-60,z:-6} Old Block Fields set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=3, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} Frozen Block Entity set BlockState : Block{minecraft:black_bed}[facing=east,occupied=false,part=foot] BlockPos{x=2, y=-60, z=-6} BlockEntity : net.minecraft.world.level.block.entity.BedBlockEntity@6d1aa3da BlockEntityData : {id:"minecraft:bed",x:2,y:-60,z:-6} here is the code inside my custom "freeze" item :    @Override     public @NotNull InteractionResult useOn(@NotNull UseOnContext pContext) {         if (!pContext.getLevel().isClientSide() && pContext.getHand() == InteractionHand.MAIN_HAND) {             BlockPos blockPos = pContext.getClickedPos();             BlockPos secondBlockPos = getMultiblockPos(blockPos, pContext.getLevel().getBlockState(blockPos));             if (secondBlockPos != null) {                 createFrozenBlock(pContext, secondBlockPos);             }             createFrozenBlock(pContext, blockPos);             return InteractionResult.SUCCESS;         }         return super.useOn(pContext);     }     public static void createFrozenBlock(UseOnContext pContext, BlockPos blockPos) {         BlockState oldState = pContext.getLevel().getBlockState(blockPos);         BlockEntity oldBlockEntity = oldState.hasBlockEntity() ? pContext.getLevel().getBlockEntity(blockPos) : null;         CompoundTag oldBlockEntityData = oldState.hasBlockEntity() ? oldBlockEntity.serializeNBT() : null;         if (oldBlockEntity != null) {             pContext.getLevel().removeBlockEntity(blockPos);         }         BlockState FrozenBlock = setFrozenBlock(oldState, oldBlockEntity, oldBlockEntityData);         pContext.getLevel().setBlockAndUpdate(blockPos, FrozenBlock);     }     public static BlockState setFrozenBlock(BlockState blockState, @Nullable BlockEntity blockEntity, @Nullable CompoundTag blockEntityData) {         BlockState FrozenBlock = BlockRegister.FROZEN_BLOCK.get().defaultBlockState();         ((FrozenBlock) FrozenBlock.getBlock()).setOldBlockFields(blockState, blockEntity, blockEntityData);         return FrozenBlock;     }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.