Jump to content

Error creating custom bow animation... (1.18.1)


Brun0_MF

Recommended Posts

Hi, I'm new in this area and when I decided to create a custom bow I got a null item error, which after some tests I found was from "ModItems.BWBOW.get()".
Someone can help me?

My minecraft version is 1.18.1

Devmod.java (Main):

package com.brunomf.devmod;

import com.brunomf.devmod.blocks.ModBlocks;
import com.brunomf.devmod.item.ModItems;

import com.brunomf.devmod.util.ModItemProperties;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;


// The value here should match an entry in the META-INF/mods.toml file
@Mod("devmod")
public class DevMod
{
    public static String MOD_ID = "devmod";



    public DevMod() {

        IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();

        //Registar Items
        ModItems.register(eventBus);

        //Registar Blocos
        ModBlocks.register(eventBus);


        ModItemProperties.makeBow(ModItems.BWBOW.get()); //Error here!


        // Register ourselves for server and other game events we are interested in
        MinecraftForge.EVENT_BUS.register(this);


    }

}

 

ModItems.java

package com.brunomf.devmod.item;

import com.brunomf.devmod.DevMod;

import com.brunomf.devmod.item.custom.bwbow;
import com.brunomf.devmod.item.custom.bwfirestarter;
import com.brunomf.devmod.util.ModItemProperties;
import net.minecraft.world.item.Item;

import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;



public class ModItems {

    //  Criar DefferedRegister
    public static final DeferredRegister<Item> ITEMS =
            DeferredRegister.create(ForgeRegistries.ITEMS, DevMod.MOD_ID);

    //  Adicionar Registo
    public static void register(IEventBus eventBus){
        ITEMS.register(eventBus);
    }


    //  Items
    //      Criar novo item
    //      BW
    public static final RegistryObject<Item> BW = ITEMS.register("bw",()-> new Item(new Item.Properties().tab(ModItemGroup.DEVMOD)));

    //      BWfirestarter
    public static final RegistryObject<Item> BWFIRESTARTER = ITEMS.register("bwfirestarter",()-> new bwfirestarter(new Item.Properties().tab(ModItemGroup.DEVMOD)
            .durability(100)));

    public static final RegistryObject<Item> BWBOW = ITEMS.register("bwbow",()-> new bwbow(new Item.Properties().tab(ModItemGroup.DEVMOD)
            .durability(300)));


}

 

ModItemProperties.java

package com.brunomf.devmod.util;

import com.brunomf.devmod.item.ModItems;
import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;

public class ModItemProperties {


        public static void makeBow(Item item) {


            ItemProperties.register(ModItems.BWBOW.get(), new ResourceLocation("pull"), (p_174620_, p_174621_, p_174622_, p_174623_) -> {
                if (p_174622_ == null) {
                    return 0.0F;
                } else {
                    return (float)(p_174620_.getUseDuration() - p_174622_.getUseItemRemainingTicks()) / 20.0F;
                }
            });
            ItemProperties.register(ModItems.BWBOW.get(), new ResourceLocation("pulling"), (p_174615_, p_174616_, p_174617_, p_174618_) -> {
                return p_174617_ != null && p_174617_.isUsingItem() && p_174617_.getUseItem() == p_174615_ ? 1.0F : 0.0F;
            });

        }
}

 

bwbow.java

package com.brunomf.devmod.item.custom;

import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.*;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.Level;

import java.util.function.Predicate;

public class bwbow extends ProjectileWeaponItem{
    public static final int MAX_DRAW_DURATION = 20;
    public static final int DEFAULT_RANGE = 50;

    public bwbow(Properties p_43009_) {
        super(p_43009_);
    }


