Jump to content

Recommended Posts

Posted

Gettin' a little tired of putting nether portals all over the place in the game when trying to /home. Since forgeessentials hasn't been worked on for a while I'm trying to code my own.

 

What is the best way to move an entity from one world to an another without creating those obsidian gateways?

Posted

Unfortuntely I'm trying to avoid those portal all together. The code I'm doing this for is so the player can /home, do what he needs to, then /back to where he went.

 

In most cases, he certainly didn't have a nether portal near him when he left that dimension so... yea.

Posted

That's smart, when the teleport happens just make a three for loops increasing the x, y, z like this.

 

for (int i = player.posX - 5; i < player.posX + 5; i++)
{
    for (int j = player.posY - 5; j < player.posX + 5; j++)
    { 
        for (int k = player.posZ - 5; k < player.posX + 5; k++)
        { 
               if (world.getBlock(i, j k) == Blocks.obsidian || world.getBlock(i, j k) == Blocks.portal)
               {
                       world.setBlockToAir(i, j, k);   
               }
        }
    }
}

Something like that.

Posted

I understand that method would work, though I'm not a real big fan of it because it feels more like a hack than a solution. For example, if they happen to be standing on obsidian, like a lava lake turned obsidian from a firestone, then this'll end up deleting obsidian blocks that didn't come from a portal.

 

I'm looking at possibly grabbing the worldserver for their source and destination worlds and telling them to remove and add the player respectively, then update their position. I don't think this'll work but it's worth a shot.

 

//WorldServer start = DimensionManager.getWorld(plyr.dimension);
//start.getPlayerManager().removePlayer(plyr);

WorldServer overworld = DimensionManager.getWorld(0);
overworld.getPlayerManager().addPlayer(plyr);

ChunkCoordinates c = overworld.getSpawnPoint();
plyr.setPositionAndUpdate(c.posX, c.posY, c.posZ);

 

Edit: This was a fail.

Posted

Create your own teleported class and a command to call it.  You will need to specify where to go in the destination dimension somehow.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted
  On 4/23/2014 at 12:25 PM, delpi said:

Create your own teleported class and a command to call it.  You will need to specify where to go in the destination dimension somehow.

 

Do you have some example code to show this? I've yet to see a way to get around making a portal in game without effectively recreating the CommandServerTP class.

Posted

I can share one tonight.

 

The basics are you need your own command.  Assuming you know how to do that.

 

From it you call your teleported code.  The trick is to override the methods in such a way it only does what you want.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted
  On 4/23/2014 at 5:58 PM, whiskeyfur said:

without effectively recreating the CommandServerTP class.

 

What's wrong with that?  That is probably the way you would want to do it, and I think delpi is proposing to give you such an example.  Logically it sounds like what you want -- a custom command that teleports.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Here is something that works for me.  I've done it different ways, but you should be able to modify this to suit your purposes.

 

 

  Reveal hidden contents

 

 

Then setup a custom command to call it with something similar to this.

 

 

  Reveal hidden contents

 

 

 

Let me know how it goes.

Long time Bukkit & Forge Programmer

Happy to try and help

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.