Jump to content

Realistic inventory mod [1.7.10]


Zivaka
 Share

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
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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried to install client forge on my linux desktop. But after "installation" it's missing forge[version].jar file in .minecraft/versions. I tried java 11 and 8 environment with same result. Here link to log file from installation: https://drive.google.com/file/d/1vtg9NT-WX5ilb1aNUvZlOv54gKWJuaT1/view?usp=share_link. I don't know what to do. I give for every directory permissions that I don't think that is issue. I will try check older versions if universal file work. Debian 11 (kernel 5.10)
    • I recently got error 1 in the launcher, so I restarted the .minecraft. After restarting it, I can't get the Forge 1.19.2 - 43.1.1 installer to run, I tried other versions and I get the same result, it opens a black box that closes instantly and nothing happens. I already tried to restart my pc, minecraft, update and reinstall java, run vanilla 1.19.2 and more recent versions of the game, disable Windows Firewall and antivirus and I still haven't solved it. Many times I installed forge and never ran into this problem. If I could receive assistance I would be very grateful.  
    • Here's the default loot table for gravel block: { "type": "minecraft:block", "pools": [ { "rolls": 1.0, "bonus_rolls": 0.0, "entries": [ { "type": "minecraft:alternatives", "children": [ { "type": "minecraft:item", "conditions": [ { "condition": "minecraft:match_tool", "predicate": { "enchantments": [ { "enchantment": "minecraft:silk_touch", "levels": { "min": 1 } } ] } } ], "name": "minecraft:gravel" }, { "type": "minecraft:alternatives", "conditions": [ { "condition": "minecraft:survives_explosion" } ], "children": [ { "type": "minecraft:item", "conditions": [ { "condition": "minecraft:table_bonus", "enchantment": "minecraft:fortune", "chances": [ 0.1, 0.14285715, 0.25, 1.0 ] } ], "name": "minecraft:flint" }, { "type": "minecraft:item", "name": "minecraft:gravel" } ] } ] } ] } ] } This is a finicky loot table. If I add anything to it, nothing drops. I've added pools, entries, children ... you name it. Does anyone know the particulars about this table? I mean, periodically gravel drops flint instead of a gravel block. I understand the condition that could drop flint if the block survives an explosion. Otherwise, it drops the gravel block itself. I would like to further understand why the use of `children` and the set of `chance` values given in the explosion child entry. What I do understand is that `"type" : "minecraft:alternatives"` means that if this child/entry is successful, then it stops generating loot for this entry/pool. How often does the flint drop and is that taken care of in another location? Is that in a `"condition" : "minecraft:table_bonus"` loot table? Hmmm... I'll have to go take a look and see if there is something called table_bonus.json.
    • No mod is working. Im trying to create a pack for some friends but cant get past this. I reinstalled Forge and I got a complete install pop up like normal   [29Jan2023 14:17:58.884] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, Oddie23110, --version, 1.19.3-forge-44.1.8, --gameDir, C:\Users\Oddie\AppData\Roaming\.minecraft, --assetsDir, C:\Users\Oddie\AppData\Roaming\.minecraft\assets, --assetIndex, 2, --uuid, d7db39d1b1f940ac841852e76fe1844c, --accessToken, ????????, --clientId, M2JmY2FlYTktNzE1OC00NzYwLThlMzUtNGIxYzA1MzcwNTli, --xuid, 2535431288182209, --userType, msa, --versionType, release, --width, 1600, --height, 900, --launchTarget, forgeclient, --fml.forgeVersion, 44.1.8, --fml.mcVersion, 1.19.3, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20221207.122022] [29Jan2023 14:17:58.889] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.3 by Microsoft; OS Windows 10 arch amd64 version 10.0 [29Jan2023 14:17:59.094] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/Oddie/AppData/Roaming/.minecraft/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2392!/ Service=ModLauncher Env=CLIENT [29Jan2023 14:17:59.498] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\Oddie\AppData\Roaming\.minecraft\libraries\net\minecraftforge\fmlcore\1.19.3-44.1.8\fmlcore-1.19.3-44.1.8.jar is missing mods.toml file [29Jan2023 14:17:59.503] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\Oddie\AppData\Roaming\.minecraft\libraries\net\minecraftforge\javafmllanguage\1.19.3-44.1.8\javafmllanguage-1.19.3-44.1.8.jar is missing mods.toml file [29Jan2023 14:17:59.507] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\Oddie\AppData\Roaming\.minecraft\libraries\net\minecraftforge\lowcodelanguage\1.19.3-44.1.8\lowcodelanguage-1.19.3-44.1.8.jar is missing mods.toml file [29Jan2023 14:17:59.513] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\Oddie\AppData\Roaming\.minecraft\libraries\net\minecraftforge\mclanguage\1.19.3-44.1.8\mclanguage-1.19.3-44.1.8.jar is missing mods.toml file [29Jan2023 14:17:59.653] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: flywheel. Using Mod File: C:\Users\Oddie\AppData\Roaming\.minecraft\mods\flywheel-forge-1.19.2-0.6.8.a.jar [29Jan2023 14:17:59.654] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 1 dependencies adding them to mods collection [29Jan2023 14:18:00.624] [main/INFO] [mixin/]: Compatibility level set to JAVA_17 [29Jan2023 14:18:00.629] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'forgeclient' with arguments [--version, 1.19.3-forge-44.1.8, --gameDir, C:\Users\Oddie\AppData\Roaming\.minecraft, --assetsDir, C:\Users\Oddie\AppData\Roaming\.minecraft\assets, --uuid, d7db39d1b1f940ac841852e76fe1844c, --username, Oddie23110, --assetIndex, 2, --accessToken, ????????, --clientId, M2JmY2FlYTktNzE1OC00NzYwLThlMzUtNGIxYzA1MzcwNTli, --xuid, 2535431288182209, --userType, msa, --versionType, release, --width, 1600, --height, 900] [29Jan2023 14:18:00.827] [main/WARN] [mixin/]: Error loading class: net/minecraft/client/renderer/texture/TextureAtlas$Preparations (java.lang.ClassNotFoundException: net.minecraft.client.renderer.texture.TextureAtlas$Preparations) [29Jan2023 14:18:00.827] [main/WARN] [mixin/]: @Mixin target net.minecraft.client.renderer.texture.TextureAtlas$Preparations was not found flywheel.mixins.json:atlas.SheetDataAccessor [29Jan2023 14:18:00.840] [main/WARN] [mixin/]: Error loading class: me/jellysquid/mods/sodium/client/render/chunk/data/ChunkRenderData$Builder (java.lang.ClassNotFoundException: me.jellysquid.mods.sodium.client.render.chunk.data.ChunkRenderData$Builder) [29Jan2023 14:18:00.840] [main/WARN] [mixin/]: @Mixin target me.jellysquid.mods.sodium.client.render.chunk.data.ChunkRenderData$Builder was not found flywheel.mixins.json:instancemanage.SodiumChunkRenderDataMixin [29Jan2023 14:18:00.853] [main/WARN] [mixin/]: Error loading class: com/mojang/math/Matrix3f (java.lang.ClassNotFoundException: com.mojang.math.Matrix3f) [29Jan2023 14:18:00.854] [main/WARN] [mixin/]: @Mixin target com.mojang.math.Matrix3f was not found flywheel.mixins.json:matrix.Matrix3fMixin [29Jan2023 14:18:00.855] [main/WARN] [mixin/]: Error loading class: com/mojang/math/Matrix4f (java.lang.ClassNotFoundException: com.mojang.math.Matrix4f) [29Jan2023 14:18:00.856] [main/WARN] [mixin/]: @Mixin target com.mojang.math.Matrix4f was not found flywheel.mixins.json:matrix.Matrix4fMixin [29Jan2023 14:18:00.974] [main/WARN] [mixin/]: Error loading class: net/minecraft/client/renderer/texture/TextureAtlas$Preparations (java.lang.ClassNotFoundException: net.minecraft.client.renderer.texture.TextureAtlas$Preparations) [29Jan2023 14:18:03.993] [pool-3-thread-1/INFO] [net.minecraft.util.datafix.DataFixers/]: Building unoptimized datafixer [29Jan2023 14:18:05.173] [Render thread/WARN] [mixin/]: Error loading class: com/mojang/math/Quaternion (java.lang.ClassNotFoundException: com.mojang.math.Quaternion) [29Jan2023 14:18:05.175] [Render thread/FATAL] [mixin/]: Mixin apply failed flywheel.mixins.json:matrix.PoseStackMixin -> com.mojang.blaze3d.vertex.PoseStack: org.spongepowered.asm.mixin.transformer.throwables.InvalidMixinException Unexpecteded ClassMetadataNotFoundException whilst transforming the mixin class: [MAIN Applicator Phase -> flywheel.mixins.json:matrix.PoseStackMixin -> Apply Methods -> (Lcom/mojang/math/Quaternion;)Lcom/jozufozu/flywheel/util/transform/TransformStack;:multiply -> Transform LVT -> var=quaternion -> desc=Lcom/mojang/math/Quaternion;] org.spongepowered.asm.mixin.transformer.throwables.InvalidMixinException: Unexpecteded ClassMetadataNotFoundException whilst transforming the mixin class: [MAIN Applicator Phase -> flywheel.mixins.json:matrix.PoseStackMixin -> Apply Methods -> (Lcom/mojang/math/Quaternion;)Lcom/jozufozu/flywheel/util/transform/TransformStack;:multiply -> Transform LVT -> var=quaternion -> desc=Lcom/mojang/math/Quaternion;]     at org.spongepowered.asm.mixin.transformer.MixinTargetContext.transformMethod(MixinTargetContext.java:491) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyNormalMethod(MixinApplicatorStandard.java:532) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMethods(MixinApplicatorStandard.java:518) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:386) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:325) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.TargetClassContext.apply(TargetClassContext.java:383) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:365) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:156) ~[modlauncher-10.0.8.jar:10.0.8+10.0.8+main.0ef7e830]     at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:113) ~[securejarhandler-2.1.6.jar:?]     at cpw.mods.cl.ModuleClassLoader.lambda$findClass$15(ModuleClassLoader.java:219) ~[securejarhandler-2.1.6.jar:?]     at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:229) ~[securejarhandler-2.1.6.jar:?]     at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:219) ~[securejarhandler-2.1.6.jar:?]     at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:135) ~[securejarhandler-2.1.6.jar:?]     at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]     at com.mojang.blaze3d.systems.RenderSystem.<clinit>(RenderSystem.java:83) ~[1.19.3-forge-44.1.8.jar:?]     at net.minecraft.client.main.Main.m_239872_(Main.java:174) ~[1.19.3-forge-44.1.8.jar:?]     at net.minecraft.client.main.Main.main(Main.java:51) ~[1.19.3-forge-44.1.8.jar:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:27) ~[fmlloader-1.19.3-44.1.8.jar:?]     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.8.jar:?]     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] Caused by: org.spongepowered.asm.mixin.throwables.ClassMetadataNotFoundException: com.mojang.math.Quaternion     at org.spongepowered.asm.mixin.transformer.MixinTargetContext.transformSingleDescriptor(MixinTargetContext.java:983) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinTargetContext.transformSingleDescriptor(MixinTargetContext.java:943) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinTargetContext.transformLVT(MixinTargetContext.java:544) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     at org.spongepowered.asm.mixin.transformer.MixinTargetContext.transformMethod(MixinTargetContext.java:450) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4]     ... 36 more  
  • Topics

×
×
  • Create New...

Important Information

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