Jump to content

Recommended Posts

Posted

I am looking for a general tutorial on how to make directional blocks like dispensers/chests/stairs.

I have Googled but no luck. The forge wiki is largely incomplete and outdated.

Thank you.

Nothing here but ghosts and shadows

Posted

Um, why not look at the vanilla blocks?

I asked for tutorial.

I went through Furnace, piston etc.

I didnt really understand this

 

private void setDispenserDefaultDirection(World par1World, int par2, int par3, int par4)
    {
        if (!par1World.isRemote)
        {
            int l = par1World.getBlockId(par2, par3, par4 - 1);
            int i1 = par1World.getBlockId(par2, par3, par4 + 1);
            int j1 = par1World.getBlockId(par2 - 1, par3, par4);
            int k1 = par1World.getBlockId(par2 + 1, par3, par4);
            byte b0 = 3;

            if (Block.opaqueCubeLookup[l] && !Block.opaqueCubeLookup[i1])
            {
                b0 = 3;
            }

            if (Block.opaqueCubeLookup[i1] && !Block.opaqueCubeLookup[l])
            {
                b0 = 2;
            }

            if (Block.opaqueCubeLookup[j1] && !Block.opaqueCubeLookup[k1])
            {
                b0 = 5;
            }

            if (Block.opaqueCubeLookup[k1] && !Block.opaqueCubeLookup[j1])
            {
                b0 = 4;
            }

            par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
        }
    }

 

I started yesterday, maybe it will take a while. :(

Nothing here but ghosts and shadows

Posted

[ftp][/ftp]

Have you programmed java or any other programming language before? If not, you need to learn it first before you can start modding.

 

I have a decent experience of java. I was just looking for some tutorials as it saves a lot of time :)

Nothing here but ghosts and shadows

Posted

Well if you know your java then it shouldt be a problem :)

So what line(s) of the above code does you not understand ?

If you guys dont get it.. then well ya.. try harder...

Posted

Well if you know your java then it shouldt be a problem :)

So what line(s) of the above code does you not understand ?

 

What is Block.opaqueCubeLookup? ...and what it has to do with find the direction?

Nothing here but ghosts and shadows

Posted

Well if you know your java then it shouldt be a problem :)

So what line(s) of the above code does you not understand ?

 

What is Block.opaqueCubeLookup? ...and what it has to do with find the direction?

 

It's a static class level function that lets you lookup if a given block (by ID) is opaque or not.  In Eclipse you can mouse-over and function, variable, or class name and see the relevant information about it (if any) and there's a little red/green icon next to the definition in the yellow popup box, that if clicked on, will take you to where that function, class, or variable is declared.

 

As for what it has to do with direction:

It's a dispenser.  It's figuring out which direction it can face without facing a solid block.

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.

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.