Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.4] help with container items


Glados1235
 Share

Recommended Posts

hello! I am new to Minecraft modding and I'm modding for 1.16.4 I want to create an item that doesn't get used and takes damage during crafting (like ic2's hammer or cutters)

this is the first mod I'm trying to make to learn and I prefer to learn through examples

here is what I have for the item in question LEGO_MOLD or lego_mold

 

my Item Init class

https://pastebin.com/X6pjkUEi

 

the container item class I think is correct? (followed a tutorial kiiinda know how it works but not really)

https://pastebin.com/Jpwerbgy

 

and the recipe I want to affect

https://pastebin.com/dYPCxdjf

 

I know the container class is what's needed but how do I make the LEGO_MOLD the item it's affecting?

like I said I'm brand new to this and don't know much java so examples would be super helpful!

and it this is in the wrong place please tell me i dont post on forms much thanks!

Edited by Glados1235
forgot the version in the title
Link to comment
Share on other sites

  • Glados1235 changed the title to [1.16.4] help with container items
6 minutes ago, diesieben07 said:

The lego_mold class is never used in the code you posted.

i know its not thats why im asking how do i do that like i said i know its the thing i need to use but how to i apply that lego_mold class to a item like the lego mold item

Link to comment
Share on other sites

41 minutes ago, diesieben07 said:

Do you know basic Java?

sort of i mostly know basic c# or unity code i came here to ask for help as i found barely anything on the topic of the post and i learn through examples as alot of stuff just wont make sense to my brain 

Link to comment
Share on other sites

11 hours ago, diesieben07 said:

Then you should know how to make an instance of a class and how inheritance works...

I don't that is why I'm asking for help here as there are no tutorials or examples anywhere that help with what I'm trying to do I've been trying for a few days now to figure it out and I cant I don't know what I'm supposed to do as no one wants to help

Link to comment
Share on other sites

Line 20 is wrong.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

2 hours ago, Draco18s said:

Line 20 is wrong.

i had a feeling but i don't know how to properly fix it i know there is the .containerItem() function that i can add to the item but no matter what way i try i does not work

Edited by Glados1235
spelling
Link to comment
Share on other sites

Look at line 20 very carefully.
Think about what D7 said in his first reply.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

okay so i sorta got it

i added 

public static final LegoMold legoMold = new LegoMold();

and changed line 20 to

	public static final RegistryObject<Item> LEGO_MOLD = ITEMS.register("lego_mold",
			() -> new Item(new Item.Properties().group(LegoModItemGroup.LEGO_MOD).maxStackSize(1).containerItem(legoMold)));

and now it works but instead of giving me back the mold but damaged it just gives me a air block so i assume i need to tell it what item to give?

Link to comment
Share on other sites

4 hours ago, Glados1235 said:

it just gives me a air block so i assume i need to tell it what item to give?

thats because ItemStack#shrink reduce the count of the Item
and 1 - 1 = 0, and if the item has a number of 0 it is removed (replaced by air)

Link to comment
Share on other sites

8 hours ago, Glados1235 said:

okay so i sorta got it

i added 

public static final LegoMold legoMold = new LegoMold();

and changed line 20 to

	public static final RegistryObject<Item> LEGO_MOLD = ITEMS.register("lego_mold",
			() -> new Item(new Item.Properties().group(LegoModItemGroup.LEGO_MOD).maxStackSize(1).containerItem(legoMold)));

and now it works but instead of giving me back the mold but damaged it just gives me a air block so i assume i need to tell it what item to give?

I don't know why you did this. Your item class was already perfectly fine. You just need to actually use it.

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

    • Hello, Whenever I try to start forge 1.16.5, I get an error saying MVI couldn't load because there's not enough data available. Can anyone help with this? This is the crash text:   ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 12/2/21 5:27 PM Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed     at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:85) [?:?] {re:classloading}     at net.minecraftforge.fml.client.ClientModLoader.completeModLoading(ClientModLoader.java:188) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.lambda$null$1(Minecraft.java:508) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft$$Lambda$4660/1471145035.run(Unknown Source) [?:?] {}     at net.minecraft.util.Util.func_215077_a(Util.java:430) [?:?] {re:classloading,xf:OptiFine:default,re:mixin}     at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:504) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft$$Lambda$4409/1341785997.accept(Unknown Source) [?:?] {}     at net.minecraft.client.gui.ResourceLoadProgressGui.func_230430_a_(ResourceLoadProgressGui.java:172) [?:?] {re:classloading,xf:OptiFine:default}     at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:802) [?:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,xf:OptiFine:default,pl:mixin:APP:mvw.mixins.json:GameRendererMixin,pl:mixin:A}     at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:976) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.16.5-36.2.0.jar:36.2] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$461/27818833.call(Unknown Source) [forge-1.16.5-36.2.0.jar:36.2] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.3.jar:?] {} -- MOD mvw -- Details:     Mod File: mvw-1.7.2.jar     Failure message: MoreVanillaWeapons (mvw) has failed to load correctly         com.electronwill.nightconfig.core.io.ParsingException: Not enough data available     Mod Version: 1.16.X-1.7.2     Mod Issue URL: NOT PROVIDED     Exception message: com.electronwill.nightconfig.core.io.ParsingException: Not enough data available Stacktrace:     at com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ReaderInput.directReadChar(ReaderInput.java:36) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readChar(AbstractInput.java:49) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readCharsUntil(AbstractInput.java:123) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseKey(TableParser.java:166) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseDottedKey(TableParser.java:145) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseNormal(TableParser.java:55) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:44) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:37) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:113) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:219) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:202) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.file.WriteSyncFileConfig.load(WriteSyncFileConfig.java:73) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.file.AutosaveCommentedFileConfig.load(AutosaveCommentedFileConfig.java:85) ~[core-3.6.3.jar:?] {}     at com.mrbelieve.mvw.ModConfig.<init>(ModConfig.java:21) ~[?:1.7.2] {re:classloading}     at com.mrbelieve.Mvw.<init>(Mvw.java:48) ~[?:1.7.2] {re:classloading}     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_51] {}     at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[?:1.8.0_51] {}     at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[?:36.2] {re:classloading}     at net.minecraftforge.fml.javafmlmod.FMLModContainer$$Lambda$3105/1982468278.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModContainer$$Lambda$3189/76306072.run(Unknown Source) ~[?:?] {}     at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1618) ~[?:1.8.0_51] {}     at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1610) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689) ~[?:1.8.0_51] {re:computing_frames}     at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[?:1.8.0_51] {} -- System Details -- Details:     Minecraft Version: 1.16.5     Minecraft Version ID: 1.16.5     Operating System: Windows 10 (amd64) version 10.0     Java Version: 1.8.0_51, Oracle Corporation     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation     Memory: 1351327720 bytes (1288 MB) / 2147483648 bytes (2048 MB) up to 2147483648 bytes (2048 MB)     CPUs: 8     JVM Flags: 10 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -XX:+IgnoreUnrecognizedVMOptions -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     ModLauncher: 8.0.9+86+master.3cf110c     ModLauncher launch target: fmlclient     ModLauncher naming: srg     ModLauncher services:          /mixin-0.8.2.jar mixin PLUGINSERVICE          /eventbus-4.0.0.jar eventbus PLUGINSERVICE          /forge-1.16.5-36.2.0.jar object_holder_definalize PLUGINSERVICE          /forge-1.16.5-36.2.0.jar runtime_enum_extender PLUGINSERVICE          /accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE          /forge-1.16.5-36.2.0.jar capability_inject_definalize PLUGINSERVICE          /forge-1.16.5-36.2.0.jar runtimedistcleaner PLUGINSERVICE          /mixin-0.8.2.jar mixin TRANSFORMATIONSERVICE          /OptiFine_1.16.5_HD_U_G7.jar OptiFine TRANSFORMATIONSERVICE          /forge-1.16.5-36.2.0.jar fml TRANSFORMATIONSERVICE      FML: 36.2     Forge: net.minecraftforge:36.2.0     FML Language Providers:          javafml@36.2         minecraft@1     Mod List:          forge-1.16.5-36.2.0-client.jar                    |Minecraft                     |minecraft                     |1.16.5              |CREATE_REG|Manifest: NOSIGNATURE         BetterDungeons-1.16.4-1.2.1.jar                   |YUNG's Better Dungeons        |betterdungeons                |1.16.4-1.2.1        |CREATE_REG|Manifest: NOSIGNATURE         BiomesOPlenty-1.16.5-13.1.0.481-universal.jar     |Biomes O' Plenty              |biomesoplenty                 |1.16.5-13.1.0.481   |CREATE_REG|Manifest: NOSIGNATURE         1.16.5-enchantedgoldenapplecrafting-1.0.jar       |Enchanted Golden Apple Craftin|enchantedgoldenapplecrafting  |1.0                 |CREATE_REG|Manifest: NOSIGNATURE         Weeping-Angels-1.16.x-2.1.6.jar                   |Weeping Angels                |weeping_angels                |2.1.6               |CREATE_REG|Manifest: NOSIGNATURE         dungeons_plus-1.16.5-1.1.5.jar                    |Dungeons Plus                 |dungeons_plus                 |1.1.5               |CREATE_REG|Manifest: NOSIGNATURE         Creative Core.jar                                 |CreativeCore                  |creativecore                  |2.0.0               |CREATE_REG|Manifest: NOSIGNATURE         Tree Harvester.jar                                |Tree Harvester                |treeharvester                 |2.4                 |CREATE_REG|Manifest: NOSIGNATURE         Just Enough Items.jar                             |Just Enough Items             |jei                           |7.7.0.106           |CREATE_REG|Manifest: NOSIGNATURE         villagespawnpoint_1.16.5-1.8.jar                  |Village Spawn Point           |villagespawnpoint             |1.8                 |CREATE_REG|Manifest: NOSIGNATURE         Toro Health Bar.jar                               |ToroHealth                    |torohealth                    |NONE                |CREATE_REG|Manifest: NOSIGNATURE         SpartanShields-1.16.5-2.1.2.jar                   |Spartan Shields               |spartanshields                |2.1.2               |CREATE_REG|Manifest: NOSIGNATURE         Waystones.jar                                     |Waystones                     |waystones                     |7.4.0               |CREATE_REG|Manifest: NOSIGNATURE         collective-1.16.5-3.0.jar                         |Collective                    |collective                    |3.0                 |CREATE_REG|Manifest: NOSIGNATURE         journeymap-1.16.5-5.7.3.jar                       |Journeymap                    |journeymap                    |5.7.3               |CREATE_REG|Manifest: NOSIGNATURE         citadel-1.8.1-1.16.5.jar                          |Citadel                       |citadel                       |1.8.1               |CREATE_REG|Manifest: NOSIGNATURE         alexsmobs-1.12.1.jar                              |Alex's Mobs                   |alexsmobs                     |1.12.1              |CREATE_REG|Manifest: NOSIGNATURE         TravelersBackpack-1.16.5-5.4.2.jar                |Traveler's Backpack           |travelersbackpack             |5.4.2               |CREATE_REG|Manifest: NOSIGNATURE         YungsApi-1.16.4-Forge-13.jar                      |YUNG's API                    |yungsapi                      |1.16.4-Forge-13     |CREATE_REG|Manifest: NOSIGNATURE         InventoryHud_[1.16.2-1.16.5].forge-3.4.1.jar      |Inventory HUD+(Forge edition) |inventoryhud                  |3.4.1               |CREATE_REG|Manifest: NOSIGNATURE         DungeonCrawl-1.16.5-2.3.2.jar                     |Dungeon Crawl                 |dungeoncrawl                  |2.3.2               |CREATE_REG|Manifest: NOSIGNATURE         iceandfire-2.1.9-1.16.5.jar                       |Ice and Fire                  |iceandfire                    |2.1.9-1.16.5        |CREATE_REG|Manifest: NOSIGNATURE         mvw-1.7.2.jar                                     |MoreVanillaWeapons            |mvw                           |1.16.X-1.7.2        |ERROR     |Manifest: NOSIGNATURE         Item Physic.jar                                   |ItemPhysic                    |itemphysic                    |1.6.0               |CREATE_REG|Manifest: NOSIGNATURE         forge-1.16.5-36.2.0-universal.jar                 |Forge                         |forge                         |36.2.0              |CREATE_REG|Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90         Disenchanting-forge-1.16.5-1.7.2.jar              |Disenchanting                 |disenchanting                 |1.6.0               |CREATE_REG|Manifest: NOSIGNATURE         BetterMineshafts-Forge-1.16.4-2.0.4.jar           |YUNG's Better Mineshafts      |bettermineshafts              |1.16.4-2.0.4        |CREATE_REG|Manifest: NOSIGNATURE         DynamicSurroundings-1.16.4-4.0.4.2 (1).jar        |§3Dynamic Surroundings        |dsurround                     |1.16.4-4.0.4.2      |CREATE_REG|Manifest: b4:98:14:b9:76:55:25:4f:e5:5f:4d:71:90:87:43:5b:f9:d5:3a:02:60:42:5e:da:1f:15:9c:ff:be:a9:7c:77         structure_gel-1.16.5-1.7.8.jar                    |Structure Gel API             |structure_gel                 |1.7.8               |CREATE_REG|Manifest: NOSIGNATURE         corpse-1.16.5-1.0.5.jar                           |Corpse                        |corpse                        |1.16.5-1.0.5        |CREATE_REG|Manifest: NOSIGNATURE     Crash Report UUID: cdcb879d-5dae-4e29-88ad-a4ace45db323     OptiFine Version: OptiFine_1.16.5_HD_U_G7     OptiFine Build: 20210305-003221     Render Distance Chunks: 12     Mipmaps: 4     Anisotropic Filtering: 1     Antialiasing: 0     Multitexture: false     Shaders: null     OpenGlVersion: 4.6.0 - Build 30.0.100.9955     OpenGlRenderer: Intel(R) Iris(R) Xe Graphics     OpenGlVendor: Intel     CpuCount: 8
    • Yeah its a question sorry for phrasing it weird, currently everytime I restart the server the mobs .mobLevel is being reset because it isn't saving. Im trying to decipher why this is happening and how to make it so that the .mobLevel for all the mobs in the server persists after a server restart
    • Yeah sorry I installed Java 17 I just checked a minut ago :D.   So, I deleted everything about Forge in my .minecraft folder, then I executed the jarfix.exe that I downloaded previously and THEN I installed the 1.18 Forge Client and now it works !
    • I have been trying to update my MC Forge 1.16.5 from 36.2.0 to 36.2.19. The folder with the JSON. file is in my .minecraft\versions folder, but when I try to edit my installation in the Minecraft launcher it only shows 36.2.0. I've tried opening and closing the launcher multiple times and reinstalling forge multiple times. I haven't updated to the Microsoft Store launcher, I'm using the one before that. I used a .bat file to open the jar to install Forge, in case that's a problem.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.