Jump to content

[1.12.2] Making a Custom Crafting Table for my mod items [Solved]


H_SerhatY

Recommended Posts

10 hours ago, H_SerhatY said:

But I made a texture for GUI.

 

crafting_table.png

Isn’t that a normal crafting table texture?

 

make a custom block, look at BlockWorkbench and ContainerWorkbench and GuiWorkbench and make custom versions of them

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

3 hours ago, Cadiboo said:

Isn’t that a normal crafting table texture?

 

make a custom block, look at BlockWorkbench and ContainerWorkbench and GuiWorkbench and make custom versions of them

Correct. It's a normal crafting table texture.

Now I'm going to make a block and take the codes from Minecraft's workbench.

Edit: I find the BlockWorkbench and ContainerWorkbench but I can't find the GuiWorkbench.

Edited by H_SerhatY

My Mods:

More Strenghtened Tools Mod:

https://www.curseforge.com/minecraft/mc-mods/mstm

Link to comment
Share on other sites

It's in net.minecraft.client

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.

Link to comment
Share on other sites

23 hours ago, Draco18s said:

It's in net.minecraft.client

 

I'm looked at this but I can't find the GuiWorkbench, I find only thing related, GuiCrafting.

Edit: Oh, it's VERY HARD. At least, I'm seeing it's VERY HARD.

Edited by H_SerhatY

My Mods:

More Strenghtened Tools Mod:

https://www.curseforge.com/minecraft/mc-mods/mstm

Link to comment
Share on other sites

On 9/1/2018 at 7:17 PM, Draco18s said:

It's in net.minecraft.client

 

I make custom version of BlockWorkbench. But I can't be sure doing it right.

package com.H_SerhatY.MoreStrenghtenedToolsMod.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.stats.StatList;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World;

public class MSTMWorkbench extends Block
{
    protected MSTMWorkbench()
    {
        super(Material.IRON);
        this.setCreativeTab(CreativeTabs.DECORATIONS);
    }

    /**
     * Called when the block is right clicked by a player.
     */
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            playerIn.displayGui(new MSTMWorkbench.InterfaceCraftingTable(worldIn, pos));
            playerIn.addStat(StatList.CRAFTING_TABLE_INTERACTION);
            return true;
        }
    }

    public static class InterfaceCraftingTable implements IInteractionObject
        {
            private final World world;
            private final BlockPos position;

            public InterfaceCraftingTable(World worldIn, BlockPos pos)
            {
                this.world = worldIn;
                this.position = pos;
            }

            /**
             * Get the name of this object. For players this returns their username
             */
            public String getName()
            {
                return "mstm_workbench";
            }

            /**
             * Returns true if this thing is named
             */
            public boolean hasCustomName()
            {
                return false;
            }

            /**
             * Get the formatted ChatComponent that will be used for the sender's username in chat
             */
            public ITextComponent getDisplayName()
            {
                return new TextComponentTranslation(Blocks.CRAFTING_TABLE.getUnlocalizedName() + ".name", new Object[0]);
            }

            public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
            {
                return new ContainerWorkbench(playerInventory, this.world, this.position);
            }

            public String getGuiID()
            {
                return "mstm:workbench";
            }
        }
}

@Cadiboo

Edited by H_SerhatY

My Mods:

More Strenghtened Tools Mod:

https://www.curseforge.com/minecraft/mc-mods/mstm

Link to comment
Share on other sites

21 hours ago, H_SerhatY said:

 

I make custom version of BlockWorkbench. But I can't be sure doing it right.


package com.H_SerhatY.MoreStrenghtenedToolsMod.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.stats.StatList;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World;

public class MSTMWorkbench extends Block
{
    protected MSTMWorkbench()
    {
        super(Material.IRON);
        this.setCreativeTab(CreativeTabs.DECORATIONS);
    }

    /**
     * Called when the block is right clicked by a player.
     */
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            playerIn.displayGui(new MSTMWorkbench.InterfaceCraftingTable(worldIn, pos));
            playerIn.addStat(StatList.CRAFTING_TABLE_INTERACTION);
            return true;
        }
    }

    public static class InterfaceCraftingTable implements IInteractionObject
        {
            private final World world;
            private final BlockPos position;

            public InterfaceCraftingTable(World worldIn, BlockPos pos)
            {
                this.world = worldIn;
                this.position = pos;
            }

            /**
             * Get the name of this object. For players this returns their username
             */
            public String getName()
            {
                return "mstm_workbench";
            }

            /**
             * Returns true if this thing is named
             */
            public boolean hasCustomName()
            {
                return false;
            }

            /**
             * Get the formatted ChatComponent that will be used for the sender's username in chat
             */
            public ITextComponent getDisplayName()
            {
                return new TextComponentTranslation(Blocks.CRAFTING_TABLE.getUnlocalizedName() + ".name", new Object[0]);
            }

            public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn)
            {
                return new ContainerWorkbench(playerInventory, this.world, this.position);
            }

            public String getGuiID()
            {
                return "mstm:workbench";
            }
        }
}

@Cadiboo

What’s going wrong? I can see some obvious small errors, and you probably aren’t using your GUI instead of vanilla’s but I can see anything horrible wrong except for that you copy pasted everything and didn’t change most of the logic

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

10 hours ago, Cadiboo said:

What’s going wrong? I can see some obvious small errors, and you probably aren’t using your GUI instead of vanilla’s but I can see anything horrible wrong except for that you copy pasted everything and didn’t change most of the logic

Okey. Maybe I need to start with basic things.

What I know:

- Making Items

- Making Blocks

- Making Tools

- Making Armors

But I can't select anything basic except this ones. Because there is no basic things except this ones.

My Mods:

More Strenghtened Tools Mod:

https://www.curseforge.com/minecraft/mc-mods/mstm

Link to comment
Share on other sites

1 minute ago, H_SerhatY said:

Okey. Maybe I need to start with basic things.

Well there is the most basic thing, the Java language. Do you know this one.

  • Like 1

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.

Link to comment
Share on other sites

  • 6 months later...
On 9/1/2018 at 1:57 PM, H_SerhatY said:

 

I'm looked at this but I can't find the GuiWorkbench, I find only thing related, GuiCrafting.

Edit: Oh, it's VERY HARD. At least, I'm seeing it's VERY HARD.

where did you find GuiWorkbench? i have looked all over net.client.gui and i couldn't find it

Link to comment
Share on other sites

54 minutes ago, ButterAleks said:

where did you find GuiWorkbench? i have looked all over net.client.gui and i couldn't find it

1. Do not necrothread. Make a new thread.

2. Use your IDE. The search function exists for a reason.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

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.