我的 damageReductionAmmounts 使 Minecraft 崩溃
My damageReductionAmmounts is crashing Minecraft
这是我遇到的错误
[m[1;31m[11:33:51] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: null
Index: 1
Listeners:
0: NORMAL
1: ASM: class com.carbon.main_carbon$RegistryEvents registerItems(Lnet/minecraftforge/event/RegistryEvent$Register;)V
java.lang.NullPointerException
at com.carbon.lists.ArmorMaterialList.getDamageReductionAmount(ArmorMaterialList.java:39)
at net.minecraft.item.ArmorItem.<init>(ArmorItem.java:61)
at com.carbon.main_carbon$RegistryEvents.registerItems(main_carbon.java:95)
at net.minecraftforge.eventbus.ASMEventHandler_0_RegistryEvents_registerItems_Register.invoke(.dynamic)
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106)
at java.util.function.Consumer.lambda$andThen[=10=](Consumer.java:65)
at java.util.function.Consumer.lambda$andThen[=10=](Consumer.java:65)
at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112)
at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent(ModList.java:125)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125)
at net.minecraftforge.fml.ModList.lambda$static(ModList.java:96)
at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71)
at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197)
at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods(ModLoader.java:189)
at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:969)
at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189)
at net.minecraftforge.fml.client.ClientModLoader.lambda$begin(ClientModLoader.java:97)
at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch(ClientModLoader.java:113)
at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97)
at net.minecraft.client.Minecraft.<init>(Minecraft.java:393)
at net.minecraft.client.main.Main.main(Main.java:140)
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.FMLUserdevClientLaunchProvider.lambda$launchService[=10=](FMLUserdevClientLaunchProvider.java:55)
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:81)
at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101)
[m[1;31m[11:33:51] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid carbon_fiber
java.lang.NullPointerException: null
at com.carbon.lists.ArmorMaterialList.getDamageReductionAmount(ArmorMaterialList.java:39) ~[main/:?] {re:classloading}
at net.minecraft.item.ArmorItem.<init>(ArmorItem.java:61) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at com.carbon.main_carbon$RegistryEvents.registerItems(main_carbon.java:95) ~[main/:?] {re:classloading}
at net.minecraftforge.eventbus.ASMEventHandler_0_RegistryEvents_registerItems_Register.invoke(.dynamic) ~[?:?] {}
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:30.0] {re:classloading}
at java.util.function.Consumer.lambda$andThen[=10=](Consumer.java:65) ~[?:1.8.0_231] {}
at java.util.function.Consumer.lambda$andThen[=10=](Consumer.java:65) ~[?:1.8.0_231] {}
at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent(ModList.java:125) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_231] {}
at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModList.lambda$static(ModList.java:96) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods(ModLoader.java:189) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:969) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.client.ClientModLoader.lambda$begin(ClientModLoader.java:97) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch(ClientModLoader.java:113) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.client.Minecraft.<init>(Minecraft.java:393) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at net.minecraft.client.main.Main.main(Main.java:140) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231] {}
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_231] {}
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_231] {}
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_231] {}
at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService[=10=](FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] {}
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] {}
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] {}
at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] {}
at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] {}
at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
[m[36m[11:33:51] [Render thread/DEBUG] [ne.mi.fm.ja.FMLModContainer/LOADING]: Firing event for modid forge : RegistryEvent.Register<minecraft:item>
[m[36m[11:33:51] [Render thread/DEBUG] [ne.mi.fm.ja.FMLModContainer/LOADING]: Fired event for modid forge : RegistryEvent.Register<minecraft:item>
[m[1;31m[11:33:51] [Render thread/FATAL] [ne.mi.fm.ModLoader/LOADING]: Failed to complete lifecycle event LOAD_REGISTRIES, 1 errors found
[m[1;31m[11:33:51] [Render thread/FATAL] [ne.mi.ev.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
这是我的 ArmorMaterialsList class
package com.carbon.lists;
import com.carbon.main_carbon;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
public enum ArmorMaterialList implements IArmorMaterial {
carbon("carbon_helmet", 1000, new int[] {8 ,10 ,9 ,7}, 20, ItemList.carbon_fiber_shard, "entity.magma_cube.jump", 0.0f);
private static final int[] max_damage_array = new int[] {13, 15, 16, 11};
private String name, equipSound;
private int duribility,enchantability;
private int[] damageReductionAmmounts;
private float toughness;
private Item repairItem;
private ArmorMaterialList(String name, int duribility, int[] damageReductionAmmounts, int enchantability, Item repairItem, String equipSound, float toughness) {
}
@Override
public int getDurability(EquipmentSlotType slot) {
return max_damage_array[slot.getIndex()] * this.duribility;
}
@Override
public int getDamageReductionAmount(EquipmentSlotType slot) {
return this.damageReductionAmmounts[slot.getIndex()];
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public SoundEvent getSoundEvent() {
return new SoundEvent(new ResourceLocation(equipSound));
}
@Override
public Ingredient getRepairMaterial() {
return Ingredient.fromItems(this.repairItem);
}
@Override
public String getName() {
return main_carbon.modid + ":" + this.name;
}
@Override
public float getToughness() {
return this.toughness;
}
}
private String name, equipSound;
private int duribility,enchantability;
private int[] damageReductionAmmounts;
private float toughness;
private Item repairItem;
private ArmorMaterialList(String name, int duribility, int[] damageReductionAmmounts, int enchantability, Item repairItem, String equipSound, float toughness) {
}
你有一堆字段,你有一个构造函数接受相应的参数,但你从来没有根据参数设置字段。您需要在构造函数体内执行 this.name = name;
等操作。
这是我遇到的错误
[m[1;31m[11:33:51] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: null
Index: 1
Listeners:
0: NORMAL
1: ASM: class com.carbon.main_carbon$RegistryEvents registerItems(Lnet/minecraftforge/event/RegistryEvent$Register;)V
java.lang.NullPointerException
at com.carbon.lists.ArmorMaterialList.getDamageReductionAmount(ArmorMaterialList.java:39)
at net.minecraft.item.ArmorItem.<init>(ArmorItem.java:61)
at com.carbon.main_carbon$RegistryEvents.registerItems(main_carbon.java:95)
at net.minecraftforge.eventbus.ASMEventHandler_0_RegistryEvents_registerItems_Register.invoke(.dynamic)
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80)
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258)
at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106)
at java.util.function.Consumer.lambda$andThen[=10=](Consumer.java:65)
at java.util.function.Consumer.lambda$andThen[=10=](Consumer.java:65)
at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112)
at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent(ModList.java:125)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125)
at net.minecraftforge.fml.ModList.lambda$static(ModList.java:96)
at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71)
at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197)
at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods(ModLoader.java:189)
at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:969)
at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189)
at net.minecraftforge.fml.client.ClientModLoader.lambda$begin(ClientModLoader.java:97)
at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch(ClientModLoader.java:113)
at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97)
at net.minecraft.client.Minecraft.<init>(Minecraft.java:393)
at net.minecraft.client.main.Main.main(Main.java:140)
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.FMLUserdevClientLaunchProvider.lambda$launchService[=10=](FMLUserdevClientLaunchProvider.java:55)
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:81)
at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101)
[m[1;31m[11:33:51] [Render thread/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Caught exception during event RegistryEvent.Register<minecraft:item> dispatch for modid carbon_fiber
java.lang.NullPointerException: null
at com.carbon.lists.ArmorMaterialList.getDamageReductionAmount(ArmorMaterialList.java:39) ~[main/:?] {re:classloading}
at net.minecraft.item.ArmorItem.<init>(ArmorItem.java:61) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at com.carbon.main_carbon$RegistryEvents.registerItems(main_carbon.java:95) ~[main/:?] {re:classloading}
at net.minecraftforge.eventbus.ASMEventHandler_0_RegistryEvents_registerItems_Register.invoke(.dynamic) ~[?:?] {}
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:80) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
at net.minecraftforge.fml.javafmlmod.FMLModContainer.fireEvent(FMLModContainer.java:106) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:30.0] {re:classloading}
at java.util.function.Consumer.lambda$andThen[=10=](Consumer.java:65) ~[?:1.8.0_231] {}
at java.util.function.Consumer.lambda$andThen[=10=](Consumer.java:65) ~[?:1.8.0_231] {}
at net.minecraftforge.fml.ModContainer.transitionState(ModContainer.java:112) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModList.lambda$dispatchSynchronousEvent(ModList.java:125) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_231] {}
at net.minecraftforge.fml.ModList.dispatchSynchronousEvent(ModList.java:125) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModList.lambda$static(ModList.java:96) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.LifecycleEventProvider.dispatch(LifecycleEventProvider.java:71) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:197) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods(ModLoader.java:189) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:969) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:189) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading}
at net.minecraftforge.fml.client.ClientModLoader.lambda$begin(ClientModLoader.java:97) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch(ClientModLoader.java:113) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:97) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.client.Minecraft.<init>(Minecraft.java:393) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at net.minecraft.client.main.Main.main(Main.java:140) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231] {}
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_231] {}
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_231] {}
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_231] {}
at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService[=10=](FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] {}
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] {}
at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] {}
at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] {}
at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] {}
at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.15.1-30.0.51_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {}
[m[36m[11:33:51] [Render thread/DEBUG] [ne.mi.fm.ja.FMLModContainer/LOADING]: Firing event for modid forge : RegistryEvent.Register<minecraft:item>
[m[36m[11:33:51] [Render thread/DEBUG] [ne.mi.fm.ja.FMLModContainer/LOADING]: Fired event for modid forge : RegistryEvent.Register<minecraft:item>
[m[1;31m[11:33:51] [Render thread/FATAL] [ne.mi.fm.ModLoader/LOADING]: Failed to complete lifecycle event LOAD_REGISTRIES, 1 errors found
[m[1;31m[11:33:51] [Render thread/FATAL] [ne.mi.ev.EventBus/EVENTBUS]: EventBus 0 shutting down - future events will not be posted.
java.lang.Exception: stacktrace
这是我的 ArmorMaterialsList class
package com.carbon.lists;
import com.carbon.main_carbon;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
public enum ArmorMaterialList implements IArmorMaterial {
carbon("carbon_helmet", 1000, new int[] {8 ,10 ,9 ,7}, 20, ItemList.carbon_fiber_shard, "entity.magma_cube.jump", 0.0f);
private static final int[] max_damage_array = new int[] {13, 15, 16, 11};
private String name, equipSound;
private int duribility,enchantability;
private int[] damageReductionAmmounts;
private float toughness;
private Item repairItem;
private ArmorMaterialList(String name, int duribility, int[] damageReductionAmmounts, int enchantability, Item repairItem, String equipSound, float toughness) {
}
@Override
public int getDurability(EquipmentSlotType slot) {
return max_damage_array[slot.getIndex()] * this.duribility;
}
@Override
public int getDamageReductionAmount(EquipmentSlotType slot) {
return this.damageReductionAmmounts[slot.getIndex()];
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public SoundEvent getSoundEvent() {
return new SoundEvent(new ResourceLocation(equipSound));
}
@Override
public Ingredient getRepairMaterial() {
return Ingredient.fromItems(this.repairItem);
}
@Override
public String getName() {
return main_carbon.modid + ":" + this.name;
}
@Override
public float getToughness() {
return this.toughness;
}
}
private String name, equipSound;
private int duribility,enchantability;
private int[] damageReductionAmmounts;
private float toughness;
private Item repairItem;
private ArmorMaterialList(String name, int duribility, int[] damageReductionAmmounts, int enchantability, Item repairItem, String equipSound, float toughness) {
}
你有一堆字段,你有一个构造函数接受相应的参数,但你从来没有根据参数设置字段。您需要在构造函数体内执行 this.name = name;
等操作。