Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • How to check what dimension the player is in
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Mew

How to check what dimension the player is in

By Mew, May 22, 2013 in Modder Support

  • Start new topic

Recommended Posts

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 22, 2013

I am trying to have a GUI show that only gets shown when the player enters the new dimension I have. I can find multiple places where the GUI shows for a split second then disappears, but is there an event, or a special way of tracking what dimension the player is in, and when he changes dimension?

 

-Mew


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 22, 2013

Bump. I really need to know!!! Is diesieben07 online to help?


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

endershadow    36

endershadow

endershadow    36

  • Dragon Slayer
  • endershadow
  • Forge Modder
  • 36
  • 535 posts
Posted May 22, 2013

you could get the worldObj from the player. so it would look i little like

player.worldObj.provider.dimensionId

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15995 posts
Posted May 22, 2013

you could get the worldObj from the player. so it would look i little like

player.worldObj.provider.dimensionId

 

Yup, I use this a lot actually. :P

Namely for packet sending (as I haven't figured out how to convert an EntityPlayer into a Player for use with sendPacketToPlayer, so I use sendPacketToNearby).


Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

SanAndreasP    402

SanAndreasP

SanAndreasP    402

  • World Shaper
  • SanAndreasP
  • Forge Modder
  • 402
  • 1689 posts
Posted May 22, 2013

you could get the worldObj from the player. so it would look i little like

player.worldObj.provider.dimensionId

 

Yup, I use this a lot actually. :P

Namely for packet sending (as I haven't figured out how to convert an EntityPlayer into a Player for use with sendPacketToPlayer, so I use sendPacketToNearby).

 

You just cast the EntityPlayer to the Player: (Player)entityPlayer

like you would do it the other way around when receiving the packet: (EntityPlayer)player


Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 22, 2013

you could get the worldObj from the player. so it would look i little like

player.worldObj.provider.dimensionId

 

YAY!!!! Half of what I am looking for...

 

Now I know what to call to check if the player is in a certain dimension, but how do I know WHEN the player changes dimension? Thats what I really want to know :/


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

endershadow    36

endershadow

endershadow    36

  • Dragon Slayer
  • endershadow
  • Forge Modder
  • 36
  • 535 posts
Posted May 22, 2013

you could save the dimension in a variable, and then look at it again later and see if they are the same. I did something like that for my energy-esque network.

Share this post


Link to post
Share on other sites

mnn    76

mnn

mnn    76

  • Diamond Finder
  • mnn
  • Members
  • 76
  • 298 posts
Posted May 22, 2013

implement a class implementing IPlayerTracker (register it with GameRegistry.registerPlayerTracker) and when a player changes dimension it will run onPlayerChangedDimension method in your class ;).


mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 22, 2013

implement a class implementing IPlayerTracker (register it with GameRegistry.registerPlayerTracker) and when a player changes dimension it will run onPlayerChangedDimension method in your class ;).

 

Hmm.. Ill retry with this new way of finding the players dimension...

I tried before and it didn't work :/

 

you could save the dimension in a variable, and then look at it again later and see if they are the same. I did something like that for my energy-esque network.

 

Not really needed I would think xD


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

mnn    76

mnn

mnn    76

  • Diamond Finder
  • mnn
  • Members
  • 76
  • 298 posts
Posted May 22, 2013

