Jump to content

How works Enum in newest 1.15.1?


ScarlettSh0

Recommended Posts

I'm not too new and not too old in modding. I remember I saw using Enum for making same tools but with different materials, adn I think it's easier to make one Enum with all COPPER, TIN and etc than adding it manually, but I haven't saw a lot mods for 1.15.1[1.14.4] so is it still working, and maybe you can help me understand it?

Link to comment
Share on other sites

Well, you could use a gray texture for your tool and then color it in the corresponding color of the material you chose with your enum. So you would have to make an enum with a constructor that has a color as an argument. Then you could for each material you have in your enum register all the tools automatically with the texture colored in the color of the material. At least that is how I would do it.

Edited by MartinTheDragon
Link to comment
Share on other sites

4 minutes ago, MartinTheDragon said:

Well, you could use a gray texture for your tool and then color it in the corresponding color of the material you chose with your enum. So you would have to make an enum with a constructor that has a color as an argument. Then you could for each material you have in your enum register all the tools automatically with the texture colored in the color of the material. At least that is how I would do it.

I did something, now learning on code optimization and then I want to add example ore blocks through Enum. An I doing it right? Would be very thankfull if you help
https://github.com/ScarlettShooter/hier/blob/master/src/main/java/com/scrl0/hier/utility/MaterialType.java

Link to comment
Share on other sites

1 minute ago, MartinTheDragon said:

That is a way of doing it, but you would have to set so many parameters for every material you create. And if you just set the durability for the material and not for the tool itself, are you using a multiplier for the tool?

Isn't maxUses that you exactly mean? I used some other's mod sources to understand how it works

Link to comment
Share on other sites

Also, I think I use this theme for questions. What is the best way to store blocks\items to array? I want to try making registration in loop to not spam cause I think it's not the best way to do it(check down). And it's not even item registration or other blocks, only ores...

	e.getRegistry().register(new ModBlocks().tin_ore);
	e.getRegistry().register(new ModBlocks().aluminium_ore);
	e.getRegistry().register(new ModBlocks().silver_ore);
	e.getRegistry().register(new ModBlocks().zinc_ore);
	e.getRegistry().register(new ModBlocks().chrome_ore);
	e.getRegistry().register(new ModBlocks().lead_ore);
	e.getRegistry().register(new ModBlocks().platinum_ore);
	e.getRegistry().register(new ModBlocks().titanium_ore);
	e.getRegistry().register(new ModBlocks().nickel_ore);

 

Link to comment
Share on other sites

3 hours ago, ScarlettSh0 said:

Nope, but trying to speak less shitty. It doesn't work, does it?)

Your English skill sounds pretty good to me.

 

34 minutes ago, ScarlettSh0 said:

Also, I think I use this theme for questions. What is the best way to store blocks\items to array? I want to try making registration in loop to not spam cause I think it's not the best way to do it(check down). And it's not even item registration or other blocks, only ores...


	e.getRegistry().register(new ModBlocks().tin_ore);
	e.getRegistry().register(new ModBlocks().aluminium_ore);
	e.getRegistry().register(new ModBlocks().silver_ore);
	e.getRegistry().register(new ModBlocks().zinc_ore);
	e.getRegistry().register(new ModBlocks().chrome_ore);
	e.getRegistry().register(new ModBlocks().lead_ore);
	e.getRegistry().register(new ModBlocks().platinum_ore);
	e.getRegistry().register(new ModBlocks().titanium_ore);
	e.getRegistry().register(new ModBlocks().nickel_ore);

 

If you are storing all your values in an enum, you can call

YourEnum.values()

to get a collection of all the values, which you could iterate through and initialize the block from. Simply create another list and store the initialized blocks into it during the iteration.

 

I would suggest to post more of your code, preferably as a GitHub repo. This allows other members to give more accurate suggestions on your code.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

10 minutes ago, DavidM said:

Your English skill sounds pretty good to me.

 

If you are storing all your values in an enum, you can call


