Custom crafting GUI bug with disappearing crafted item

Started by Radatavi on Tue, 10/31/2017 - 19:30

Topic category: Bugs and solutions

Last seen on 12:14, 20. Jan 2019
Joined Jun 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Custom crafting GUI bug with disappearing crafted item
Tue, 10/31/2017 - 19:30

I made a crafting GUI where I should put an ingot in a slot and press the button. Then it will -add item to inventory- (1 sheet) and -remove item from GUI slot- (1 ingot). When I exit this GUI, all crafted sheets disappear, but ingots are still the same as they were after crafting. What can I do with this bug?

Help me! Please! 

0Upvote this forum topic
Last seen on 12:14, 20. Jan 2019
Joined Jun 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
1.7.5 is my Mcreator version…
Sat, 11/04/2017 - 12:33

1.7.5 is my Mcreator version

 

0Upvote this forum topic
Last seen on 12:14, 20. Jan 2019
Joined Jun 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I searched for any alternate…
Sun, 11/05/2017 - 09:10

I searched for any alternate ways to give an item. Give command would not work properly due to the first part (thetomorrowtechthenewbeginning: or something else), so I tried to use -spawn gem-. Normally it spawns a gem at a block pos, but I wanted to add item to inventory nor I wanted it flying somewhere. I looked in the code and it now looks like this:

(I added a bold part)

protected void actionPerformed(GuiButton button) {
            MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
            World world = server.worlds[0];
            int i = (int) entity.posX;
            int j = (int) entity.posY;
            int k = (int) entity.posZ;

            if (button.id == 0) {

                if ((Comp.getStackInSlot(0) != null) && Comp.getStackInSlot(0).getItem() == mcreator_platinumIngot.block) {

                    if (true) {
                        Comp.decrStackSize(0, 1);
                    }

                    if (true) {
                        if (!world.isRemote) {
                            EntityItem var14 = new EntityItem(world, (double) (i), (double) (j), (double) (k), new ItemStack(
                                    mcreator_platinumSheet.block, 1, 0));
                            var14.setPickupDelay(10);
                            world.spawnEntity(var14);
                        }
                    }

                }

            }

 Now it works without any bugs, but I'd like to know about any other ways.

0Upvote this forum topic