Posted May 21, 20214 yr I have block which reads nbt data about position and dimension from an item in its inventory and sends any entities on top of it to that position and dimension. This works fine in most cases, but in particular when sending an item, player, or mob (that I have tested) from the end to the overworld, the entity will be sent to spawn instead of the specified position. I assume this is related to how hopping in the portal after defeating the dragon sends the player back to the overworld's spawn. Does anybody know how I can get around this? Relevant code: https://github.com/eddie1101/Voidcraft/blob/master/src/main/java/erg/voidcraft/common/block/BlockPortalBase.java#L131-L181 Thanks Edit: In addition, I noticed that when travelling to or from the nether near a nether portal, the entity will occasionally be teleported to the position of the portal rather than the specified position. Again, I assume this has something to do with how Minecraft syncs nether portals across dimensions, but the only way to change dimensions that I'm aware of is Entity#changeDimension, so I'm not sure how to get around this. Edited May 23, 20214 yr by octa
May 22, 20214 yr 9 hours ago, octa said: Does anybody know how I can get around this? Instead of using the vanilla Teleporter, create your own implementation of ITeleporter.
May 23, 20214 yr Author So I tried this, and in looking at the vanilla code I'm making a few assumptions. It seems that when you call Entity#changeDimension, it will pass in the vanilla lambda for repositionEntity to your teleporter, which basically means in my code for Teleporter#placeEntity I want to completely ignore that lambda and do everything I need to do in placeEntity instead. I just want to teleport like normal, but without any of the vanilla portal shenanigans, so I basically just copied the vanilla lambda in changeDimension and removed the parts that I don't want, which gives me a null pointer. The problem is that using the EntityType factory gives me null instead of a ServerPlayerEntity. Maybe I'm missing something simple here, but for the life of me I can't figure this out. Any help is appreciated. Here's my code And here's my crash report Edited May 23, 20214 yr by octa
May 23, 20214 yr 3 hours ago, octa said: I just want to teleport like normal, but without any of the vanilla portal shenanigans You can use repositionEntity in that case, but supply it with false to prevent a portal from spawning. I suggest reading the javadoc in ITeleporter, it is very detailed!
May 23, 20214 yr Author 7 hours ago, vemerion said: You can use repositionEntity in that case, but supply it with false to prevent a portal from spawning. I suggest reading the javadoc in ITeleporter, it is very detailed! This works, but it took me a little while to figure out why. I didn't realize that ITeleporter#getPortalInfo was responsible for a lot of the vanilla implementation. Thanks for the help! Here's my code for anyone else struggling, but it's very simple.
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.