YourEnum.values()

to get a collection of all the values, which you could iterate through and initialize the block from. Simply create another list and store the initialized blocks into it during the iteration.

 

I would suggest to post more of your code, preferably as a GitHub repo. This allows other members to give more accurate suggestions on your code.

I already droped it, just uploaded a commit cause things changed a little. Also I didn't have moved to enums yet. I want, but I learning deeps now)

https://github.com/ScarlettShooter/hier

I'm in process of making code better, so you can see something that have no use now, I'm working only in ModItems now

Edited by ScarlettSh0
Explanation of so weird code
Link to comment
Share on other sites

This is static so there is no reason to call new here or here.

But you should not be creating your items in a static location (common issues, problematic code #14).

 

The indentation levels in your ModSetup class are broken. What does this } close?

 

All three of these methods are empty.

 

Double cast. You're casting a BlockState to a BlockState and then to a BlockState. Same here.

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

Ough...
I made it. I totally rewrote system to enums. It's amazing and both tiringly experience. But I want to know if it don't broke some features in future so it would be very pleasure if you could check if there is errors. Curently I'm using basic HiER and MaterialType classes, no ModBlocks/Items. Also, I get this in my Creative Tab(check image below). I saw somewhere that is how Forge works Block - Item - Blocks - Item, but maybe not?
 

Spoiler

2019-12-24_23_11_11.thumb.png.f75e5e43b95f7748c4ccb99c00652565.png

Also, in respond I don't know :D I was going through tutorials and there McJTY said it is for future. I want to do all the works with basic blocks and items in right way immediatly so here I am. Also what you said about static and #14 means if I add blocks I shouldn't make them static like "public static Block copper_ore;"? Sorry for that question, I need more practice in English to understand some sentences first time... If it is, the problem is that you actually gets memory for that blocks when you calling proper methods so making those blocks static only use more memory, does it? Anyway, thanks :)

 

2 hours ago, Draco18s said:

This is static so there is no reason to call new here or here.

But you should not be creating your items in a static location (common issues, problematic code #14).

 

The indentation levels in your ModSetup class are broken. What does this } close?

 

All three of these methods are empty.

 

Double cast. You're casting a BlockState to a BlockState and then to a BlockState. Same here.

 

Link to comment
Share on other sites

3 hours ago, ScarlettSh0 said:

I add blocks I shouldn't make them static like "public static Block copper_ore;"? Sorry for that question, I need more practice in English to understand some sentences first time.

The field can be static, that's ok. You just can't call new there. This has to do with SetRegistryName and Forge needing to insure that the correct domain is applied, which is can only do if the constructor is called in a Forge-controlled event. static blocks can get executed at any time.

You should only call new Block() or new Item() in the registry event that registers them and use @ObjectHolder annotations to populate the static field with a value.

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

9 hours ago, Draco18s said:

The field can be static, that's ok. You just can't call new there. This has to do with SetRegistryName and Forge needing to insure that the correct domain is applied, which is can only do if the constructor is called in a Forge-controlled event. static blocks can get executed at any time.

You should only call new Block() or new Item() in the registry event that registers them and use @ObjectHolder annotations to populate the static field with a value.

I think I understand what you mean. When I will be adding new blocks I'll do it like you said. Also do you know why in Tab items like saving theirs position from previos entrance?

 

Also I just did generator way you said(I think, but not sure). In ModBlocks class I have 

@ObjectHolder(MOD_ID + ":generator")
	public static Block generator;

In main class I have
 

/*Block register event*/
	ModBlocks.generator = new Generator("generator", 1, 4, 4);
	e.getRegistry().register(ModBlocks.generator);
/*Item register event*/
	e.getRegistry().register(new BlockItem(ModBlocks.generator, properties).setRegistryName(MOD_ID, "generator"));

Am I doing it right?

Edited by ScarlettSh0
Link to comment
Share on other sites

12 hours ago, ScarlettSh0 said:

ModBlocks.generator = new Generator("generator", 1, 4, 4);

