Jump to content

Custom RecipeBookType cause game to crash


Recommended Posts

I tried creating my own RecipeBookType

 

enum class RecipeBookTypeInit {
    ARMOUR_CRAFTING;

    /** Returns the recipe book type for this container. */
    fun get(): RecipeBookType {
        return RecipeBookType.create(name.lowercase().replace("_", ""))
    }
}

 

But when i run the game click on my custom crafting table gui it crashes and i get an out of bond exception

java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4
	at java.util.EnumMap.get(EnumMap.java:244) ~[?:?] {}
	at net.minecraft.stats.RecipeBookSettings.isOpen(RecipeBookSettings.java:30) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading}
	at net.minecraft.stats.RecipeBook.isOpen(RecipeBook.java:69) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading}
	at net.minecraft.client.gui.screens.recipebook.RecipeBookComponent.isVisibleAccordingToBookData(RecipeBookComponent.java:162) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.recipebook.RecipeBookComponent.tick(RecipeBookComponent.java:240) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at io.github.realyusufismail.armourandtoolsmod.core.blocks.armour.CustomArmourCraftingTableScreen.containerTick(CustomArmourCraftingTableScreen.kt:79) ~[main/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.inventory.AbstractContainerScreen.tick(AbstractContainerScreen.java:631) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.lambda$tick$39(Minecraft.java:1830) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:530) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.tick(Minecraft.java:1829) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1123) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:718) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.3-44.1.0_mapped_parchment_2022.12.18-1.19.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	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.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.3-44.1.0.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:?] {}

In there error it refers to CustomArmourCraftingTableScreen recipeBookComponent. Do i need to create my own?

CustomArmourCraftingTableScreen full code : https://github.com/RealYusufIsmail/Armour-and-Tools-Mod/blob/1.19.3-1.0.0.alpha.5/src/main/kotlin/io/github/realyusufismail/armourandtoolsmod/core/blocks/armour/CustomArmourCraftingTableScreen.kt

 

Link to comment
Share on other sites

You can't create new enum values lazily.

You need to create them as singletons as early as possible so that other code knows it exists.

See for example the RecipeBookSettings contructor. It loops over all known enum values and creates information.