    public void releaseUsing(ItemStack p_40667_, Level p_40668_, LivingEntity p_40669_, int p_40670_) {
        if (p_40669_ instanceof Player) {
            Player player = (Player)p_40669_;
            boolean flag = player.getAbilities().instabuild;
            ItemStack itemstack = player.getProjectile(p_40667_);

            int i = this.getUseDuration(p_40667_) - p_40670_;
            i = net.minecraftforge.event.ForgeEventFactory.onArrowLoose(p_40667_, p_40668_, player, i, !itemstack.isEmpty() || flag);
            if (i < 0) return;

            if (!itemstack.isEmpty() || flag) {
                if (itemstack.isEmpty()) {
                    itemstack = new ItemStack(Items.ARROW);
                }

                float f = getPowerForTime(i);
                if (!((double)f < 0.1D)) {
                    f++;
                    boolean flag1 = player.getAbilities().instabuild || (itemstack.getItem() instanceof ArrowItem && ((ArrowItem)itemstack.getItem()).isInfinite(itemstack, p_40667_, player));
                    if (!p_40668_.isClientSide) {
                        ArrowItem arrowitem = (ArrowItem)(itemstack.getItem() instanceof ArrowItem ? itemstack.getItem() : Items.ARROW);
                        AbstractArrow abstractarrow = arrowitem.createArrow(p_40668_, itemstack, player);
                        abstractarrow = customArrow(abstractarrow);
                        abstractarrow.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, f * 3.0F, 1.0F);
                        if (f >= 1.0F) {
                            abstractarrow.setCritArrow(false);
                            abstractarrow.setKnockback(2);
                            abstractarrow.setPierceLevel((byte) 1);
                            abstractarrow.setBaseDamage(20);
                        }

                        p_40667_.hurtAndBreak(1, player, (p_40665_) -> {
                            p_40665_.broadcastBreakEvent(player.getUsedItemHand());
                        });


                        p_40668_.addFreshEntity(abstractarrow);
                    }

                    p_40668_.playSound((Player)null, player.getX(), player.getY(), player.getZ(), SoundEvents.ANVIL_HIT, SoundSource.PLAYERS, 1.0F, 1.0F / (p_40668_.getRandom().nextFloat() * 0.4F + 1.2F) + f * 0.5F);
                    if (!flag1 && !player.getAbilities().instabuild) {
                        itemstack.shrink(1);
                        if (itemstack.isEmpty()) {
                            player.getInventory().removeItem(itemstack);
                        }
                    }

                    player.awardStat(Stats.ITEM_USED.get(this));
                }
            }
        }
    }

    public static float getPowerForTime(int p_40662_) {
        float f = (float)p_40662_ / 20.0F;
        f = (f * f + f * 2.0F) / 3.0F;
        if (f > 1.0F) {
            f = 1.0F;
        }else{
            f=0.0F;
        }

        return f;
    }

    public int getUseDuration(ItemStack p_40680_) {
        return 72000;
    }

    public UseAnim getUseAnimation(ItemStack p_40678_) {
        return UseAnim.BOW;
    }

    public InteractionResultHolder<ItemStack> use(Level p_40672_, Player p_40673_, InteractionHand p_40674_) {
        ItemStack itemstack = p_40673_.getItemInHand(p_40674_);
        boolean flag = !p_40673_.getProjectile(itemstack).isEmpty();

        InteractionResultHolder<ItemStack> ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemstack, p_40672_, p_40673_, p_40674_, flag);
        if (ret != null) return ret;

        if (!p_40673_.getAbilities().instabuild && !flag) {
            return InteractionResultHolder.fail(itemstack);
        } else {
            p_40673_.startUsingItem(p_40674_);
            return InteractionResultHolder.consume(itemstack);
        }
    }

    public Predicate<ItemStack> getAllSupportedProjectiles() {
        return ARROW_ONLY;
    }

    public AbstractArrow customArrow(AbstractArrow arrow) {
        return arrow;
    }

    public int getDefaultProjectileRange() {
        return 50;
    }
}

 

Crash File:

---- Minecraft Crash Report ----
// Who set us up the TNT?

Time: 23/12/21, 16:30
Description: Mod loading error has occurred

