Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, so basically I try to launch the server to test my mod on a server, but it crashes on starting because of an "AbstractMethodError : null" on my ArmorItems.

I use a DeferredRegister to register my items, and in these I register some ArmorItems :

public static final RegistryObject<ArmorItem> ARGENTITE_HELMET     = items.register("argentite_helmet", () -> new ArmorItem(ModArmorMaterial.ARGENTITE, EquipmentSlotType.HEAD, new Item.Properties().maxStackSize(1).group(ModItemGroups.ARMORS_TAB)));
	public static final RegistryObject<ArmorItem> ARGENTITE_CHESTPLATE = items.register("argentite_chestplate", () -> new ArmorItem(ModArmorMaterial.ARGENTITE, EquipmentSlotType.CHEST, new Item.Properties().maxStackSize(1).group(ModItemGroups.ARMORS_TAB)));
	public static final RegistryObject<ArmorItem> ARGENTITE_LEGGINGS   = items.register("argentite_leggings", () -> new ArmorItem(ModArmorMaterial.ARGENTITE, EquipmentSlotType.LEGS, new Item.Properties().maxStackSize(1).group(ModItemGroups.ARMORS_TAB)));
	public static final RegistryObject<ArmorItem> ARGENTITE_BOOTS      = items.register("argentite_boots", () -> new ArmorItem(ModArmorMaterial.ARGENTITE, EquipmentSlotType.FEET, new Item.Properties().maxStackSize(1).group(ModItemGroups.ARMORS_TAB)));

What is wrong here ? When I launch it on client I don't have any problems at all

 

Edit : The error :

[main/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid alcamod
java.lang.AbstractMethodError: null
	at net.minecraft.item.ArmorItem.<init>(ArmorItem.java:68) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at fr.alcanderia.alcamod.init.ModItems.lambda$static$60(ModItems.java:118) ~[main/:?] {re:classloading}

 

Edited by bibouche_
added error

  • Author

Yepp, I registered it correctly since it works in singleplayer

 

[20:00:09] [main/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: null
	Index: 1
	Listeners:
		0: NORMAL
		1: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@424b29b1 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		2: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@3ad59387 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		3: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@7f10071d handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		4: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@2d0269f3 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		5: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@61b8c853 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		6: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@187cff67 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		7: ASM: net.minecraftforge.registries.DeferredRegister$EventDispatcher@7b9e59e7 handleEvent(Lnet/minecraftforge/event/RegistryEvent$Register;)V
		8: ASM: class fr.alcanderia.alcamod.Alcamod$RegistryEvents onBlocksRegistry(Lnet/minecraftforge/event/RegistryEvent$Register;)V
java.lang.AbstractMethodError
	at net.minecraft.item.ArmorItem.<init>(ArmorItem.java:68)
	at fr.alcanderia.alcamod.init.ModItems.lambda$static$60(ModItems.java:118)
	at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:124)
	at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:200)
	at net.minecraftforge.registries.DeferredRegister.access$000(DeferredRegister.java:61)
	at net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:172)
	at net.minecraftforge.eventbus.ASMEventHandler_0_EventDispatcher_handleEvent_Register.invoke(.dynamic)
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120)
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121)
	at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1640)
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java)
	at net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:56)
	at net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:40)
	at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:243)
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:230)
	at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:196)
	at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:44)
	at net.minecraft.server.Main.main(Main.java:95)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.userdev.FMLUserdevServerLaunchProvider.lambda$launchService$0(FMLUserdevServerLaunchProvider.java:54)
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82)
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105)

[20:00:09] [main/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid alcamod
java.lang.AbstractMethodError: null
	at net.minecraft.item.ArmorItem.<init>(ArmorItem.java:68) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at fr.alcanderia.alcamod.init.ModItems.lambda$static$60(ModItems.java:118) ~[main/:?] {re:classloading}
	at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:124) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:200) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.registries.DeferredRegister.access$000(DeferredRegister.java:61) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:172) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-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.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:36.1] {re:classloading}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1640) ~[?:1.8.0_271] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java) ~[?:1.8.0_271] {}
	at net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:56) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:40) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:243) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:230) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:196) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraftforge.fml.server.ServerModLoader.load(ServerModLoader.java:44) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at net.minecraft.server.Main.main(Main.java:95) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {re:classloading}
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_271] {}
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_271] {}
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_271] {}
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_271] {}
	at net.minecraftforge.userdev.FMLUserdevServerLaunchProvider.lambda$launchService$0(FMLUserdevServerLaunchProvider.java:54) ~[forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.1.32_mapped_snapshot_20210309-1.16.5-recomp.jar:?] {}

 

  • Author
