Jump to content

Recommended Posts

Posted

Hello everyone,

 

I'm making a custom portal block that will send you to different areas depending on what the frame of the portal is. For example, if i had a portal like this,

 

SSSS

SPPS

SPPS

SPPS

SSSS

(P=Custom portal block, S = Stone).

 

how could I get all those stone blocks returned in a array? I know I could do this by checking the portal's metadata/direction and using a load of world.getBlock() calls, but I just thought I ask, maybe someone has a easier solution.

 

Thanks for reading!

~Geforce

Potato's have skin. I have skin. Therefore, i am a potato.

 

Follow me on Twitter!

http://www.twitter.com/I_Mod_Minecraft

Posted

Look at the vanilla portal code.  Might want to go back to 1.6.4 for simple portal shapes to start with.  Easier to follow.

 

Basically you need to determine which plane your portal is in : X or Z.  Then you find a way to iterate around and look at the blocks.

 

I'm going to make a suggestion to you though.  Instead of doing it the way you are describing, why don't you have a different portal block for each of your portal frames.  In the end it should be easier to follow and manage.

 

If you don't want to have to re-code each one, make a main one and extend it for each type of portal.  If you do it right, it is very clean and very little repeats.  I've done it and it has served me well.

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.