Jump to content

1.12.2 | Custom dimension and portal causing a crash.


Daring Do

Recommended Posts

This is the crash report I've been getting

Spoiler

---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.

Time: 5/2/18 7:44 PM
Description: Ticking player

java.lang.NullPointerException: Ticking player
    at net.minecraft.world.Teleporter.placeInExistingPortal(Teleporter.java:136)
    at net.minecraft.world.Teleporter.placeInPortal(Teleporter.java:36)
    at net.minecraft.server.management.PlayerList.transferEntityToWorld(PlayerList.java:748)
    at net.minecraft.server.management.PlayerList.transferPlayerToDimension(PlayerList.java:655)
    at net.minecraft.server.management.PlayerList.changePlayerDimension(PlayerList.java:642)
    at net.minecraft.entity.player.EntityPlayerMP.changeDimension(EntityPlayerMP.java:745)
    at com.camellias.voidictrans.util.handlers.RegistryHandler.PlayerHurtEvent(RegistryHandler.java:59)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_RegistryHandler_PlayerHurtEvent_LivingHurtEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
    at net.minecraftforge.common.ForgeHooks.onLivingHurt(ForgeHooks.java:574)
    at net.minecraft.entity.player.EntityPlayer.damageEntity(EntityPlayer.java:1217)
    at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:1030)
    at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1127)
    at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:692)
    at net.minecraft.entity.EntityLivingBase.outOfWorld(EntityLivingBase.java:1748)
    at net.minecraft.entity.Entity.onEntityUpdate(Entity.java:582)
    at net.minecraft.entity.EntityLivingBase.onEntityUpdate(EntityLivingBase.java:277)
    at net.minecraft.entity.Entity.onUpdate(Entity.java:465)
    at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2313)
    at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:272)
    at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:423)
    at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:185)
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:212)
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307)
    at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:863)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
    at java.lang.Thread.run(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
    at net.minecraft.world.Teleporter.placeInExistingPortal(Teleporter.java:136)
    at net.minecraft.world.Teleporter.placeInPortal(Teleporter.java:36)
    at net.minecraft.server.management.PlayerList.transferEntityToWorld(PlayerList.java:748)
    at net.minecraft.server.management.PlayerList.transferPlayerToDimension(PlayerList.java:655)
    at net.minecraft.server.management.PlayerList.changePlayerDimension(PlayerList.java:642)
    at net.minecraft.entity.player.EntityPlayerMP.changeDimension(EntityPlayerMP.java:745)
    at com.camellias.voidictrans.util.handlers.RegistryHandler.PlayerHurtEvent(RegistryHandler.java:59)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_RegistryHandler_PlayerHurtEvent_LivingHurtEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179)
    at net.minecraftforge.common.ForgeHooks.onLivingHurt(ForgeHooks.java:574)
    at net.minecraft.entity.player.EntityPlayer.damageEntity(EntityPlayer.java:1217)
    at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:1030)
    at net.minecraft.entity.player.EntityPlayer.attackEntityFrom(EntityPlayer.java:1127)
    at net.minecraft.entity.player.EntityPlayerMP.attackEntityFrom(EntityPlayerMP.java:692)
    at net.minecraft.entity.EntityLivingBase.outOfWorld(EntityLivingBase.java:1748)
    at net.minecraft.entity.Entity.onEntityUpdate(Entity.java:582)
    at net.minecraft.entity.EntityLivingBase.onEntityUpdate(EntityLivingBase.java:277)
    at net.minecraft.entity.Entity.onUpdate(Entity.java:465)
    at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2313)
    at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:272)

-- Player being ticked --
Details:
    Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
    Entity ID: 247
    Entity Name: Player635
    Entity's Exact location: 0.00, -64.55, 0.00
    Entity's Block location: World: (0,-65,0), Chunk: (at 0,-5,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Entity's Momentum: 0.00, -1.36, 0.00
    Entity's Passengers: []
    Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
    at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:423)
    at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:185)
    at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:212)
    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307)

-- Ticking connection --
Details:
    Connection: net.minecraft.network.NetworkManager@10ad151b