java.lang.Exception: Mod Loading has failed
	at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:69) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2376%2382!:?] {re:classloading}
	at net.minecraftforge.client.loading.ClientModLoader.completeModLoading(ClientModLoader.java:183) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2376%2382!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.lambda$new$1(Minecraft.java:553) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.Util.ifElse(Util.java:409) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!:?] {re:classloading}
	at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:547) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.LoadingOverlay.render(LoadingOverlay.java:135) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:875) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1040) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!:?] {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:38) ~[fmlloader-1.18.1-39.0.5.jar%230!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%2310!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%2310!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%2310!:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%2310!:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%2310!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%2310!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%2310!:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
-- MOD devmod --
Details:
	Caused by 0: java.lang.reflect.InvocationTargetException
		at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?] {}
		at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?] {}
		at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?] {}
		at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] {}
		at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?] {}
		at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.5.jar%2378!:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.5.jar%2380!:?] {}
		at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {}
		at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {}
		at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}
		at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}
		at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {}
		at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {}
		at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {}

	Mod File: main
	Failure message: Dev Mod (devmod) has failed to load correctly
		java.lang.reflect.InvocationTargetException: null
	Mod Version: 0.0NONE
	Mod Issue URL: NOT PROVIDED
	Exception message: java.lang.NullPointerException: Registry Object not present: devmod:bwbow
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
	at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:116) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2376%2382!:?] {re:classloading}
	at com.brunomf.devmod.DevMod.<init>(DevMod.java:34) ~[%2381!:?] {re:classloading}
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?] {}
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?] {}
	at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?] {}
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.5.jar%2378!:?] {}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.5.jar%2380!:?] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {}
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {}
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {}
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {}


-- System Details --
Details:
	Minecraft Version: 1.18.1
	Minecraft Version ID: 1.18.1
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 17.0.1, Eclipse Adoptium
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium
	Memory: 786690560 bytes (750 MiB) / 2199912448 bytes (2098 MiB) up to 4278190080 bytes (4080 MiB)
	CPUs: 6
	Processor Vendor: GenuineIntel
	Processor Name: Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
	Identifier: Intel64 Family 6 Model 158 Stepping 10
	Microarchitecture: Coffee Lake
	Frequency (GHz): 2,90
	Number of physical packages: 1
	Number of physical CPUs: 6
	Number of logical CPUs: 6
	Graphics card #0 name: NVIDIA GeForce GT 1030
	Graphics card #0 vendor: NVIDIA (0x10de)
	Graphics card #0 VRAM (MB): 2048,00
	Graphics card #0 deviceId: 0x1d01
	Graphics card #0 versionInfo: DriverVersion=27.21.14.5671
	Memory slot #0 capacity (MB): 8192,00
	Memory slot #0 clockSpeed (GHz): 2,67
	Memory slot #0 type: DDR4
	Memory slot #1 capacity (MB): 8192,00
	Memory slot #1 clockSpeed (GHz): 2,67
	Memory slot #1 type: DDR4
	Virtual memory max (MB): 18751,22
	Virtual memory used (MB): 14826,96
	Swap memory total (MB): 2432,00
	Swap memory used (MB): 151,81
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	ModLauncher: 9.0.7+91+master.8569cdf
	ModLauncher launch target: forgeclientuserdev
	ModLauncher naming: mcp
	ModLauncher services: 
		 mixin PLUGINSERVICE 
		 eventbus PLUGINSERVICE 
		 object_holder_definalize PLUGINSERVICE 
		 runtime_enum_extender PLUGINSERVICE 
		 capability_token_subclass PLUGINSERVICE 
		 accesstransformer PLUGINSERVICE 
		 runtimedistcleaner PLUGINSERVICE 
		 mixin TRANSFORMATIONSERVICE 
		 fml TRANSFORMATIONSERVICE 
	FML Language Providers: 
		[email protected]
		javafml@null
	Mod List: 
		forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.|Minecraft                     |minecraft                     |1.18.1              |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
		                                                  |Forge                         |forge                         |39.0.5              |COMMON_SET|Manifest: NOSIGNATURE
		main                                              |Dev Mod                       |devmod                        |0.0NONE             |ERROR     |Manifest: NOSIGNATURE
	Crash Report UUID: bdcb4eef-ffca-4050-99f6-74d10279d0ab
	FML: 39.0
	Forge: net.minecraftforge:39.0.5

latest.log:

