Jump to content

[1.10.2][SOLVED][TUT INSIDE] Overriding survival inventory player gui


lukas2005

Recommended Posts

hello i want to make that player inventory does not base on slots number but on weight of items i arelady maded a weight part but now how do i change player inventory?

 

EDIT:

i have found a tutorial how to do this: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571597-forge-1-6-4-1-8-custom-inventories-in-items-and

Link to comment
Share on other sites

hello i want to make that player inventory does not base on slots number but on weight of items i arelady maded a weight part but now how do i change player inventory?

 

Do you mean stacksize number, because slots number doesn't make sense for me. If i understand it right, i think you want to do something similar as terrafirmacraft? Food for example cannot be stacked but has a weight instead.

Maybe there is an event you can call to set the max stacksize of all items to 1. Not sure if this is even posseble. If you make your own items you can use setMaxStackSize(1)

Link to comment
Share on other sites

hello i want to make that player inventory does not base on slots number but on weight of items i arelady maded a weight part but now how do i change player inventory?

 

Do you mean stacksize number, because slots number doesn't make sense for me. If i understand it right, i think you want to do something similar as terrafirmacraft? Food for example cannot be stacked but has a weight instead.

Maybe there is an event you can call to set the max stacksize of all items to 1. Not sure if this is even posseble. If you make your own items you can use setMaxStackSize(1)

if you know the RPG games like The Witcher 3 then i want to make a inventory work like that you can stack items but depending on how much you have then if you reach limit you cant grab any more items and you are slower and i want to add a scroll bar to inventory and a counter how much you are carrying right now and what is your max

Link to comment
Share on other sites

Make a custom container and a custom gui then intercept when a container is opened using the ContainerOpenEvent (think that is the name and the one you should use) check if it is the platers inventory then just call player.openGui like normal and open yours.

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

Make a custom container and a custom gui then intercept when a container is opened using the ContainerOpenEvent (think that is the name and the one you should use) check if it is the platers inventory then just call player.openGui like normal and open yours.

ok but how to do that (i'm new to guis)
Link to comment
Share on other sites

Make a custom container and a custom gui then intercept when a container is opened using the ContainerOpenEvent (think that is the name and the one you should use) check if it is the platers inventory then just call player.openGui like normal and open yours.

ok but how to do that (i'm new to guis)

Since it is an inventory create a class that extends GuiContainer and a class that extends Container. Then look at vanilla for examples on what the methods do.

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

Make a custom container and a custom gui then intercept when a container is opened using the ContainerOpenEvent (think that is the name and the one you should use) check if it is the platers inventory then just call player.openGui like normal and open yours.

ok but how to do that (i'm new to guis)

Since it is an inventory create a class that extends GuiContainer and a class that extends Container. Then look at vanilla for examples on what the methods do.

is this what do you mean?

https://github.com/lukas2005/IDEA-Mod/commit/a83ad2a0b48764333f3095d67bca07328d5d04d9

Link to comment
Share on other sites

Only commenting to ask, since the vanilla "mainInventory" array stored in the InventoryPlayer only holds 36 ItemStacks (not counting the 4 armor slots, and 1 offhand)

 

What if the player had picked up enough items that weighed nothing (feathers) and filled the inventory. Even if the player had enough carry limit left they still wouldn't be able to pick up anymore. I guess the event "PlayerEvent.ItemPickupEvent" could be used to magically move a picked up item to a new "weighted" inventory but that still leaves to question that the hotbar (first 9 slots of the mainInventory) needs to be able to  have items picked up/moved to.

Link to comment
Share on other sites

Only commenting to ask, since the vanilla "mainInventory" array stored in the InventoryPlayer only holds 36 ItemStacks (not counting the 4 armor slots, and 1 offhand)

 

What if the player had picked up enough items that weighed nothing (feathers) and filled the inventory. Even if the player had enough carry limit left they still wouldn't be able to pick up anymore. I guess the event "PlayerEvent.ItemPickupEvent" could be used to magically move a picked up item to a new "weighted" inventory but that still leaves to question that the hotbar (first 9 slots of the mainInventory) needs to be able to  have items picked up/moved to.

easy just make also weighted hotbar
Link to comment
Share on other sites

Make a custom container and a custom gui then intercept when a container is opened using the ContainerOpenEvent (think that is the name and the one you should use) check if it is the platers inventory then just call player.openGui like normal and open yours.

ok but how to do that (i'm new to guis)

Since it is an inventory create a class that extends GuiContainer and a class that extends Container. Then look at vanilla for examples on what the methods do.

is this what do you mean?

https://github.com/lukas2005/IDEA-Mod/commit/a83ad2a0b48764333f3095d67bca07328d5d04d9

Yes, but you actually need to put information ie slots, slot interaction, etc. You should look into vanilla classes for this.

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

Make a custom container and a custom gui then intercept when a container is opened using the ContainerOpenEvent (think that is the name and the one you should use) check if it is the platers inventory then just call player.openGui like normal and open yours.

ok but how to do that (i'm new to guis)

Since it is an inventory create a class that extends GuiContainer and a class that extends Container. Then look at vanilla for examples on what the methods do.

is this what do you mean?

https://github.com/lukas2005/IDEA-Mod/commit/a83ad2a0b48764333f3095d67bca07328d5d04d9

Yes, but you actually need to put information ie slots, slot interaction, etc. You should look into vanilla classes for this.

ok i have found a tutorial how to do this

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.