It's possible that it's only server-side. But you can easily implement a custom packet to trigger something on a client (if it's really server-side only).


mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 22, 2013

It's possible that it's only server-side. But you can easily implement a custom packet to trigger something on a client (if it's really server-side only).

 

Great. Now I have to create a Packet system for an otherwise simple test.... Haha, nothings ever as simple as it seems to be xD


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15995 posts
Posted May 22, 2013

Apparently I'm not allowed to reply to posts any more.  The forum whines that I either submitted another post too recently or already submitted that post.

The hell I did.

 

entityPlayer.dimension

 

All entities have a reference to the dimension that they're in.  No need for listeners or accessing the world object.

 

You just cast the EntityPlayer to the Player: (Player)entityPlayer

like you would do it the other way around when receiving the packet: (EntityPlayer)player

 

Apparently I gave up without actually trying that. xD


Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 22, 2013

I tried the entityPlayer.dimension but it didn't work... So ill try any new way that comes to me :P


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Squawkers13    1

Squawkers13

Squawkers13    1

  • Tree Puncher
  • Squawkers13
  • Members
  • 1
  • 31 posts
Posted May 22, 2013

A lot of people would like to know how you made your dimension.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 22, 2013

A lot of people would like to know how you made your dimension.

 

Umm. What? I don't understand :/

 

If you want to know how to make a dimension look at Spazzys Solar system mod code on github. Which can be found here: https://github.com/haydenf96/Spazzysmod

 

More specifically these files:

https://github.com/haydenf96/Spazzysmod/blob/master/Spazzysmod/spazzysmod_common/Spazzysmod/world/TeleporterMoonPortal.java

https://github.com/haydenf96/Spazzysmod/blob/master/Spazzysmod/spazzysmod_common/Spazzysmod/world/WorldProviderMoon.java

https://github.com/haydenf96/Spazzysmod/blob/master/Spazzysmod/spazzysmod_common/Spazzysmod/world/chunk/ChunkManagerMoon.java

https://github.com/haydenf96/Spazzysmod/blob/master/Spazzysmod/spazzysmod_common/Spazzysmod/world/SpazzysDimensions.java

https://github.com/haydenf96/Spazzysmod/blob/master/Spazzysmod/spazzysmod_common/Spazzysmod/SpazzysmodBase.java

 

Those are all the files for the Moon dimension in the mod. (I help make that mod, I am ModderPenguin)


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Squawkers13    1

Squawkers13

Squawkers13    1

  • Tree Puncher
  • Squawkers13
  • Members
  • 1
  • 31 posts
Posted May 23, 2013

Thanks. That helps.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 23, 2013

Your welcome mate :D


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Squawkers13    1

Squawkers13

Squawkers13    1

  • Tree Puncher
  • Squawkers13
  • Members
  • 1
  • 31 posts
Posted May 23, 2013

Wait- how do you light the portal?

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 23, 2013

I don't have a portal lighter for that... It was just the dimension xD

 

To do that, just look at Wuppy29's 1.4.7 tutorials and look at the portal placer tutorial. That is probably a good way f doing it.


I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Squawkers13    1

Squawkers13

Squawkers13    1

  • Tree Puncher
  • Squawkers13
  • Members
  • 1
  • 31 posts
Posted May 23, 2013

That is not coded with Pudlehund's Dimension API.

But that requires altering a base class. :0

Share this post


Link to post
Share on other sites

Vinit    0

Vinit

Vinit    0

  • Tree Puncher
  • Vinit
  • Members
  • 0
  • 2 posts
Posted August 22, 2020
On 5/22/2013 at 4:49 PM, endershadow said:

you could get the worldObj from the player. so it would look i little like

player.worldObj.provider.dimensionId

i am new to forge, i m making a mod, it needs to know if player is in end dimension, i used this code

 

public void playerlocation (){

       if (player.worldObj.provider.dimensionId = 1) {
    }

but it highlights the player as red color, what am i missing

 

 

 

my full code + its in a new java class

 

package com.example;
import net.minecraft.entity.Entity;
import net.minecraft.entity.*;
public class Listeners {



    public void playerlocation (){

       if (player.worldObj.provider.dimensionId = 1) {
    }
}

 

Share this post


Link to post
Share on other sites

loordgek    176

loordgek

loordgek    176

  • World Shaper
  • loordgek
  • Members
  • 176
  • 1823 posts
Posted August 22, 2020

make your own thread this on is from 2013

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • brok4d
      Modded 1.16 fluid has no physics

      By brok4d · Posted 3 minutes ago

      Well, you should have it, since that's why you get the error, the .png files and the .mcmeta files since the .mcmeta files are for animation if I'm not mistaken. This is what the .mcmeta have. { "animation": { "frametime": 4 } }
    • sc0rich
      how do I config mods in 1.16.4?

      By sc0rich · Posted 4 minutes ago

      Oh, okay.       wait, then how do I access the configurations? do you know where do I go? how I edit .cfg and .toml files? cause I just found it
    • diesieben07
      how do I config mods in 1.16.4?

      By diesieben07 · Posted 15 minutes ago

      They very much have a config. They just do not have a config GUI.
    • TeaWithBebeLoca
      How to download Forge on Linux Debian?

      By TeaWithBebeLoca · Posted 17 minutes ago

      So basically, I'm fairly new to linux, and I have no idea how to install forge. I run Linux Debian 10 (Buster), and I have Java edition Minecraft. I've installed the .jar file, but I don't know where to go from there.
    • sc0rich
      how do I config mods in 1.16.4?

      By sc0rich · Posted 24 minutes ago

      is that recent? like, not even forge has a config...
  • Topics

    • NullDev
      3
      Modded 1.16 fluid has no physics

      By NullDev
      Started 4 hours ago

    • sc0rich
      6
      how do I config mods in 1.16.4?

      By sc0rich
      Started Yesterday at 02:11 AM

    • TeaWithBebeLoca
      0
      How to download Forge on Linux Debian?

      By TeaWithBebeLoca
      Started 18 minutes ago

    • Latobius
      6
      1.16.4 Can't connect to server, incomplete server tags.

      By Latobius
      Started 13 hours ago

    • cadbane86140
      0
      Minecraft: Survival Island Episode 12- One of the FUNNIEST Episodes Yet!

      By cadbane86140
      Started 43 minutes ago

  • Who's Online (See full list)

    • brok4d
    • CookieLukas
    • sc0rich
    • Hubmac
    • TeaWithBebeLoca
    • Seika85
    • Kaiser Frederick
    • Pickle_Face5
    • BruhZenith
    • imawindow
    • Daeruin
    • sarkozi
    • diesieben07
    • Deadlocked47
    • Unlucky
    • Aviator737
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • How to check what dimension the player is in
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community