[23dez.2021 16:30:06.570] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeclientuserdev, --version, MOD_DEV, --assetIndex, 1.18, --assetsDir, C:\Users\fmbru\.gradle\caches\forge_gradle\assets, --gameDir, ., --fml.forgeVersion, 39.0.5, --fml.mcVersion, 1.18.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20211210.034407]
[23dez.2021 16:30:06.573] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 9.0.7+91+master.8569cdf starting: java version 17.0.1 by Eclipse Adoptium
[23dez.2021 16:30:06.670] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/fmbru/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.5/9d1c0c3a304ae6697ecd477218fa61b850bf57fc/mixin-0.8.5.jar%2327! Service=ModLauncher Env=CLIENT
[23dez.2021 16:30:08.081] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'forgeclientuserdev' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\fmbru\.gradle\caches\forge_gradle\assets, --assetIndex, 1.18]
[16:30:13] [Render thread/WARN]: Assets URL 'union:/C:/Users/fmbru/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.18.1-39.0.5_mapped_official_1.18.1/forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!/assets/.mcassetsroot' uses unexpected schema
[16:30:13] [Render thread/WARN]: Assets URL 'union:/C:/Users/fmbru/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.18.1-39.0.5_mapped_official_1.18.1/forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2377!/data/.mcassetsroot' uses unexpected schema
[23dez.2021 16:30:13.257] [Render thread/INFO] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService/]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[16:30:13] [Render thread/INFO]: Setting user: Dev
[16:30:13] [Render thread/INFO]: Backend library: LWJGL version 3.2.2 SNAPSHOT
[16:30:14] [modloading-worker-0/INFO]: Forge mod loading, version 39.0.5, for MC 1.18.1 with MCP 20211210.034407
[16:30:14] [modloading-worker-0/INFO]: MinecraftForge v39.0.5 Initialized
[23dez.2021 16:30:14.922] [modloading-worker-0/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Failed to create mod instance. ModID: devmod, class com.brunomf.devmod.DevMod
java.lang.reflect.InvocationTargetException: null
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.5.jar%2378!:?]
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.5.jar%2380!:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) [?:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) [?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) [?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) [?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) [?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) [?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) [?:?]
Caused by: java.lang.NullPointerException: Registry Object not present: devmod:bwbow
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?]
	at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:116) ~[forge-1.18.1-39.0.5_mapped_official_1.18.1-recomp.jar%2376%2382!:?]
	at com.brunomf.devmod.DevMod.<init>(DevMod.java:34) ~[%2381!:?]
	... 14 more
[23dez.2021 16:30:15.166] [Render thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event CONSTRUCT, 1 errors found
[23dez.2021 16:30:15.285] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.sound.SoundLoadEvent to a broken mod state
[23dez.2021 16:30:15.478] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ColorHandlerEvent$Block to a broken mod state
[23dez.2021 16:30:15.479] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ColorHandlerEvent$Item to a broken mod state
[23dez.2021 16:30:15.972] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ParticleFactoryRegisterEvent to a broken mod state
[23dez.2021 16:30:16.056] [Render thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded
[23dez.2021 16:30:16.144] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterClientReloadListenersEvent to a broken mod state
[23dez.2021 16:30:16.144] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$RegisterLayerDefinitions to a broken mod state
[23dez.2021 16:30:16.145] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$RegisterRenderers to a broken mod state
[16:30:16] [Render thread/INFO]: Reloading ResourceManager: Default
[23dez.2021 16:30:16.569] [Worker-Main-10/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ModelRegistryEvent to a broken mod state
[23dez.2021 16:30:16.835] [Worker-Main-9/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:16.835] [Worker-Main-6/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:16.835] [Worker-Main-11/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:22.711] [Worker-Main-10/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:23.767] [Worker-Main-10/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:23.775] [Worker-Main-10/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:23.799] [Worker-Main-10/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:23.830] [Worker-Main-10/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:23.839] [Worker-Main-10/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[23dez.2021 16:30:23.850] [Worker-Main-10/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[16:30:24] [Render thread/INFO]: OpenAL initialized on device OpenAL Soft on Altifalantes (Realtek High Definition Audio)
[16:30:24] [Render thread/INFO]: Sound engine started
[16:30:24] [Render thread/INFO]: Created: 1024x512x4 minecraft:textures/atlas/blocks.png-atlas
[23dez.2021 16:30:24.417] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:24] [Render thread/INFO]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas
[23dez.2021 16:30:24.419] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:24] [Render thread/INFO]: Created: 512x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
[23dez.2021 16:30:24.420] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:24] [Render thread/INFO]: Created: 512x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
[23dez.2021 16:30:24.421] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:24] [Render thread/INFO]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
[23dez.2021 16:30:24.424] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:24] [Render thread/INFO]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
[23dez.2021 16:30:24.425] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:24] [Render thread/INFO]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[23dez.2021 16:30:24.425] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[23dez.2021 16:30:24.737] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ModelBakeEvent to a broken mod state
[23dez.2021 16:30:25.036] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$AddLayers to a broken mod state
[23dez.2021 16:30:25.716] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterShadersEvent to a broken mod state
[16:30:25] [Render thread/INFO]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas
[23dez.2021 16:30:25.891] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:25] [Render thread/INFO]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas
[23dez.2021 16:30:25.892] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:25] [Render thread/INFO]: Created: 128x128x0 minecraft:textures/atlas/mob_effects.png-atlas
[23dez.2021 16:30:25.892] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[16:30:26] [Render thread/FATAL]: Preparing crash report with UUID bdcb4eef-ffca-4050-99f6-74d10279d0ab
[16:30:26] [Render thread/FATAL]: Crash report saved to .\crash-reports\crash-2021-12-23_16.30.26-fml.txt
[16:30:26] [Render thread/FATAL]: Preparing crash report with UUID 746fd531-8783-427b-8044-7a78ef20cbfc