If it doesn't know your enum value exists at that point it won't create one for your enum value and you will get errors like the one you show.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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

    • THE 3 IN 1 SSD CHEMICAL SOLUTIONS +27603214264  AND ACTIVATION POWDER FOR CLEANING OF BLACK NOTES SSD CHEMICAL SOLUTIONS +27603214264 , +27603214264  @ CLEANING BLACK NOTES WITH SSD CHEMICAL SOLUTIONS @BEST SUPPLIERS OF SSD SOLUTIONS IN Qatar +27603214264 ,Ssd chemicals in New York +27603214264 , Limpopo, London, Venezuela, Chile, Sweden, Denmark, Rwanda, Ssd chemicals in Oman +27603214264  ,, Ssd chemicals in Dubai +27603214264 , Ssd chemicals in Poland +27603214264 , New Castle, Namibia, Botswana, Ssd chemicals in Mozambique +27603214264 , South Africa, Limpopo, JORDAN, Turkey, Ssd chemicals in Belgium +27603214264, Ssd chemicals in Saudi Arabia +27603214264 ,Ssd chemicals in Australia+27603214264 , Ssd chemicals in Johannesburg +27603214264 ,Ssd chemicals in Zambia+27603214264 ,Ssd chemicals in Swaziland +27603214264 , Ssd chemicals in Madagascar+27603214264 , Ssd chemicals in Zimbabwe+27603214264 , Lesotho, Uganda, Lebanon, Berhrain USA, Ssd chemicals in California+27603214264, Dallas ,Ssd chemicals in, England, German, Spain, Ssd chemicals in Germany+27603214264 , Austria, Vancouver, Denmark, Hong Kong, China ,, Pretoria, Durban, Australia, Wales, France, Cairo, Namibia, Botswana, Ssd chemicals in China+27603214264 ,Ssd chemicals in Norway +27603214264  , Sweden, Ssd chemicals in Capet own +27603214264, Tanzania, Northern Cape, Ssd chemicals in Canada+27603214264,,Ssd chemicals in Soshanguve+27717507286 ,Ssd chemicals in Pietermaritzburg, Ssd chemicals in Pinetown +27603214264  ,Vaal, Polokwane Pretoria Rand burg Roodepoort, Ssd chemicals in Rustenburg Mitchells Plain  Nelspruit Newcastle Witbank Eastern cape, Free State Gauteng KwaZulu-Natal Limpopo Mpumalanga Do you have black currency in form of Dollars, Pounds or Euros or any other currency? I have the most powerful and Universal cleaning chemical you are looking for. I sell SSD automatic solution, Vetrol paste 0.2A and so many others. I also have a variety of Powders needed when doing the large cleanings such as Activation powder. We specialize in cleaning all types of defaced notes, black notes, anti-breeze bank notes, stamp coated and stained currency. We melt and re-activate frozen chemicals and offer 100% cleaning for bills like dollar, euro, pounds, RANDS and transferring of colors from used note to new white bills. We offer machines for large cleaning and also deliver products to any location desired by buyers. Laboratory staff are available to demonstrate to clients how the work is done. Are you looking for:- call +27603214264 SSD Chemical Solution Chemical Solution for Cleaning Black Money call +27603214264 SSD Chemical Company SSD Chemical Solution for Cleaning Black Money SSD Preserving Company SSD Chemical Solution for Cleaning Black Money Activation Powder S.S.D. Chemical Solution for Cleaning Black notes Active Powder Activation Powder for Cleaning Black Notes Black Money Cleaning Clean Black Money Best SSD Solution Clean Black Notes Cleaning Black Notes Cleaning Black Money PLEASE NOTE: WE ONLY DEAL IN HIGH QUALITY S.S.D. CHEMICALS SOLUTION FOR CLEANING BLACK MONEY We are manufacturers and sellers of all sort of chemicals like SUPER AUTOMATIC SSD SOLUTION Z.W.V.8 MODEL ACTIVATION POWDER AND REACTIVATION POWDER, ANTI AIR POWDER,MERCURY POWDER,AUTOMATED MONEY DEVELOPER MACHINES CONGEAL CHEMICAL MELTING EQUIPMENT, TEMPERATURE CONTROLLERS AND AUTOMATIC CLEANING MACHINE. WE ARE SELLING SSD CHEMICAL SOLUTION FOR CLEANING BLACK MONEY AND POWDER CALL +27603214264  purchase Best SSD Solution Clean Black Notes Dollars WE ALSO SELL CHEMICALS LIKE SSD AUTOMATIC SOLUTION FORM CLEANING BLACK DOLLARS CURRENCIES We clean all black and green money and stamped money Infinity labs pty (since 2000)*: We can help you clean your money, (+27603214264)*, we supply a high quality of the ssd solution with machi*ne and it comes with a full package of instructions and accessories. It is the ultimate anti-*breeze solution used in cleaning defaced currency. It can be referred to as black dollar etc..*. or bank stained currency. PRODUCTS AVAILABLE:* SSD SOLUTION SSD Supreme Solution SSD universal Solution SSD Tourmaline solution SSD SOLUTION PK 58 SSD Topix solution SSD Castro X Oxide solution D6 SSD universal Solution D7 SSD SOLUTION PK 58 SSD MECURY DIOSINE AUTOMATIC SOLUTION SSD NSERVATION, ACTIVATION AND RE-ACTIVATION, PARACIENT POWDER, VECTROL PASTE, ZUTA S4, CASTROX OXIDE AUTOMATED MONEY DEVELOPER MACHINES CONGEAL CHEMICAL MELTING EQUIPMENTS * TEMPERATURE CONTROLLERS Our agent will meet with you in any part of the world. CALL OR WATSUPP US @ +27603214264
    • Hey. I created shield mod like kaupenjoe did on his course but blocking animation doesn't work. Forge 1.20.1. Here's some information: Mod structure image and code: https://ibb.co/z5Y1G26 https://www.online-java.com/crhUHmPoJt
    • i was playing forge modded singleplayer server then i added optifine to mods but it crashed with optifine is there anything to do without deleting optifine  crash report: https://paste.ee/p/Z13LO
    • package com.projectmushroom.lavapotions.item; import java.util.List;   import com.projectmushroom.lavapotions.LavaPotions;   import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.FluidTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.AreaEffectCloud; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemUtils; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult;   public class ReinforcedBottle extends Item { public ReinforcedBottle(Item.Properties p_40648_) { super(p_40648_); }   public InteractionResultHolder<ItemStack> use(Level p_40656_, Player p_40657_, InteractionHand p_40658_) { List<AreaEffectCloud> list = p_40656_.getEntitiesOfClass(AreaEffectCloud.class, p_40657_.getBoundingBox().inflate(2.0D), (p_40650_) -> { return p_40650_ != null && p_40650_.isAlive() && p_40650_.getOwner() instanceof EnderDragon; }); ItemStack itemstack = p_40657_.getItemInHand(p_40658_); if (!list.isEmpty()) { AreaEffectCloud areaeffectcloud = list.get(0); areaeffectcloud.setRadius(areaeffectcloud.getRadius() - 0.5F); p_40656_.playSound((Player)null, p_40657_.getX(), p_40657_.getY(), p_40657_.getZ(), SoundEvents.BOTTLE_FILL_DRAGONBREATH, SoundSource.NEUTRAL, 1.0F, 1.0F); p_40656_.gameEvent(p_40657_, GameEvent.FLUID_PICKUP, p_40657_.blockPosition()); return InteractionResultHolder.sidedSuccess(this.turnBottleIntoItem(itemstack, p_40657_, new ItemStack(Items.DRAGON_BREATH)), p_40656_.isClientSide()); } else { HitResult hitresult = getPlayerPOVHitResult(p_40656_, p_40657_, ClipContext.Fluid.SOURCE_ONLY); if (hitresult.getType() == HitResult.Type.MISS) { return InteractionResultHolder.pass(itemstack); } else { if (hitresult.getType() == HitResult.Type.BLOCK) { BlockPos blockpos = ((BlockHitResult)hitresult).getBlockPos(); if (!p_40656_.mayInteract(p_40657_, blockpos)) { return InteractionResultHolder.pass(itemstack); }   if (p_40656_.getFluidState(blockpos).is(FluidTags.LAVA)) { p_40656_.playSound(p_40657_, p_40657_.getX(), p_40657_.getY(), p_40657_.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F); p_40656_.gameEvent(p_40657_, GameEvent.FLUID_PICKUP, blockpos); return InteractionResultHolder.sidedSuccess(this.turnBottleIntoItem(itemstack, p_40657_,(new ItemStack(LavaPotions.REINFORCED_BOTTLE), .LAVA)), p_40656_.isClientSide()); } } return InteractionResultHolder.pass(itemstack); } } }   protected ItemStack turnBottleIntoItem(ItemStack p_40652_, Player p_40653_, ItemStack p_40654_) { p_40653_.awardStat(Stats.ITEM_USED.get(this)); return ItemUtils.createFilledResult(p_40652_, p_40653_, p_40654_); } }   This is what I have so far, it's pretty much just the waterbottle code but I'm just trying to figure out how to get it to pick up lava rather than water
  • Topics

×
×
  • Create New...

Important Information

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