Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • Author

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

  • Author

[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

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...

  • Author

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

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.