Jump to content

Realistic inventory mod [1.7.10]


Zivaka

Recommended Posts

Hi guys. I'd like to make modification that change player's inventory (examples you can see on the pictures in the archive https://goo.gl/5VNbmC ) and I need your help.

I will describe the essence of modification.

When you start the game you will have only slots in hot bar and slots for armor. When you put the part of armor to the special slot the additional slots will open. The number of additional slots depends of defence point of that part of armor. So, if you wear set of diamond armor you will have twenty additional slots.

This modification will make more realistic (and hardcore, i think) inventory, because people can't carry many items without clothes.

I'm a beginner in modding and I have many questions.

Some of them are:

1. How can I change the default inventory?

2. How can I dynamically check armor slots and draw right number of slots?

Link to comment
Share on other sites

1. Almost any respectable modder here will NOT download anything from links. You either post GitHub/Pastebin or direct image view.

 

2. I can walk you through what you need, but the task itself is like... 7/10 hard. Also you will NEVER get working code here. Keep that in mind.

 

Things you need to understand - there are:

 

* IExtendedEntityProperties (IEEP) - every entity (including player) is saved to disk using NBT. Inside that NBT is all data about given entity. Now - Forge allows you to extend that data by using IEEP. To create such data you need to create class that implements IEEP and assign it to entity data-map that looks +/- like this Map<KeyToData, IEEPClass>. Then in that IEEP you can store players additional info, in this case - inventory slots.

Note - IEEP can hold ANY data in ANY format - it can be objects, generics or whatever - many people don't see that.

To save data stored in IEEp to NBT you simple save it using load/save methods provided there.

Tutorial: (2nd post)

http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and

 

* Inventory - should implement IInventory, an interface that says "this is inventory". Inventory will hold array of ItemStacks[] and will be assigned to given entity, in this case - player. Stacks of this inventory will be saved inside IEEP mentioned above.

 

* Container - containers are something that pulls data from some IInventory and creates "window" from it. Don't mistake it with Gui. Container exist both on client and server once player opens one. Moving things on client will cause server to receive updates and also move it's elements.

 

* Gui - gui is client-side only and will display actuall stuff to player. This is specific gui that will extend GuiContainer and open mentioned cliet-side container that will communicate with server's one.

Many people fk up their guis - there are two reasons - they either don't know java (most of time) or are too lazy to look into internals.

Now - I don't know about 1.7.10 (don't remember what changed), but you might find this useful: (my last post)

http://www.minecraftforge.net/forum/index.php/topic,31297.0.html

 

* SimpleNetworkWrapper - you can't create anything advanced in MC without using packets - you need them to synchronize data.

Note the facts:

- Sending packet to one player will make only that player know stuff. In case of inventories - you need to know that other player ALSO need to know your inventory - to display it (e.g render armour). Inside packets you need to ship entity.getEntityId() and on client - get entity by id and set it's properties for given client.

Tutorial:

http://www.minecraftforge.net/forum/index.php/topic,20135.0.html

 

Overall - I STRONGLY recommend updating to 1.8 - I can help more and people - leave the damn 1.7.10 behind alredy! It's been half a year.

 

You can expect hours of coding and reading vanilla code, ask any questions, keep in mind notes above.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

In addition to what Ernio said. To intercept the normal inventory you'd probably need to handle the GuiOpenEvent and open your GUI and cancel the default one.

 

Also, you have to consider the behavior whenever you run over stuff on the ground, or any other time stuff is automatically moved to the inventory. You'll have to handle all those cases (also probably with events) to move them into your special inventory.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, I am experiencing the following error once an hour and sometimes two hours, does anyone know what might cause the crash? Is it a mod that is causing it or is there a mod that can fix that? Server Forge version: 1.20.1 Forge: net.minecraftforge:47.2.20   JVM Flags: 24 total; -Xms128M -Xmx16384M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 Mods: - fightorflight-forge-0.5.3.jar - BadMobs-1.20.1-19.0.2.jar - netherportalfix-forge-1.20-13.0.1.jar - NoChatReports-FORGE-1.20.1-v2.2.2.jar - architectury-9.1.13-forge.jar - accelerated-decay-forge-3.0.1+mc1.20.1.jar - ferritecore-6.0.1-forge.jar - balm-forge-1.20.1-7.2.1.jar - Terralith_1.20.4_v2.4.11.jar - memoryleakfix-forge-1.17+-1.1.5.jar - cloth-config-forge-11.1.106.jar - kffmod-4.10.0.jar - Cobblemon-forge-1.4.1+1.20.1.jar Error: https://pastebin.com/XKNM1Ak5 Stacktrace: https://pastebin.com/GESmmB4s  
    • Merging Minecraft modpacks is simpler than it sounds. Just think of it as combining ingredients from two recipes into one. If you're not sure how to start, there's a handy tutorial on YouTube titled "How to combine mods in Curseforge Minecraft" that breaks it down step by step. It's like following a cooking show but for Minecraft mods. And if you need more help, the Reddit's r/feedthebeast are like the community kitchen where everyone shares their cooking tips.
    • String Name: 1 wanderlite_matrix Class Name: class net.minecraft.world.item.ItemStack Mod Name: Clockwork: Create x Valkyrien Skies Registry Name: vs_clockwork:wanderlite_matrix Display Name: Wanderlite Matrix Yes    
    • Tried panorama_screens and some other mod, but it still gives me the same error : https://pastebin.com/CG2hUbcY What is the problem exactly ? Is there a problem with the model of one of the items of Clockwork ?
    • Been having this crash report on a pack I'm running with some friends. No idea what's causing it, was able to replicate this crash by making a new modpack with nothing but mekanism in it https://pastebin.com/RNQLVEP4 Mekanism definitely isn't the problem I've just identified it as having items that create this rendering error below is a further crash report, same error just not mekanism  https://pastebin.com/D05EQW5U Any help would be greatly appreciated
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.