The custom bow works, it just doesn't have animation.
The .json files are correct and updated to 1.18.1. The error is on that line of code.

 

 

Link to comment
Share on other sites

public DevMod() {

        IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus();

        //Registar Items
        ModItems.register(eventBus);

        //Registar Blocos
        ModBlocks.register(eventBus);

        ItemProperties.register(ModItems.BWBOW.get(), new ResourceLocation("pull"), (p_174620_, p_174621_, p_174622_, p_174623_) -> {
            if (p_174622_ == null) {
                return 0.0F;
            } else {
                return (float)(p_174620_.getUseDuration() - p_174622_.getUseItemRemainingTicks()) / 20.0F;
            }
        });
        ItemProperties.register(ModItems.BWBOW.get(), new ResourceLocation("pulling"), (p_174615_, p_174616_, p_174617_, p_174618_) -> {
            return p_174617_ != null && p_174617_.isUsingItem() && p_174617_.getUseItem() == p_174615_ ? 1.0F : 0.0F;
        }); 
        //Don't Work


        // Register ourselves for server and other game events we are interested in
        MinecraftForge.EVENT_BUS.register(this);


    }

Something like?

Can you give an example of how it would be correct, because I really don't understand... Sorry.
I changed things, I did it differently, if that's what you say I don't know how to solve it.

 

