Jump to content

Recommended Posts

Posted (edited)

Hi, 

       I wanted to make a custom crafting table.

The idea I had was to basically to copy the vanilla crafting table - so have the 3 by 3 grid and the 1 output (I wanted to do this so my recipes wouldn't clash, in the vanilla table).

Context aside for a minute.

I tried to copy the classes, but nothing worked!

I was just wondering if anyone would be able to help, either with reference code or just some help!

Please and Thanks!

This is for 1.12.2!

Edited by Pppineeeee3
Posted
  On 4/4/2019 at 7:11 PM, Pppineeeee3 said:

I tried to copy the classes, but nothing worked!

Expand  

Of course nothing worked.

You can't just copy everything out of its original context and expect it to work.

 

  1. Define "nothing worked"
  2. Show your code. We can't do anything without seeing your code.

Some tips:

  Reveal hidden contents

 

Posted
  On 4/8/2019 at 3:41 AM, DavidM said:

Of course nothing worked.

You can't just copy everything out of its original context and expect it to work.

 

  1. Define "nothing worked"
  2. Show your code. We can't do anything without seeing your code.
Expand  

The block was IG but no GUI opened.

Posted
  On 4/8/2019 at 11:19 PM, Pppineeeee3 said:

The block was IG but no GUI opened.

Expand  

 

  On 4/8/2019 at 3:41 AM, DavidM said:

Show your code. We can't do anything without seeing your code.

Expand  

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
  On 4/8/2019 at 11:19 PM, Pppineeeee3 said:

The block was IG but no GUI opened.

Expand  

You have to call player.openGUI(INSTANCE (Main mod instance), id (0 if it is the first GUI your mod has), other args...).

Then you have to make a GUI handler like this:
 

public class GuiHandler implements IGuiHandler {
    @Nullable
    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
        if(ID == 0)
            return new YourContainer();
        return null;
    }

    @Nullable
    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
        if(ID == 0)
            return new YourGuiScreen(YourContainer());
        return null;
    }
}

Then register it in your load method:

NetworkRegistry.INSTANCE.registerGuiHandler(INSTANCE(Main mod instance), new GuiHandler());

 

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.