No. @ObjectHolder fields are final. You can't set them directly. Just do this:

 

Even.getRegistry().register(new Generator(...));

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

57 minutes ago, Draco18s said:

No. @ObjectHolder fields are final. You can't set them directly. Just do this:

 

Even.getRegistry().register(new Generator(...));

Hm, okey. So this event "does it" instead of you? Didn't realize that. Seems McJTY tut's are a little bit outdated(or maybe he did that in last episodes which I didn't watched yet). Seems like if I do all work like this, I have no need for ModBlocks class. Thank you very much!

Link to comment
Share on other sites

2 hours ago, ScarlettSh0 said:

So this event "does it" instead of you? Didn't realize that.

Not exactly, but yes, but also no.

 

ObjectHolder fields are populated with values by Forge after the event has called all of the handlers that listen for it. Blocks first (object holders for blocks are populated), then items (object holders for items are populated), then everything else, then all object holders are refreshed.

2 hours ago, ScarlettSh0 said:

Seems McJTY tut's are a little bit outdated

Yes, they are. And he probably won't update his practices, because like so many youtube tutorials before him, they regurgitate the same garbage they learned without seeing if there's a better way.

  • Thanks 1

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

10 hours ago, Draco18s said:

Not exactly, but yes, but also no.

 

ObjectHolder fields are populated with values by Forge after the event has called all of the handlers that listen for it. Blocks first (object holders for blocks are populated), then items (object holders for items are populated), then everything else, then all object holders are refreshed.

Yes, they are. And he probably won't update his practices, because like so many youtube tutorials before him, they regurgitate the same garbage they learned without seeing if there's a better way.

So is there something for what ObjectHolder will be better practice?

Link to comment
Share on other sites

5 hours ago, ScarlettSh0 said:

So is there something for what ObjectHolder will be better practice?

ObjectHolders are what allows for mods to override items with their own version (e.g. "I want to make dirt a falling block" -> register your own block as "minecraft:dirt"). Because of the way Forge populates ObjectHolder fields with values, these replacement actions work even for items and blocks added by any mod.

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

3 hours ago, Draco18s said:

ObjectHolders are what allows for mods to override items with their own version (e.g. "I want to make dirt a falling block" -> register your own block as "minecraft:dirt"). Because of the way Forge populates ObjectHolder fields with values, these replacement actions work even for items and blocks added by any mod.

So it's like forge does with bucket. Thanks again. It's important for me to understand why is it(abstract it, including all) working

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

    • Some zip managers like to take control of the .jar file extension away from Java. Make sure you have Java installed and try running Jarfix once, then try the installer again.
    • [03Jun2024 15:23:40.010] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, LondonDumbden, --version, 1.20.1-forge-47.2.32, --gameDir, C:\Users\London Bunden\AppData\Roaming\.minecraft, --assetsDir, C:\Users\London Bunden\AppData\Roaming\.minecraft\assets, --assetIndex, 5, --uuid, da3510f9b4b4427bb78304c88f4c534a, --accessToken, ????????, --clientId, ZTIxMjA2NTctYmIxZS00ZWQzLWFkZDEtMmMxMGQzMjQyNjBj, --xuid, 2535420262661734, --userType, msa, --versionType, release, --quickPlayPath, C:\Users\London Bunden\AppData\Roaming\.minecraft\quickPlay\java\1717446216838.json, --launchTarget, forgeclient, --fml.forgeVersion, 47.2.32, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [03Jun2024 15:23:40.017] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.8 by Microsoft; OS Windows 11 arch amd64 version 10.0 [03Jun2024 15:23:42.057] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: Loading ImmediateWindowProvider fmlearlywindow [03Jun2024 15:23:42.159] [main/INFO] [EARLYDISPLAY/]: Trying GL version 4.6 [03Jun2024 15:23:42.401] [main/INFO] [EARLYDISPLAY/]: Requested GL version 4.6 got version 4.6 [03Jun2024 15:23:42.494] [main/INFO] [mixin-transmog/]: Mixin Transmogrifier is definitely up to no good... [03Jun2024 15:23:42.524] [main/INFO] [mixin-transmog/]: crimes against java were committed [03Jun2024 15:23:42.630] [pool-2-thread-1/INFO] [EARLYDISPLAY/]: GL info: NVIDIA GeForce RTX 3070/PCIe/SSE2 GL version 4.6.0 NVIDIA 555.85, NVIDIA Corporation [03Jun2024 15:23:43.075] [main/INFO] [gg.essential.loader.stage1.EssentialLoaderBase/]: Starting Essential Loader (stage2) version 1.6.2 (285f951adc7537f49ae3ef9fc0d2fd3e) [stable] [03Jun2024 15:23:43.104] [main/INFO] [mixin-transmog/]: Original mixin transformation service successfully crobbed by mixin-transmogrifier! [03Jun2024 15:23:43.162] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/London%20Bunden/AppData/Roaming/.minecraft/mods/Connector-1.0.0-beta.43+1.20.1.jar%23266%23270!/ Service=ModLauncher Env=CLIENT [03Jun2024 15:23:44.312] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\London Bunden\AppData\Roaming\.minecraft\libraries\net\minecraftforge\fmlcore\1.20.1-47.2.32\fmlcore-1.20.1-47.2.32.jar is missing mods.toml file [03Jun2024 15:23:44.317] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\London Bunden\AppData\Roaming\.minecraft\libraries\net\minecraftforge\javafmllanguage\1.20.1-47.2.32\javafmllanguage-1.20.1-47.2.32.jar is missing mods.toml file [03Jun2024 15:23:44.323] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\London Bunden\AppData\Roaming\.minecraft\libraries\net\minecraftforge\lowcodelanguage\1.20.1-47.2.32\lowcodelanguage-1.20.1-47.2.32.jar is missing mods.toml file [03Jun2024 15:23:44.329] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\London Bunden\AppData\Roaming\.minecraft\libraries\net\minecraftforge\mclanguage\1.20.1-47.2.32\mclanguage-1.20.1-47.2.32.jar is missing mods.toml file [03Jun2024 15:23:44.862] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File:  and Mod File: . Using Mod File:  [03Jun2024 15:23:44.864] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: curios. Using Mod File: C:\Users\London Bunden\AppData\Roaming\.minecraft\mods\curios-forge-5.9.1+1.20.1.jar [03Jun2024 15:23:44.864] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 75 dependencies adding them to mods collection [03Jun2024 15:23:49.089] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Found Kotlin-containing mod Jar[union:/C:/Users/London%20Bunden/AppData/Roaming/.minecraft/essential/libraries/forge_1.20.1/kotlin-for-forge-4.3.0-slim.jar%23280!/], checking whether we need to upgrade it.. [03Jun2024 15:23:49.091] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Found outdated Kotlin core libs 0.0.0 (we ship 1.9.23) [03Jun2024 15:23:49.092] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Found outdated Kotlin Coroutines libs 0.0.0 (we ship 1.8.0) [03Jun2024 15:23:49.092] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Found outdated Kotlin Serialization libs 0.0.0 (we ship 1.6.3) [03Jun2024 15:23:49.095] [main/INFO] [gg.essential.loader.stage2.util.KFFMerger/]: Generating jar with updated Kotlin at C:\Users\LONDON~1\AppData\Local\Temp\kff-updated-kotlin-14765634657383373807-4.3.0-slim.jar [03Jun2024 15:23:49.974] [main/ERROR] [net.minecraftforge.fml.loading.LanguageLoadingProvider/LOADING]: Missing language kotlinforforge version [3,) wanted by Cobblemon-forge-1.5.2+1.20.1.jar [03Jun2024 15:23:49.989] [main/ERROR] [net.minecraftforge.fml.loading.ModSorter/LOADING]: Missing or unsupported mandatory dependencies:     Mod ID: 'curios', Requested by: 'radiantgear', Expected range: '[7,)', Actual version: '5.9.1+1.20.1'     Mod ID: 'minecraft', Requested by: 'radiantgear', Expected range: '[1.20.5,1.21)', Actual version: '1.20.1'     Mod ID: 'forge', Requested by: 'radiantgear', Expected range: '[50,)', Actual version: '47.2.32' [03Jun2024 15:23:50.434] [main/INFO] [dev.su5ed.sinytra.connector.service.hacks.ModuleLayerMigrator/]: Successfully made module authlib transformable [03Jun2024 15:23:51.112] [main/ERROR] [dev.su5ed.sinytra.connector.loader.ConnectorEarlyLoader/]: Skipping early mod setup due to previous error [03Jun2024 15:23:51.115] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'forgeclient' with arguments [--version, 1.20.1-forge-47.2.32, --gameDir, C:\Users\London Bunden\AppData\Roaming\.minecraft, --assetsDir, C:\Users\London Bunden\AppData\Roaming\.minecraft\assets, --uuid, da3510f9b4b4427bb78304c88f4c534a, --username, LondonDumbden, --assetIndex, 5, --accessToken, ????????, --clientId, ZTIxMjA2NTctYmIxZS00ZWQzLWFkZDEtMmMxMGQzMjQyNjBj, --xuid, 2535420262661734, --userType, msa, --versionType, release, --quickPlayPath, C:\Users\London Bunden\AppData\Roaming\.minecraft\quickPlay\java\1717446216838.json]  
    • When I try to install the forge installer it comes with several files instead of just one in executable java format
    • 0 I have recently started with Java and the implementation of Minecraft mods. I am currently working on a mod for 1.20.4-49.0.31 I'm trying to get the content of each slot in the console to be displayed when the inventory is opened, which works. In addition, I wanted to do the same with chests (in this case containers). However, I get in the output that there is Air at every slot of the chest, even if the chest is filled. Does anyone have experience with similar problems and could help me? package net.kaan.sortingmod; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.InventoryScreen; import net.minecraft.client.gui.screens.inventory.ContainerScreen; import net.minecraft.client.gui.screens.inventory.FurnaceScreen; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ScreenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @Mod(SortingMod.MODID) public class SortingMod { public static final String MODID = "sortingmod"; public SortingMod() { // Register the client setup method FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register this class for Forge events MinecraftForge.EVENT_BUS.register(this); } private void doClientStuff(final FMLClientSetupEvent event) { // Any client-side setup can be done here } @SubscribeEvent public void onScreenOpen(ScreenEvent.Opening event) { Screen screen = event.getScreen(); if (screen instanceof InventoryScreen) { System.out.println("Player opened their inventory."); assert Minecraft.getInstance().player != null; printInventoryItems(Minecraft.getInstance().player); } else if (screen instanceof ContainerScreen) { System.out.println("Player opened a chest."); printContainerItems((ContainerScreen) screen); } } private void printInventoryItems(Player player) { AbstractContainerMenu menu = player.inventoryMenu; for (int i = 0; i < menu.slots.size(); i++) { ItemStack stack = menu.getSlot(i).getItem(); if (!stack.isEmpty()) { System.out.println("Slot " + i + ": " + stack.getCount() + "x " + stack.getHoverName().getString()); } } } private void printContainerItems(ContainerScreen screen) { AbstractContainerMenu menu = screen.getMenu(); System.out.println(menu.slots.size()); for (int i = 0; i < menu.slots.size(); i++) { ItemStack stack = menu.getSlot(i).getItem(); System.out.println("Slot " + i + ": " + stack.getCount() + "x " + stack.getHoverName().getString()); } } }  
    • I am wanting to add an axe to my mod though I do not want it to have a recipe, the reason for this being that I want you to only be able to find it in a structure. I have looked on both here and elsewhere on the internet and have found nothing... How would this be done?    (Video for reference.)    
  • Topics

×
×
  • Create New...

Important Information

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