Link to comment
Share on other sites

  • 2 weeks later...

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • As a seasoned investor, I’ve learned that the financial world can be exciting and treacherous. My experiences with investments have taught me the importance of diligence and thorough research, particularly when dealing with newer and high-risk assets like Bitcoin. Unfortunately, my journey with Bitcoin was marred by a painful lesson in the form of a scam, which I hope to share to help others avoid similar pitfalls. My introduction to Bitcoin investing seemed promising. The allure of high returns and the buzz surrounding cryptocurrency were captivating. I was drawn to several Bitcoin investment platforms that promised substantial profits. These platforms presented themselves with professional websites, attractive promotions, and genuine testimonials. I was led to believe that these sites were reliable and that I was making a sound investment. However, this trust proved to be misplaced. The platform I initially invested in showcased fake success stories and substantial profits to entice investors. They used these fabricated examples to build credibility and persuade new investors like me to commit more funds. Their tactics were sophisticated; they knew exactly how to create an illusion of success and security. I, too, was lured by their promises and gradually invested a considerable amount of money, totaling 68,000 USD.The initial investments went smoothly. My account appeared to grow with impressive returns, and I felt a sense of validation in my investment strategy. But things took a drastic turn when I decided to make a more significant investment, believing that the returns would only get better. Once I deposited a substantial sum, the platform’s behavior changed abruptly. My account was frozen without warning, and I was faced with a barrage of demands for additional payments before I could access my funds or the supposed profits. The situation was both distressing and bewildering. I was met with excuses and obstructions at every turn. It became clear that I was dealing with a fraudulent company that had no intention of honoring its commitments. The realization that I had been deceived was crushing. The emotional and financial toll of the situation was overwhelming. Determined to recover my funds, I reached out to Trust Geeks Hack Expert, a service recommended by a trusted friend who had faced a similar ordeal. My initial skepticism was tempered by desperation and hope. Trust Geeks Hack Expert took immediate action. Their team worked tirelessly to investigate the fraudulent platform and recover my lost funds. Their dedication and expertise were evident throughout the process. In just a few weeks, Trust Geeks Hack Expert managed to successfully retrieve the full amount of 68,000 USD. Their assistance was thorough and professional, and they kept me informed every step of the way. Their efforts not only resulted in the recovery of my funds but also provided me with invaluable insights into how these scams operate. This. This experience has been a harsh lesson in the importance of conducting thorough research before investing in any platform, particularly in the cryptocurrency space. The allure of high returns can be overwhelming, but it’s crucial to approach such investments with caution. Verify the legitimacy of the platform, seek out reviews from reliable sources, and ensure that any investment opportunity has a track record of transparency and reliability. To anyone who finds themselves in a similar predicament, I cannot recommend Trust Geeks Hack Expert  enough. Their professionalism and commitment to recovering my funds were exemplary:: E>mail: trustgeekshackexpert {@} fastservice{.}com -----> Tele>gram : Trustgeekshackexpert, And also  What's>App   + 1-7-1-9-4-9-2-2-6-9-3
    • As a seasoned investor, I’ve learned that the financial world can be exciting and treacherous. My experiences with investments have taught me the importance of diligence and thorough research, particularly when dealing with newer and high-risk assets like Bitcoin. Unfortunately, my journey with Bitcoin was marred by a painful lesson in the form of a scam, which I hope to share to help others avoid similar pitfalls. My introduction to Bitcoin investing seemed promising. The allure of high returns and the buzz surrounding cryptocurrency were captivating. I was drawn to several Bitcoin investment platforms that promised substantial profits. These platforms presented themselves with professional websites, attractive promotions, and genuine testimonials. I was led to believe that these sites were reliable and that I was making a sound investment. However, this trust proved to be misplaced. The platform I initially invested in showcased fake success stories and substantial profits to entice investors. They used these fabricated examples to build credibility and persuade new investors like me to commit more funds. Their tactics were sophisticated; they knew exactly how to create an illusion of success and security. I, too, was lured by their promises and gradually invested a considerable amount of money, totaling 68,000 USD.The initial investments went smoothly. My account appeared to grow with impressive returns, and I felt a sense of validation in my investment strategy. But things took a drastic turn when I decided to make a more significant investment, believing that the returns would only get better. Once I deposited a substantial sum, the platform’s behavior changed abruptly. My account was frozen without warning, and I was faced with a barrage of demands for additional payments before I could access my funds or the supposed profits. The situation was both distressing and bewildering. I was met with excuses and obstructions at every turn. It became clear that I was dealing with a fraudulent company that had no intention of honoring its commitments. The realization that I had been deceived was crushing. The emotional and financial toll of the situation was overwhelming. Determined to recover my funds, I reached out to Trust Geeks Hack Expert, a service recommended by a trusted friend who had faced a similar ordeal. My initial skepticism was tempered by desperation and hope. Trust Geeks Hack Expert took immediate action. Their team worked tirelessly to investigate the fraudulent platform and recover my lost funds. Their dedication and expertise were evident throughout the process. In just a few weeks, Trust Geeks Hack Expert managed to successfully retrieve the full amount of 68,000 USD. Their assistance was thorough and professional, and they kept me informed every step of the way. Their efforts not only resulted in the recovery of my funds but also provided me with invaluable insights into how these scams operate. This. This experience has been a harsh lesson in the importance of conducting thorough research before investing in any platform, particularly in the cryptocurrency space. The allure of high returns can be overwhelming, but it’s crucial to approach such investments with caution. Verify the legitimacy of the platform, seek out reviews from reliable sources, and ensure that any investment opportunity has a track record of transparency and reliability. To anyone who finds themselves in a similar predicament, I cannot recommend Trust Geeks Hack Expert  enough. Their professionalism and commitment to recovering my funds were exemplary:: E>mail: trustgeekshackexpert{@}fastservice{.}com -----> Tele>gram : Trustgeekshackexpert, And also  What's>App   + 1-7-1-9-4-9-2-2-6-9-3
    • I've been playing it for only 1 day and it doesn't want to go into the game anymore. I've tried reinstalling the game and repairing the game files (on curseforge) but it still doesn't work. Whenever i try to click on the Singleplayer icon, it just flickers into the world creation page and flickers back 
    • https://gist.github.com/RealMangoBot/03ce10d60ce10f126dcf2c033c3a4f46  
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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