Stacktrace:
    at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:863)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590)
    at java.lang.Thread.run(Unknown Source)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_152, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 645481944 bytes (615 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
    FML: MCP 9.42 Powered by Forge 14.23.1.2607 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    | State     | ID          | Version      | Source                           | Signature |
    |:--------- |:----------- |:------------ |:-------------------------------- |:--------- |
    | UCHIJAAAA | minecraft   | 1.12.2       | minecraft.jar                    | None      |
    | UCHIJAAAA | mcp         | 9.42         | minecraft.jar                    | None      |
    | UCHIJAAAA | FML         | 8.0.99.99    | forgeSrc-1.12.2-14.23.1.2607.jar | None      |
    | UCHIJAAAA | forge       | 14.23.1.2607 | forgeSrc-1.12.2-14.23.1.2607.jar | None      |
    | UCHIJAAAA | voidictrans | 0.1          | bin                              | None      |

    Loaded coremods (and transformers): 
    GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
    Profiler Position: N/A (disabled)
    Player Count: 1 / 8; [EntityPlayerMP['Player635'/247, l='New World', x=0.00, y=-64.55, z=0.00]]
    Type: Integrated Server (map_client.txt)
    Is Modded: Definitely; Client brand changed to 'fml,forge'

Then, I was given someone else's post who's been having the same error, and the fix was putting

player.getEntityLiving().setPortal(player.getEntityLiving().getPosition());

inside the teleport.

 

However, this, as I had expected, causes a nether portal to be created, which, at least in creative, causes me to teleport straight to the nether after going to my dimension. The dimension is accessed by going 64 blocks beneath bedrock. Any idea how to fix the crash, without spawning the nether portal in the world?

 

Here's my code. The related classes are ModDimensions, ChunkGeneratorVoid, DimensionVoid, and RegistryHandler.

 

EDIT:

I just tested it in survival, and it seems to enjoy slowly killing me with fall damage, since I misjudged part of my code.

Edited by Daring Do

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

1 hour ago, #ÖCT said:

I think your Entity is null...

I don't think I quite understand what you mean. Where would the entity be called? Only place I can think of would be under the PlayerHurtEvent in the RegistryHandler, which I'm pretty sure I called correctly, but I could definitely be wrong. 

Edited by Daring Do

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

1 minute ago, quadraxis said:

You should probably be using your own teleporter here, rather than vanilla's.

Yeah, probably. I might fight it to make it work later, if there isn't an easier fix. 

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

3 hours ago, quadraxis said:

You should probably be using your own teleporter here, rather than vanilla's.

So, just a question, but how do I force it to use my teleporter now? Do I need to register the teleporter somewhere? Or would I just call it in the RegistryHandler for the teleport?

Edited by Daring Do

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

Changing dimensions is done with PlayerList#transferPlayerToDimension, which you get from WorldServer and it requires a Teleporter as a parameter. Make a class which extends Teleporter and then do something like this

WorldServer world = (WorldServer) player.getEntityWorld();
PlayerList playerList = world.getMinecraftServer().getPlayerList();

playerList.transferPlayerToDimension(player, <dimensionID>, new CustomTeleporter(params....));

 

Edited by Terrails
made it make more sense and added an example
Link to comment
Share on other sites

22 minutes ago, Terrails said:

Changing dimensions is done with PlayerList#transferPlayerToDimension, which you get from WorldServer and it requires a Teleporter as a parameter. Make a class which extends Teleporter and then do something like this


WorldServer world = (WorldServer) player.getEntityWorld();
PlayerList playerList = world.getMinecraftServer().getPlayerList();

playerList.transferPlayerToDimension(player, <dimensionID>, new CustomTeleporter(params....));

 

Yeah, I already have that done, now. However, I also made some other edits, and it no longer tries to teleport the player... I've updated the repository.

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

Just tried it myself and it crashes me when it starts 

placeInExistingPortal(Entity entityIn, float rotationYaw);

in placeInPortal method. If you want to use that you need to override it and make it work for you... also I suggest adding BlockPos to the constructor and then accessing it in

placeInPortal(Entity entity, float rotationYaw);

I do something like this (You could also use Entity#setLocationAndAngles, but I prefer it this way):

    @Override
    public void placeInPortal(Entity entity, float rotationYaw) {
        entity.setPosition(this.pos.getX() + 0.5, this.pos.getY(), this.pos.getZ() + 0.5);
        entity.motionX = 0.0f;
        entity.motionY = 0.0f;
        entity.motionZ = 0.0f;
    }

Also don't forget to add

@Override

to your methods

Edited by Terrails
Link to comment
Share on other sites

5 minutes ago, Terrails said:

Just tried it myself and it crashes me when it starts 


Teleporter#placeInExistingPortal(Entity entityIn, float rotationYaw);

in placeInPortal method. If you want to use that you need to override it and make it work for you... also I suggest adding BlockPos to the constructor and then accessing it in


placeInPortal(Entity entity, float rotationYaw);

I do something like this (You could also use Entity#setLocationAndAngles, but I prefer it this way):


    @Override
    public void placeInPortal(Entity entity, float rotationYaw) {
        entity.setPosition(this.pos.getX() + 0.5, this.pos.getY(), this.pos.getZ() + 0.5);
        entity.motionX = 0.0f;
        entity.motionY = 0.0f;
        entity.motionZ = 0.0f;
    }

Also don't forget to add


@Override

to your methods

The thing is, I don't want to to spawn a portal, which is what I've been having issues with. At this point, I've actually gotten a bit ahead, as by the time you responded, I had already updated the repository 1 or 2 times ^^;

 

Though, at this rate, I'm beginning to think it would be easier to raise each chunk up a bit, and raise the build limit. 

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

2 hours ago, Terrails said:

the portal doesn't get created actually, it only just teleports the player if you use my example of placeInPortal.

It is 100% on this line right here, and 100% me not initializing the variable correctly. Sadly, I don't know what it wants

: /

Edited by Daring Do

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

Make sure to the the world is on server...

if (!world.isRemote) {
     // Code
}

If that doesn't still do it (which it should) try something like this:

if (!world.isRemote) {
	((WorldServer) world).getMinecraftServer().getPlayerList().transferPlayerToDimension(
					(EntityPlayerMP) player.getEntity(), 100, 
					new TeleporterVoid(world.getMinecraftServer().getWorld(100)));
}

Also you should probably use the entity world for the teleporter

Edited by Terrails
Link to comment
Share on other sites

6 minutes ago, Terrails said:

Make sure to the the world is on server...


if (!world.isRemote) {
     // Code
}

If that doesn't still do it (which it should) try something like this:


if (!world.isRemote) {
	((WorldServer) world).getMinecraftServer().getPlayerList().transferPlayerToDimension(
					(EntityPlayerMP) player.getEntity(), 100, 
					new TeleporterVoid(world.getMinecraftServer().getWorld(100)));
}

Also you should probably use the entity world for the teleporter

Oh. Okay then. I'll give it a go in about an hour when I'm on my computer again. Here's to hoping that fixes that problem. 

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

1 hour ago, Terrails said:

Make sure to the the world is on server...


if (!world.isRemote) {
     // Code
}

If that doesn't still do it (which it should) try something like this:


if (!world.isRemote) {
	((WorldServer) world).getMinecraftServer().getPlayerList().transferPlayerToDimension(
					(EntityPlayerMP) player.getEntity(), 100, 
					new TeleporterVoid(world.getMinecraftServer().getWorld(100)));
}

Also you should probably use the entity world for the teleporter

So, small problem, but that's in a Subscribe Event, meaning I can't have more than the one parameter, which in order to do if(!world.isRemote) I would need a second one. Unless you were telling me to test if the world server is remote, in which case, it doesn't work.

 

Actually, it also doesn't like the ((WorldServer) world)... bit either, apparently

Edited by Daring Do

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

You shouldn't be using that world in your class (what are you even doing with it).... Use the world you get from the event

event.getEntityLiving().getEntityWorld()

also make sure to check this

if (event.getEntityLiving() instanceof EntityPlayerMP) {
}

you don't need world.isRemote then since you already know its on server since its the server player.

Link to comment
Share on other sites

2 hours ago, Terrails said:

You shouldn't be using that world in your class (what are you even doing with it).... Use the world you get from the event


event.getEntityLiving().getEntityWorld()

also make sure to check this


if (event.getEntityLiving() instanceof EntityPlayerMP) {
}

you don't need world.isRemote then since you already know its on server since its the server player.

So no matter what I seemed to do, it wouldn't function properly. Maybe it's because it's over my head, but I settled on a different compromise for this. Thanks for at least trying to help.

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

Link to comment
Share on other sites

Just now, Daring Do said:

So no matter what I seemed to do, it wouldn't function properly. Maybe it's because it's over my head, but I settled on a different compromise for this. Thanks for at least trying to help.

This is all you need... like for real:

    @SubscribeEvent
    public static void hurtEvent(LivingHurtEvent event) {
        if (event.getEntityLiving() instanceof EntityPlayerMP) {
            EntityPlayerMP player = (EntityPlayerMP) event.getEntityLiving();

            PlayerList playerList = player.getEntityWorld().getMinecraftServer().getPlayerList();
            playerList.transferPlayerToDimension(player, <dimension>, new TeleporterVoid((WorldServer) player.getEntityWorld()));
        }
    }

 

Link to comment
Share on other sites

7 minutes ago, Terrails said:

This is all you need... like for real:


    @SubscribeEvent
    public static void hurtEvent(LivingHurtEvent event) {
        if (event.getEntityLiving() instanceof EntityPlayerMP) {
            EntityPlayerMP player = (EntityPlayerMP) event.getEntityLiving();

            PlayerList playerList = player.getEntityWorld().getMinecraftServer().getPlayerList();
            playerList.transferPlayerToDimension(player, <dimension>, new TeleporterVoid((WorldServer) player.getEntityWorld()));
        }
    }

 

I realized I can just make it turn a piece of bedrock at y = 0 into an invisible portal block that teleports you as soon as you pass through it, though. Which is what I've already done, just haven't updated the repository. It also solves my fall damage issue, that I've been unsure if I solved. 

Gne9eza.png

 

"Be patient with me, because I'm an absolute moron half the time."

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



×
×
  • Create New...

Important Information

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