Jump to content

Squander

Members
  • Posts

    89
  • Joined

  • Last visited

Everything posted by Squander

  1. I have a class that implements the IIngameOverlay interface. I wonder how can I get my Capability to display its value on the screen?
  2. Preparing crash report with UUID 79dbfde3-dfbb-4c8f-bf2e-b5cbd224489e [12:20:05] [main/INFO] [STDOUT/]: [net.minecraft.crash.CrashReport:addCategory:223]: Negative index in crash report handler (14/16) [12:20:05] [main/FATAL] [ne.mi.fm.se.ServerModLoader/]: Crash report saved to .\crash-reports\crash-2022-07-22_12.20.05-fml.txt ---- Minecraft Crash Report ---- // There are four lights! Time: 22.07.22 12:20 Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.fml.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:85) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:51) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.server.Main.main(Main.java:95) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292] {} at net.minecraftforge.userdev.FMLUserdevServerLaunchProvider.lambda$launchService$0(FMLUserdevServerLaunchProvider.java:54) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: main Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-launcher.jar:36.2] {} -- MOD alcoholmod -- Details: Mod File: main Failure message: Alcohol Mod (alcoholmod) encountered an error during the load_registries event phase java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screen/Screen for invalid dist DEDICATED_SERVER Mod Version: NONE Mod Issue URL: NOT PROVIDED Exception message: java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screen/Screen for invalid dist DEDICATED_SERVER Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-launcher.jar:36.2] {} at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:85) ~[modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:265) ~[modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:136) ~[modlauncher-8.1.3.jar:?] {re:classloading} at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:98) ~[modlauncher-8.1.3.jar:?] {re:classloading} at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_292] {} at me.squander.alcohol.items.ItemInit.lambda$static$5(ItemInit.java:23) ~[main/:?] {re:classloading} at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:124) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:200) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.DeferredRegister.access$000(DeferredRegister.java:61) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:172) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.eventbus.ASMEventHandler_0_EventDispatcher_handleEvent_Register.invoke(.dynamic) ~[?:?] {} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:36.2] {re:classloading} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1640) ~[?:1.8.0_292] {} at net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:56) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:40) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:249) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:236) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:202) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:44) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.server.Main.main(Main.java:95) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292] {} at net.minecraftforge.userdev.FMLUserdevServerLaunchProvider.lambda$launchService$0(FMLUserdevServerLaunchProvider.java:54) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {} -- 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_292, AdoptOpenJDK Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), AdoptOpenJDK Memory: 587961104 bytes (560 MB) / 969932800 bytes (925 MB) up to 1881145344 bytes (1794 MB) CPUs: 8 JVM Flags: 1 total; -XX:+IgnoreUnrecognizedVMOptions ModLauncher: 8.1.3+8.1.3+main-8.1.x.c94d18ec ModLauncher launch target: fmluserdevserver ModLauncher naming: mcp ModLauncher services: /mixin-0.8.4.jar mixin PLUGINSERVICE /eventbus-4.0.0.jar eventbus PLUGINSERVICE /forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-launcher.jar object_holder_definalize PLUGINSERVICE /forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-launcher.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE /forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-launcher.jar capability_inject_definalize PLUGINSERVICE /forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-launcher.jar runtimedistcleaner PLUGINSERVICE /mixin-0.8.4.jar mixin TRANSFORMATIONSERVICE /forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-launcher.jar fml TRANSFORMATIONSERVICE FML: 36.2 Forge: net.minecraftforge:36.2.34 FML Language Providers: [email protected] minecraft@1 Mod List: client-extra.jar |Minecraft |minecraft |1.16.5 |COMMON_SET|Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f main |Alcohol Mod |alcoholmod |NONE |VALIDATE |Manifest: NOSIGNATURE forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1|Forge |forge |36.2.34 |COMMON_SET|Manifest: NOSIGNATURE Crash Report UUID: 79dbfde3-dfbb-4c8f-bf2e-b5cbd224489e[12:20:05] [main/FATAL] [minecraft/Main]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [ Alcohol Mod (alcoholmod) encountered an error during the load_registries event phase �7java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screen/Screen for invalid dist DEDICATED_SERVER ] at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:269) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:236) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:202) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:44) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.server.Main.main(Main.java:95) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {re:classloading} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_292] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_292] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292] {} at net.minecraftforge.userdev.FMLUserdevServerLaunchProvider.lambda$launchService$0(FMLUserdevServerLaunchProvider.java:54) ~[forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:108) [forge-1.16.5-36.2.34_mapped_parchment_2022.03.06-1.16.5-recomp.jar:?] {} public class RecipeItem extends Item { public static final TranslationTextComponent NAME = new TranslationTextComponent("alcoholmod.recipe_item.title"); public RecipeItem(Properties properties) { super(properties); } @Override public ActionResult<ItemStack> use(World world, PlayerEntity entity, Hand hand) { if(world.isClientSide()){ DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> Minecraft.getInstance().setScreen(new RecipeItemScreen(NAME))); } return ActionResult.sidedSuccess(entity.getItemInHand(hand), world.isClientSide()); } }
  3. How?
  4. Like that private static final UUID BASE_ATTACK_SPEED_UUID = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); private static AttributeModifier atm = new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Tool modifier", 5, AttributeModifier.Operation.ADDITION); @SubscribeEvent public static void onChange(LivingEquipmentChangeEvent event){ if(event.getSlot() == EquipmentSlot.MAINHAND){ ItemStack stack = event.getTo(); if(hasAxeSpeed(stack)){ stack.addAttributeModifier(Attributes.ATTACK_SPEED, atm, EquipmentSlot.MAINHAND); }else{ var am = stack.getItem().getDefaultAttributeModifiers(EquipmentSlot.MAINHAND); am.forEach((attribute, attributeModifier) -> { stack.addAttributeModifier(attribute, attributeModifier, EquipmentSlot.MAINHAND); }); } } }
  5. @SubscribeEvent public static void onChange(LivingEquipmentChangeEvent event){ if(event.getSlot() == EquipmentSlot.MAINHAND){ ItemStack stack = event.getTo(); if(hasAxeSpeed(stack)){ AttributeModifier atm = new AttributeModifier(UUID.randomUUID(), "Tool modifier", 5, AttributeModifier.Operation.ADDITION); stack.addAttributeModifier(Attributes.ATTACK_SPEED, atm, EquipmentSlot.MAINHAND); }else{ var am = stack.getItem().getDefaultAttributeModifiers(EquipmentSlot.MAINHAND); am.forEach((attribute, attributeModifier) -> { stack.addAttributeModifier(attribute, attributeModifier, EquipmentSlot.MAINHAND); }); } } } private static boolean hasAxeSpeed(ItemStack pStack) { return EnchantmentHelper.getItemEnchantmentLevel(ModEnchantments.AXE_SPEED.get(), pStack) > 0; } O kay when I change an attribute the damage attribute disappears when inserting and removing an item from slot the speed attribute duplicates. I don't know what I screwed up
  6. okay but how in some class, event?
  7. I have my class that inherits from the enchantment class, and now I'm wondering how to make this enchant increase its attack speed when applied to an item.
  8. I wonder how to save an entity in nbt, for example: I click on an entity that is deleted and is stored in our item stack or item, when we click on the ground our entity will appear
  9. Oh seriously. I'm an idiot. Thanks
  10. https://github.com/Squander12/test
  11. https://github.com/Squander12/Woodcutting
  12. Well, so much time and it doesn't work, there are no bugs, but when I put the item in the slot, nothing happens
  13. God [18:52:45] [Render thread/WARN] [minecraft/ClientRecipeBook]: Unknown recipe category: anymod:woodcutter/anymod:oak_stairs_from_woodcutter
  14. [18:24:54] [Render thread/WARN] [minecraft/Minecraft]: Failed to load datapacks, can't proceed with server load java.util.concurrent.ExecutionException: java.lang.NullPointerException: Registry Object not present: anymod:woodcutter at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?] {} at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) ~[?:?] {} at net.minecraft.client.Minecraft.makeWorldStem(Minecraft.java:2123) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.doLoadLevel(Minecraft.java:1949) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.lambda$doLoadLevel$36(Minecraft.java:1953) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screens.DatapackLoadFailureScreen.lambda$init$0(DatapackLoadFailureScreen.java:24) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.components.Button.onPress(Button.java:29) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.components.AbstractButton.onClick(AbstractButton.java:17) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.components.AbstractWidget.mouseClicked(AbstractWidget.java:111) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.components.events.ContainerEventHandler.mouseClicked(ContainerEventHandler.java:31) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHandler.lambda$onPress$0(MouseHandler.java:93) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:528) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHandler.onPress(MouseHandler.java:90) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHandler.lambda$setup$4(MouseHandler.java:195) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.MouseHandler.lambda$setup$5(MouseHandler.java:194) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar%2354!/:build 10] {} at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar%2360!/:build 10] {} at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3174) ~[lwjgl-glfw-3.2.2.jar%2354!/:build 10] {} at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:187) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1095) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:668) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {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:24) ~[fmlloader-1.18.2-40.0.51.jar%230!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%2310!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%2310!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%2310!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%2310!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%2310!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%2310!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%2310!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {} Caused by: java.lang.NullPointerException: Registry Object not present: anymod:woodcutter at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {} at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:320) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2375%2381!/:?] {re:classloading,xf:fml:forge:registry_object_binary_compat} at me.squander.anymod.recipe.WoodcutterRecipe.getType(WoodcutterRecipe.java:29) ~[%2380!/:?] {re:classloading} at net.minecraft.world.item.crafting.RecipeManager.apply(RecipeManager.java:72) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading} at net.minecraft.world.item.crafting.RecipeManager.apply(RecipeManager.java:34) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading} at net.minecraft.server.packs.resources.SimplePreparableReloadListener.lambda$reload$1(SimplePreparableReloadListener.java:12) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:65) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:146) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:22) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:116) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:129) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.Minecraft.makeWorldStem(Minecraft.java:2122) ~[forge-1.18.2-40.0.51_mapped_parchment_1.18.1-2022.03.06-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} ... 33 more
  15. In this way? Because I really don't know.
  16. I think I think too much about it.
  17. I wonder whether not to extend it with the SingeItemRecipe class as it is in vanilla and use the access transormer to change the interface which is in the Serializer class which is in the above-mentioned class, which would allow to register the serializer in DeferredRegister.
  18. Only this shows up in the console. public class WoodcutterRecipe implements Recipe<Container> { protected final Ingredient ingredient; protected final ItemStack result; protected final ResourceLocation id; protected final String group; public WoodcutterRecipe(Ingredient ingredient, ItemStack result, ResourceLocation id, String group) { this.ingredient = ingredient; this.result = result; this.id = id; this.group = group; } public RecipeType<?> getType() { return Type.TYPE; } public RecipeSerializer<?> getSerializer() { return Serializer.INSTANCE; } public ResourceLocation getId() { return this.id; } public String getGroup() { return this.group; } public ItemStack getResultItem() { return this.result; } public NonNullList<Ingredient> getIngredients() { NonNullList<Ingredient> nonnulllist = NonNullList.create(); nonnulllist.add(this.ingredient); return nonnulllist; } public boolean canCraftInDimensions(int pWidth, int pHeight) { return true; } @Override public boolean matches(Container pContainer, Level pLevel) { return false; } public ItemStack assemble(Container pInv) { return this.result.copy(); } public static class Type implements RecipeType<WoodcutterRecipe>{ public static final Type TYPE = new Type(); } public static class Serializer implements RecipeSerializer<WoodcutterRecipe> { public static final Serializer INSTANCE = new Serializer(); public static final ResourceLocation ID = new ResourceLocation(AnyMod.MOD_ID, "woodcutter"); public WoodcutterRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) { String s = GsonHelper.getAsString(pJson, "group", ""); Ingredient ingredient; if (GsonHelper.isArrayNode(pJson, "ingredient")) { ingredient = Ingredient.fromJson(GsonHelper.getAsJsonArray(pJson, "ingredient")); } else { ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient")); } String s1 = GsonHelper.getAsString(pJson, "result"); int i = GsonHelper.getAsInt(pJson, "count"); ItemStack itemstack = new ItemStack(Registry.ITEM.get(new ResourceLocation(s1)), i); return new WoodcutterRecipe(ingredient, itemstack, pRecipeId, s); } public WoodcutterRecipe fromNetwork(ResourceLocation pRecipeId, FriendlyByteBuf pBuffer) { String s = pBuffer.readUtf(); Ingredient ingredient = Ingredient.fromNetwork(pBuffer); ItemStack itemstack = pBuffer.readItem(); return new WoodcutterRecipe(ingredient, itemstack, pRecipeId, s); } public void toNetwork(FriendlyByteBuf pBuffer, WoodcutterRecipe pRecipe) { pBuffer.writeUtf(pRecipe.group); pRecipe.ingredient.toNetwork(pBuffer); pBuffer.writeItem(pRecipe.result); } @Override public RecipeSerializer<?> setRegistryName(ResourceLocation name) { return INSTANCE; } @Nullable @Override public ResourceLocation getRegistryName() { return ID; } @Override public Class<RecipeSerializer<?>> getRegistryType() { return Serializer.castClass(RecipeSerializer.class); } @SuppressWarnings("unchecked") private static <G> Class<G> castClass(Class<?> cls) { return (Class<G>)cls; } } } This is what my Recipe Type looks like.
  19. This time I get such a bug and I don't really know where to look for the bug. What class. [18:39:56] [Render thread/WARN] [minecraft/ClientRecipeBook]: Unknown recipe category: [!!!com.mojang.logging.LogUtils$1ToString@41a18b54=>java.lang.NullPointerException:Cannot invoke "Object.toString()" because the return value of "java.util.function.Supplier.get()" is null!!!]/anymod:oak_stairs_from_woodcutter
  20. Okay, after a long time, my custom recipe type works, or at least implicitly, because I don't know how to apply it to my block, I don't know what to overwrite my block to accept my recipe type and not vanilla.
  21. Okay, I made a custom serializer but I don't know how to register RecipeType since it can't be done like in vanilla WoodcutterRecipe public class WoodcutterRecipe implements Recipe<Container> { protected final Ingredient ingredient; protected final ItemStack result; protected final ResourceLocation id; protected final String group; public WoodcutterRecipe(Ingredient ingredient, ItemStack result, ResourceLocation id, String group) { this.ingredient = ingredient; this.result = result; this.id = id; this.group = group; } public RecipeType<?> getType() { return ModRecipeType.WOODCUTTER_RECIPE; } public RecipeSerializer<?> getSerializer() { return ModRecipeType.WOODCUTTER.get(); } public ResourceLocation getId() { return this.id; } public String getGroup() { return this.group; } public ItemStack getResultItem() { return this.result; } public NonNullList<Ingredient> getIngredients() { NonNullList<Ingredient> nonnulllist = NonNullList.create(); nonnulllist.add(this.ingredient); return nonnulllist; } public boolean canCraftInDimensions(int pWidth, int pHeight) { return true; } @Override public boolean matches(Container pContainer, Level pLevel) { return false; } public ItemStack assemble(Container pInv) { return this.result.copy(); } public static class Serializer implements RecipeSerializer<WoodcutterRecipe> { public WoodcutterRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) { String s = GsonHelper.getAsString(pJson, "group", ""); Ingredient ingredient; if (GsonHelper.isArrayNode(pJson, "ingredient")) { ingredient = Ingredient.fromJson(GsonHelper.getAsJsonArray(pJson, "ingredient")); } else { ingredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(pJson, "ingredient")); } String s1 = GsonHelper.getAsString(pJson, "result"); int i = GsonHelper.getAsInt(pJson, "count"); ItemStack itemstack = new ItemStack(Registry.ITEM.get(new ResourceLocation(s1)), i); return new WoodcutterRecipe(ingredient, itemstack, pRecipeId, s); } public WoodcutterRecipe fromNetwork(ResourceLocation pRecipeId, FriendlyByteBuf pBuffer) { String s = pBuffer.readUtf(); Ingredient ingredient = Ingredient.fromNetwork(pBuffer); ItemStack itemstack = pBuffer.readItem(); return new WoodcutterRecipe(ingredient, itemstack, pRecipeId, s); } public void toNetwork(FriendlyByteBuf pBuffer, WoodcutterRecipe pRecipe) { pBuffer.writeUtf(pRecipe.group); pRecipe.ingredient.toNetwork(pBuffer); pBuffer.writeItem(pRecipe.result); } @Override public RecipeSerializer<?> setRegistryName(ResourceLocation name) { return ModRecipeType.WOODCUTTER.get(); } @Nullable @Override public ResourceLocation getRegistryName() { return new ResourceLocation(AnyMod.MOD_ID, "woodcutter"); } @Override public Class<RecipeSerializer<?>> getRegistryType() { return Serializer.castClass(RecipeSerializer.class); } @SuppressWarnings("unchecked") private static <G> Class<G> castClass(Class<?> cls) { return (Class<G>)cls; } } } ModRecipeType public class ModRecipeType { public static final DeferredRegister<RecipeSerializer<?>> SERIALIZER = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, AnyMod.MOD_ID); public static RegistryObject<RecipeSerializer<WoodcutterRecipe>> WOODCUTTER = SERIALIZER.register("woodcutter", WoodcutterRecipe.Serializer::new); public static RecipeType<WoodcutterRecipe> WOODCUTTER_RECIPE = register("woodcutter"); static <T extends Recipe<?>> RecipeType<T> register(final String pIdentifier) { return Registry.register(Registry.RECIPE_TYPE, new ResourceLocation(pIdentifier), new RecipeType<T>() { public String toString() { return pIdentifier; } }); } }
  22. I created a block based on stonecutter and would like to add my own recipe type to it. How do I do that? WoodcutterRecipe public class WoodcutterRecipe extends SingleItemRecipe { public WoodcutterRecipe(ResourceLocation pId, String pGroup, Ingredient pIngredient, ItemStack pResult) { super(ModRecipeType.WOODCUTTER_RECIPE, RecipeSerializer.STONECUTTER, pId, pGroup, pIngredient, pResult); } @Override public boolean matches(Container pContainer, Level pLevel) { return this.ingredient.test(pContainer.getItem(0)); } @Override public ItemStack getToastSymbol() { return new ItemStack(ModBlocks.WOODCUTTER.get()); } } ModRecipeType public class ModRecipeType { public static RecipeType<WoodcutterRecipe> WOODCUTTER_RECIPE = register("woodcutter"); static <T extends Recipe<?>> RecipeType<T> register(final String pIdentifier) { return Registry.register(Registry.RECIPE_TYPE, new ResourceLocation(pIdentifier), new RecipeType<T>() { public String toString() { return pIdentifier; } }); } } WoodcutterMenu public class WoodcutterMenu extends StonecutterMenu { private final ContainerLevelAccess access; public WoodcutterMenu(int id, Inventory inventory) { super(id, inventory); this.access = ContainerLevelAccess.NULL; } public WoodcutterMenu(int id, Inventory inventory, ContainerLevelAccess containerLevelAccess) { super(id, inventory, containerLevelAccess); this.access = containerLevelAccess; } @Override public boolean stillValid(Player pPlayer) { return stillValid(this.access, pPlayer, ModBlocks.WOODCUTTER.get()); } @Override public MenuType<?> getType() { return ModMenuType.WOOD_CUTTER_MENU.get(); } }
  23. @SubscribeEvent public static void offers(VillagerTradesEvent event){ if(event.getType() == VillagerProfession.FLETCHER){ event.getTrades().put(1, Collections.singletonList(new BasicItemListing(32, new ItemStack(ModItems.EXPLOSIVE_ARROW.get()), 3, 5, 0.03f))); } } It works. But for tier one, only my offer is loaded, and vanilla is not. How to fix it?
×
×
  • Create New...

Important Information

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