public enum ModArmorMaterial implements IArmorMaterial {
	
	ARGENTITE(Alcamod.ModID + ":argentite", 40, new int[] { 3, 6, 8, 3 }, 12, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3.5F, 0.15F, () -> { return Ingredient.fromItems(ModItems.ARGENTITE_INGOT.get()); }),
	AZURITE(Alcamod.ModID + ":azurite", 45, new int[] { 3, 6, 8, 3 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 3.7F, 0.16F, () -> { return Ingredient.fromItems(ModItems.AZURITE_INGOT.get()); }),
	EMATITE(Alcamod.ModID + ":ematite", 50, new int[] { 3, 6, 8, 3 }, 8, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.0F, 0.17F, () -> { return Ingredient.fromItems(ModItems.EMATITE_INGOT.get()); }),
	BARITE(Alcamod.ModID + ":barite", 60, new int[] { 3, 6, 8, 3 }, 6, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.2F, 0.19F, () -> { return Ingredient.fromItems(ModItems.BARITE_INGOT.get()); }),
	UNPOWERED_NETHER_STAR(Alcamod.ModID + ":unpowered_nether_star", 70, new int[] { 3, 6, 8, 3 }, 6, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 4.0F, 0.21F, () -> { return Ingredient.fromItems(Items.NETHER_STAR.getItem()); }),
	NETHER_STAR(Alcamod.ModID + ":nether_star", 80, new int[] { 3, 6, 8, 3 }, 2, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 5.0F, 0.35F, () -> { return Ingredient.fromItems(ModItems.POWERED_NETHER_STAR.get()); }),
	INVERTED_NETHER_STAR(Alcamod.ModID + ":inverted_nether_star", 100, new int[] { 3, 6, 8, 3 }, 2, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 6.0F, 0.60F, () -> { return Ingredient.fromItems(ModItems.INVERTED_NETHER_STAR.get()); });
	
	
	private static final int[]                MAX_DAMAGE_ARRAY = new int[] { 11, 16, 15, 13 };
	private final        String               name;
	private final        int                  maxDamageFactor;
	private final        int[]                damageReductionAmountArray;
	private final        int                  enchantability;
	private final        SoundEvent           soundEvent;
	private final        float                toughness;
	private final        float                knockBackResistance;
	private final        Supplier<Ingredient> repairMaterial;
	
	ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability, SoundEvent soundEvent, float toughness, float knockbackResistance, Supplier<Ingredient> repairMaterial) {
		this.name                       = name;
		this.maxDamageFactor            = maxDamageFactor;
		this.damageReductionAmountArray = damageReductionAmountArray;
		this.enchantability             = enchantability;
		this.soundEvent                 = soundEvent;
		this.toughness                  = toughness;
		this.repairMaterial             = repairMaterial;
		this.knockBackResistance        = knockbackResistance;
	}
	
	@Override
	public int getDurability(EquipmentSlotType slotIn) {
		return MAX_DAMAGE_ARRAY[slotIn.getIndex()] * this.maxDamageFactor;
	}
	
	@Override
	public int getDamageReductionAmount(EquipmentSlotType slotIn) {
		return this.damageReductionAmountArray[slotIn.getIndex()];
	}
	
	@Override
	public int getEnchantability() {
		return this.enchantability;
	}
	
	@Override
	public SoundEvent getSoundEvent() {
		return this.soundEvent;
	}
	
	@Override
	public Ingredient getRepairMaterial() {
		return this.repairMaterial.get();
	}
	
	@Override
	public String getName() {
		return this.name;
	}
	
	@OnlyIn( Dist.CLIENT )
	@Override
	public float getToughness() {
		return this.toughness;
	}
	
	public float getKnockbackResistance() { return this.knockBackResistance; }
	
	
}

 

  • Author
1 hour ago, diesieben07 said:

Do not use @OnlyIn.

Use @Override when overriding methods.

Oh I didn’t see the OnlyIn, such a stupid thing 😅, thanks got it to work

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.