kangarko / Foundation

Foundation™ helps you create highly customized Minecraft plugins (based on Spigot/Paper API) that support multiple MC versions.
https://mineacademy.org
305 stars 63 forks source link

1.20.1: animation #257

Closed TheRedEnd2000 closed 8 months ago

TheRedEnd2000 commented 8 months ago

Hello,

So i used this extention for my plugin

When i create my inventory and it opens an animation with glass starts wenn i then go with a button in an extra menu and use the door to go back the animation is not longer there

This is my code:

@Override
    protected void onPostDisplay(Player viewer) {
        animate(40, new MenuRunnable() {
            boolean toggle = true;
            @Override
            public void run() {
                int[] glass = new int[]{0,1,2,6,7,8,9,17,36,44,45,46,47,51,52,53};
                for (int i = 0; i<glass.length;i++)
                    setItem(glass[i],ItemCreator.of(toggle ? CompMaterial.LIME_STAINED_GLASS_PANE : CompMaterial.WHITE_STAINED_GLASS_PANE,"§c").make());
                int[] glass2 = new int[]{3,5,18,26,27,35,48,50};
                for (int i = 0; i<glass2.length;i++)
                    setItem(glass2[i],ItemCreator.of(!toggle ? CompMaterial.LIME_STAINED_GLASS_PANE : CompMaterial.WHITE_STAINED_GLASS_PANE,"§c").make());
                toggle = !toggle;
            }
        });
    }

hope it get fixed

I have one question left: is there a wiki to see all the funktions of foundation or a information how to use the extention?

Your siencly

kangarko commented 8 months ago

Hey!

Try using "true" as the last argument in your submenu constructor that returns back to the animated menu. That will toggle making a new instance of the parent menu. Make sure to override newInstance() method in the parent menu:

a

kangarko commented 8 months ago

No right now there is no wiki of Foundation.

TheRedEnd2000 commented 8 months ago

Is it possible to add one?

TheRedEnd2000 commented 8 months ago

@kangarko can I somehow get the newInstance() with arguments or is it possible to make a border of glas or somethink like that

kangarko commented 8 months ago

No, the new instance must be without arguments.

But you can just keep the arguments from your main constructor as fields in the class, and then pass them inside the new instance like this:

a