Jump to content

Recommended Posts

Posted

Hello world,

I would like to know how to  create a new dimension using Forge, because I have found some tutorial on the net but none of them use Forge and because of that they all indicate to edit base class. I have noticed that Forge had a DimensionHandler but I have to admit that I am clueless on how to use it, so I would really appreciate a little explanation about it.

I already thanks those who will take the time to help me with my noobs questions

signat10.png
Posted

All you need to do is register the dimension's world provider, and then use the usePortal function in Minecraft/MinecraftServer to teleport your player.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
  On 5/21/2012 at 10:19 PM, LexManos said:

All you need to do is register the dimension's world provider, and then use the usePortal function in Minecraft/MinecraftServer to teleport your player.

Thanks for the reply ^^

signat10.png
Posted

I need a little more help about the usePortal() function, because in the tutorial I am using the usePortal() is called in a customized setInPortal() function, added in a base class. So how to do it without editing the base class ?

And BTW how to make the mod load from a .zip in the mods folder ? (It will avoid opening a topic just for that)

signat10.png
Posted

It is just the function for switching worlds.  Your teleportation points can be whatever you can imagine.  From right clicking with an item, to be killed or touched by a special mob, or hopping into a portal.  However you do it, when you need to switch worlds then call usePortal().

 

* Untested as I have not made a new dimension.  This is just from reading over the code.

Posted

I could do with some help with the usePortal method

 

i registered my dimension to ID 10, yet when i put mc.usePortal(10); it crashes on touching the portal block (i may have made a really stupid error that im not seeing, for which i apologise)

Posted
  On 5/24/2012 at 6:48 PM, jasonw749 said:

I could do with some help with the usePortal method

 

i registered my dimension to ID 10, yet when i put mc.usePortal(10); it crashes on touching the portal block (i may have made a really stupid error that im not seeing, for which i apologise)

I finally succeed to make my own so maybe I could help. You should try to add as a second parameter to your usePortal() function the Teleporter for your dimension. Also if it keep crashing try to give us more of your code

signat10.png
Posted
  On 5/24/2012 at 7:38 PM, jasonw749 said:

i believe i found my issue xD

 

i didnt have a teleporter class, what goes in there?

 

It is a class that take care of the "safe landing" of the player, and generate the portal for going back

signat10.png
Posted

ok, so its still not working. ill post some code.

 

Teleporter class

 

  Reveal hidden contents

 

 

 

the method called in block Portal

 

  Reveal hidden contents

 

 

My dimension register

 

  Reveal hidden contents

 

 

thanks for the help :) im guessing im doing something obviously wrong that i just cant see... its always the way

 

Posted

The error is in the blockPortal code :

first, the variable mc you use is not initialized with the actual minecraft instance, so it is actually empty, so use instead the ModLoader.getMinecraftInstance()

second, you will face a problem : the code will work but the usePortal() teleport you instantly, and when you will arrive in th edimension, you will be teleported back, and so on. To avoid this problem I used this code (this is certainly not the best way to do it but a least it work) :

 public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
    {
        if(entity.ridingEntity == null && entity.riddenByEntity == null && entity instanceof EntityPlayerSP)
        {
            if(ModLoader.getMinecraftInstance().thePlayer.timeUntilPortal == 0)
            {
            if(ModLoader.getMinecraftInstance().thePlayer.dimension != 2)
            {
            	ModLoader.getMinecraftInstance().thePlayer.timeUntilPortal = 10;
            	ModLoader.getMinecraftInstance().usePortal(2, mod_ghostdimension.TeleporterGhost);
            }else
            {
            	ModLoader.getMinecraftInstance().thePlayer.timeUntilPortal = 10;
            	ModLoader.getMinecraftInstance().usePortal(0, mod_ghostdimension.TeleporterGhost);
            }
            }
            else{
            	ModLoader.getMinecraftInstance().thePlayer.timeUntilPortal = 10;
            }
            		
        }
    }

signat10.png

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.