Jump to content

Recommended Posts

Posted

For some reason after I tried adding my 11th armor and tool set I got this weird crash, I have no idea what is causing it, I tried deleting everything I did today but to no avail.

 

Crash report

 

---- Minecraft Crash Report ----

// Don't be sad, have a hug! <3

 

Time: 28/08/16 10:05

Description: Initializing game

 

java.lang.NullPointerException: Initializing game

at top.mod.item.ModItems.registerRender(ModItems.java:652)

at top.mod.item.ModItems.registerRenders(ModItems.java:617)

at top.mod.proxy.ClientProxy.init(ClientProxy.java:47)

at top.mod.main.TopMod.init(TopMod.java:37)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:597)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)

at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:788)

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:322)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:561)

at net.minecraft.client.Minecraft.run(Minecraft.java:386)

at net.minecraft.client.main.Main.main(Main.java:118)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

at GradleStart.main(GradleStart.java:26)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Thread: Client thread

Stacktrace:

at top.mod.item.ModItems.registerRender(ModItems.java:652)

at top.mod.item.ModItems.registerRenders(ModItems.java:617)

at top.mod.proxy.ClientProxy.init(ClientProxy.java:47)

at top.mod.main.TopMod.init(TopMod.java:37)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:597)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:239)

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:217)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142)

at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:788)

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:322)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:561)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:386)

at net.minecraft.client.main.Main.main(Main.java:118)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

at GradleStart.main(GradleStart.java:26)

 

-- System Details --

Details:

Minecraft Version: 1.10.2

Operating System: Windows 8.1 (x86) version 6.3

Java Version: 1.8.0_45, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 794481944 bytes (757 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP 9.32 Powered by Forge 12.18.1.2056 4 mods loaded, 4 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHI mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)

UCHI FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2056.jar)

UCHI Forge{12.18.1.2056} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2056.jar)

UCHE tm{1.10-R1} [Miner's Delight] (bin)

Loaded coremods (and transformers):

GL info: ' Vendor: 'Intel' Version: '3.1.0 - Build 9.17.10.4229' Renderer: 'Intel® HD Graphics'

Launched Version: 1.10.2

LWJGL: 2.9.4

OpenGL: Intel® HD Graphics GL version 3.1.0 - Build 9.17.10.4229, Intel

GL Caps: Using GL 1.3 multitexturing.

Using GL 1.3 texture combiners.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Shaders are available because OpenGL 2.1 is supported.

VBOs are available because OpenGL 1.5 is supported.

 

Using VBOs: No

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs:

Current Language: English (US)

Profiler Position: N/A (disabled)

CPU: 2x Intel® Celeron® CPU G530 @ 2.40GHz

 

 

 

Main class

 

package top.mod.main;

 

import org.apache.logging.log4j.Logger;

 

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.Mod.Instance;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import net.minecraftforge.fml.common.SidedProxy;

import top.mod.proxy.CommonProxy;

import top.mod.recipes.ModRecipes;

 

@Mod(modid = Reference.MODID, name = Reference.NAME, version = Reference.VERSION)

 

public class TopMod

{

    @SidedProxy(clientSide = Reference.CLIENTPROXY, serverSide = Reference.COMMONPROXY)

public static CommonProxy proxy;

   

    @Instance("tm")

    public static TopMod instance;

 

    public static Logger logger;

   

    @EventHandler

public void preinit(FMLPreInitializationEvent event)

{

    logger = event.getModLog();

proxy.preinit(event);

 

}

    @EventHandler

  public void init(FMLInitializationEvent event)

{

      proxy.init(event);

      ModRecipes.init();

   

   

}

    @EventHandler

public void postinit(FMLPostInitializationEvent event)

{

proxy.postinit(event);

 

}

}

   

 

 

 

 

ModItems

 

package top.mod.item;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.init.SoundEvents;

import net.minecraft.inventory.EntityEquipmentSlot;

import net.minecraft.item.Item;

import net.minecraft.item.Item.ToolMaterial;

import net.minecraft.item.ItemArmor.ArmorMaterial;

import net.minecraft.item.ItemRedstone;

import net.minecraft.item.ItemSword;

import net.minecraft.util.ResourceLocation;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraftforge.fml.common.registry.EntityRegistry;

import net.minecraftforge.fml.common.registry.GameRegistry;

import top.mod.armor.TopArmor;

import top.mod.main.Reference;

import top.mod.tab.TopTab;

 

 

public class ModItems {

 

//copper items

public static Item copper;

public static Item coppersword;

public static Item copperpick;

public static Item coppershovel;

public static Item copperaxe;

public static Item copperhoe;

public static Item coppershears;

public static Item copperhelm;

public static Item copperchest;

public static Item copperlegs;

public static Item copperboots;

public static Item copperbucket;

public static Item copperbow;

public static Item copperwire;

 

//tin items

public static Item tin;

public static Item tinsword;

public static Item tinpick;

public static Item tinshovel;

public static Item tinaxe;

public static Item tinhoe;

public static Item tinhelm;

public static Item tinchest;

public static Item tinlegs;

public static Item tinboots;

public static Item tinshears;

public static Item tinbow;

 

//bronze items

public static Item bronze;

public static Item bronzesword;

public static Item bronzepick;

public static Item bronzeshovel;

public static Item bronzeaxe;

public static Item bronzehoe;

public static Item bronzehelm;

public static Item bronzechest;

public static Item bronzelegs;

public static Item bronzeboots;

public static Item bronzeshears;

public static Item bronzebow;

public static Item bronzemixture;

 

//steel

public static Item steel;

public static Item steelsword;

public static Item steelpick;

public static Item steelshovel;

public static Item steelaxe;

public static Item steelhoe;

public static Item steelhelm;

public static Item steelchest;

public static Item steellegs;

public static Item steelboots;

public static Item steelshears;

public static Item steelbow;

public static Item steelmixture;

 

//brass

public static Item brass;

public static Item brasssword;

public static Item brasspick;

public static Item brassshovel;

public static Item brassaxe;

public static Item brasshoe;

public static Item brasshelm;

public static Item brasschest;

public static Item brasslegs;

public static Item brassboots;

public static Item brassmixture;

public static Item brassbow;

public static Item brassshears;

public static Item brassfist;

 

//silver

public static Item titanium;

public static Item titaniumsword;

public static Item titaniumpick;

public static Item titaniumshovel;

public static Item titaniumaxe;

public static Item titaniumhoe;

public static Item titaniumhelm;

public static Item titaniumchest;

public static Item titaniumlegs;

public static Item titaniumboots;

public static Item titaniumbow;

public static Item titaniumshears;

 

//silver

public static Item silver;

public static Item silverdagger;

public static Item silversword;

public static Item silverpick;

public static Item silvershovel;

public static Item silveraxe;

public static Item silverhoe;

public static Item silverhelm;

public static Item silverchest;

public static Item silverlegs;

public static Item silverboots;

public static Item silverbow;

public static Item silvershears;

 

//electrum

public static Item electrum;

public static Item electrumsword;

public static Item electrumpick;

public static Item electrumshovel;

public static Item electrumaxe;

public static Item electrumhoe;

public static Item electrumhelm;

public static Item electrumchest;

public static Item electrumlegs;

public static Item electrumboots;

public static Item electrummixture;

public static Item electrumbow;

public static Item electrumshears;

 

//cobalt

public static Item cobalt;

public static Item cobaltsword;

public static Item cobaltpick;

public static Item cobaltshovel;

public static Item cobaltaxe;

public static Item cobalthoe;

public static Item cobalthelm;

public static Item cobaltchest;

public static Item cobaltlegs;

public static Item cobaltboots;

public static Item cobaltshears;

public static Item cobaltbow;

 

 

//platinum

public static Item platinum;

public static Item platinumsword;

public static Item platinumpick;

public static Item platinumshovel;

public static Item platinumaxe;

public static Item platinumhoe;

public static Item platinumhelm;

public static Item platinumchest;

public static Item platinumlegs;

public static Item platinumboots;

public static Item platinumshears;

public static Item platinumbow;

 

 

//zinc/silver

public static Item zinc;

public static Item uranium;

public static Item emptyrod;

public static Item uraniumrod;

public static Item aluminium;

public static Item growth;

public static Item ingotcast;

 

public static Item copperpaxel;

public static Item tinpaxel;

public static Item bronzepaxel;

public static Item steelpaxel;

public static Item brasspaxel;

public static Item silverpaxel;

public static Item electrumpaxel;

public static Item cobaltpaxel;

public static Item platinumpaxel;

public static Item titaniumpaxel;

public static Item leadpaxel;

 

public static Item copperknife;

public static Item tinknife;

public static Item bronzeknife;

public static Item steelknife;

public static Item brassknife;

public static Item silverknife;

public static Item electrumknife;

public static Item cobaltknife;

public static Item titaniumknife;

public static Item platinumknife;

 

 

public static Item magnesium;

public static Item magnesiumflint;

public static Item sulphur;

public static Item niter;

 

//registration

public static ArmorMaterial CopperArmor = EnumHelper.addArmorMaterial("CopperArmor", "tm:copper", 15, new int[]{1, 4, 5, 2}, 9, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial COPPER = EnumHelper.addToolMaterial("COPPER", 1, 181, 6.0F, 2.0F, 12);

 

public static ArmorMaterial TinArmor = EnumHelper.addArmorMaterial("TinArmor", "tm:tin", 15, new int[]{1, 4, 5, 2}, 10, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial TIN = EnumHelper.addToolMaterial("TIN", 1, 191, 7.0F, 2.0F, 12);

 

public static ArmorMaterial LeadArmor = EnumHelper.addArmorMaterial("LeadArmor", "tm:lead", 16, new int[]{2, 5, 6, 2}, 12, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial LEAD = EnumHelper.addToolMaterial("LEAD", 2, 351, 6.0F, 2.0F, 13);

 

public static ArmorMaterial BronzeArmor = EnumHelper.addArmorMaterial("BronzeArmor", "tm:bronze", 17, new int[]{2, 5, 6, 2}, 13, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial BRONZE = EnumHelper.addToolMaterial("BRONZE", 2, 451, 6.0F, 2.0F, 13);

 

public static ArmorMaterial SteelArmor = EnumHelper.addArmorMaterial("SteelArmor", "tm:steel", 18, new int[]{3, 6, 8, 3}, 15, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial STEEL = EnumHelper.addToolMaterial("STEEL", 2, 551, 6.0F, 2.0F, 13);

 

public static ArmorMaterial BrassArmor = EnumHelper.addArmorMaterial("BrassArmor", "tm:brass", 20, new int[]{3, 6, 8, 3}, 20, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial BRASS = EnumHelper.addToolMaterial("BRASS", 2, 651, 6.0F, 2.0F, 14);

 

public static ArmorMaterial SilverArmor = EnumHelper.addArmorMaterial("SilverArmor", "tm:silver", 22, new int[]{3, 6, 8, 3}, 21, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial SILVER = EnumHelper.addToolMaterial("SILVER", 2, 751, 6.0F, 3.0F, 14);

public static ToolMaterial SILVERTOOL = EnumHelper.addToolMaterial("SILVERTOOL", 2, 91, 8.0F, 41.0F, 16);

 

public static ArmorMaterial ElectrumArmor = EnumHelper.addArmorMaterial("ElectrumArmor", "tm:electrum", 25, new int[]{3, 6, 8, 3}, 24, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial ELECTRUM = EnumHelper.addToolMaterial("ELECTRUM", 2, 851, 8.0F, 4.0F, 19);

 

public static ArmorMaterial CobaltArmor = EnumHelper.addArmorMaterial("CobaltArmor", "tm:cobalt", 28, new int[]{3, 6, 8, 3}, 25, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial COBALT = EnumHelper.addToolMaterial("COBALT", 2, 951, 7.0F, 4.0F, 21);

 

public static ArmorMaterial TitaniumArmor = EnumHelper.addArmorMaterial("TitaniumArmor", "tm:titanium", 31, new int[]{3, 6, 8, 3}, 26, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial TITANIUM = EnumHelper.addToolMaterial("TITANIUM", 2, 1051, 10.0F, 4.0F, 24);

 

public static ArmorMaterial PlatinumArmor = EnumHelper.addArmorMaterial("PlatinumArmor", "tm:platinum", 80, new int[]{4, 7, 9, 4}, 45, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 0.0F);

public static ToolMaterial PLATINUM = EnumHelper.addToolMaterial("PLATINUM", 3, 2251, 75.0F, 45.0F, 35);

 

 

 

 

public static final void preinit(){

//copper

copper = registerItem(new Item(), "copper");

coppersword = registerItem(new ModSword(COPPER), "coppersword");

copperpick = registerItem(new ModPick(COPPER), "copperpick");

coppershovel = registerItem(new ModShovel(COPPER), "coppershovel");

copperaxe = registerItem(new ModAxe(COPPER), "copperaxe");

copperhoe = registerItem(new ModHoe(COPPER), "copperhoe");

copperhelm = registerItem(new TopArmor(CopperArmor, 1, EntityEquipmentSlot.HEAD), "copperhelm");

copperchest = registerItem(new TopArmor(CopperArmor, 1, EntityEquipmentSlot.CHEST), "copperchest");

copperlegs = registerItem(new TopArmor(CopperArmor, 2, EntityEquipmentSlot.LEGS), "copperlegs");

copperboots = registerItem(new TopArmor(CopperArmor, 1, EntityEquipmentSlot.FEET), "copperboots");

coppershears = registerItem(new ModShears(), "coppershears");

copperbow = registerItem(new ModBowCopperTin(), "copperbow");

copperbucket = registerItem(new CopperBucket(Blocks.AIR), "copperbucket");

copperwire = registerItem(new CopperWire(), "copperwire");

 

//tin

tin = registerItem(new Item(), "tin");

tinsword = registerItem(new ModSword(TIN), "tinsword");

tinpick = registerItem(new ModPick(TIN), "tinpick");

tinshovel = registerItem(new ModShovel(TIN), "tinshovel");

tinaxe = registerItem(new ModAxe(TIN), "tinaxe");

tinhoe = registerItem(new ModHoe(TIN), "tinhoe");

tinhelm = registerItem(new TopArmor(TinArmor, 1, EntityEquipmentSlot.HEAD), "tinhelm");

tinchest = registerItem(new TopArmor(TinArmor, 1, EntityEquipmentSlot.CHEST), "tinchest");

tinlegs = registerItem(new TopArmor(TinArmor, 2, EntityEquipmentSlot.LEGS), "tinlegs");

tinboots = registerItem(new TopArmor(TinArmor, 1, EntityEquipmentSlot.FEET), "tinboots");

tinshears = registerItem(new ModShears(), "tinshears");

tinbow = registerItem(new ModBowCopperTin(), "tinbow");

 

//bronze

bronze = registerItem(new Item(), "bronze");

bronzemixture = registerItem(new Item(), "bronzemixture");

bronzesword = registerItem(new ModSword(BRONZE), "bronzesword");

bronzepick = registerItem(new ModPick(BRONZE), "bronzepick");

bronzeshovel = registerItem(new ModShovel(BRONZE), "bronzeshovel");

bronzeaxe = registerItem(new ModAxe(BRONZE), "bronzeaxe");

bronzehoe = registerItem(new ModHoe(BRONZE), "bronzehoe");

bronzehelm = registerItem(new TopArmor(BronzeArmor, 1, EntityEquipmentSlot.HEAD), "bronzehelm");

bronzechest = registerItem(new TopArmor(BronzeArmor, 1, EntityEquipmentSlot.CHEST), "bronzechest");

bronzelegs = registerItem(new TopArmor(BronzeArmor, 2, EntityEquipmentSlot.LEGS), "bronzelegs");

bronzeboots = registerItem(new TopArmor(BronzeArmor, 1, EntityEquipmentSlot.FEET), "bronzeboots");

bronzeshears = registerItem(new ModShears(), "bronzeshears");

bronzebow = registerItem(new ModBowBronze(), "bronzebow");

 

//steel

steel = registerItem(new Item(), "steel");

steelmixture = registerItem(new Item(), "steelmixture");

steelsword = registerItem(new ModSword(STEEL), "steelsword");

steelpick = registerItem(new ModPick(STEEL), "steelpick");

steelshovel = registerItem(new ModShovel(STEEL), "steelshovel");

steelaxe = registerItem(new ModAxe(STEEL), "steelaxe");

steelhoe = registerItem(new ModHoe(STEEL), "steelhoe");

steelhelm = registerItem(new TopArmor(SteelArmor, 1, EntityEquipmentSlot.HEAD), "steelhelm");

steelchest = registerItem(new TopArmor(SteelArmor, 1, EntityEquipmentSlot.CHEST), "steelchest");

steellegs = registerItem(new TopArmor(SteelArmor, 2, EntityEquipmentSlot.LEGS), "steellegs");

steelboots = registerItem(new TopArmor(SteelArmor, 1, EntityEquipmentSlot.FEET), "steelboots");

steelshears = registerItem(new ModShears(), "steelshears");

steelbow = registerItem(new ModBowSteel(), "steelbow");

 

//brass

brass = registerItem(new Item(), "brass");

brassmixture = registerItem(new Item(), "brassmixture");

brasssword = registerItem(new ModSword(BRASS), "brasssword");

brasspick = registerItem(new ModPick(BRASS), "brasspick");

brassshovel = registerItem(new ModShovel(BRASS), "brassshovel");

brassaxe = registerItem(new ModAxe(BRASS), "brassaxe");

brasshoe = registerItem(new ModHoe(BRASS), "brasshoe");

brasshelm = registerItem(new TopArmor(BrassArmor, 1, EntityEquipmentSlot.HEAD), "brasshelm");

brasschest = registerItem(new TopArmor(BrassArmor, 1, EntityEquipmentSlot.CHEST), "brasschest");

brasslegs = registerItem(new TopArmor(BrassArmor, 2, EntityEquipmentSlot.LEGS), "brasslegs");

brassboots = registerItem(new TopArmor(BrassArmor, 1, EntityEquipmentSlot.FEET), "brassboots");

brassbow = registerItem(new ModBowBrass(), "brassbow");

brassshears = registerItem(new ModShears(), "brassshears");

brassfist = registerItem(new ModSword(SILVERTOOL), "brassfist");

 

silver = registerItem(new Item(), "silver");

silverdagger = registerItem(new ModSword(SILVERTOOL), "silverdagger");

silversword = registerItem(new ModSword(SILVER), "silversword");

silverpick = registerItem(new ModPick(SILVER), "silverpick");

silvershovel = registerItem(new ModShovel(SILVER), "silvershovel");

silveraxe = registerItem(new ModAxe(SILVER), "silveraxe");

silverhoe = registerItem(new ModHoe(SILVER), "silverhoe");

silverhelm = registerItem(new TopArmor(SilverArmor, 1, EntityEquipmentSlot.HEAD), "silverhelm");

silverchest = registerItem(new TopArmor(SilverArmor, 1, EntityEquipmentSlot.CHEST), "silverchest");

silverlegs = registerItem(new TopArmor(SilverArmor, 2, EntityEquipmentSlot.LEGS), "silverlegs");

silverboots = registerItem(new TopArmor(SilverArmor, 1, EntityEquipmentSlot.FEET), "silverboots");

silvershears = registerItem(new ModShears(), "silvershears");

silverbow = registerItem(new ModBowSilver(), "silverbow");

 

 

//electrum

electrum = registerItem(new Item(), "electrum");

electrummixture = registerItem(new Item(), "electrummixture");

electrumsword = registerItem(new ModSword(ELECTRUM), "electrumsword");

electrumpick = registerItem(new ModPick(ELECTRUM), "electrumpick");

electrumshovel = registerItem(new ModShovel(ELECTRUM), "electrumshovel");

electrumaxe = registerItem(new ModAxe(ELECTRUM), "electrumaxe");

electrumhoe = registerItem(new ModHoe(ELECTRUM), "electrumhoe");

electrumhelm = registerItem(new TopArmor(ElectrumArmor, 1, EntityEquipmentSlot.HEAD), "electrumhelm");

electrumchest = registerItem(new TopArmor(ElectrumArmor, 1, EntityEquipmentSlot.CHEST), "electrumchest");

electrumlegs = registerItem(new TopArmor(ElectrumArmor, 2, EntityEquipmentSlot.LEGS), "electrumlegs");

electrumboots = registerItem(new TopArmor(ElectrumArmor, 1, EntityEquipmentSlot.FEET), "electrumboots");

electrumbow = registerItem(new ModBowElectrum(), "electrumbow");

electrumshears = registerItem(new ModShears(), "electrumshears");

 

//cobalt

cobalt = registerItem(new Item(), "cobalt");

cobaltsword = registerItem(new ModSword(COBALT), "cobaltsword");

cobaltpick = registerItem(new ModPick(COBALT), "cobaltpick");

cobaltshovel = registerItem(new ModShovel(COBALT), "cobaltshovel");

cobaltaxe = registerItem(new ModAxe(COBALT), "cobaltaxe");

cobalthoe = registerItem(new ModHoe(COBALT), "cobalthoe");

cobalthelm = registerItem(new TopArmor(CobaltArmor, 1, EntityEquipmentSlot.HEAD), "cobalthelm");

cobaltchest = registerItem(new TopArmor(CobaltArmor, 1, EntityEquipmentSlot.CHEST), "cobaltchest");

cobaltlegs = registerItem(new TopArmor(CobaltArmor, 2, EntityEquipmentSlot.LEGS), "cobaltlegs");

cobaltboots = registerItem(new TopArmor(CobaltArmor, 1, EntityEquipmentSlot.FEET), "cobaltboots");

cobaltshears = registerItem(new ModShears(), "cobaltshears");

cobaltbow = registerItem(new ModBowCobalt(), "cobaltbow");

 

//platinum

platinum = registerItem(new Item(), "platinum");

platinumsword = registerItem(new ModSword(PLATINUM), "platinumsword");

platinumpick = registerItem(new ModPick(PLATINUM), "platinumpick");

platinumshovel = registerItem(new ModShovel(PLATINUM), "platinumshovel");

platinumaxe = registerItem(new ModAxe(PLATINUM), "platinumaxe");

platinumhoe = registerItem(new ModHoe(PLATINUM), "platinumhoe");

platinumhelm = registerItem(new TopArmor(PlatinumArmor, 1, EntityEquipmentSlot.HEAD), "platinumhelm");

platinumchest = registerItem(new TopArmor(PlatinumArmor, 1, EntityEquipmentSlot.CHEST), "platinumchest");

platinumlegs = registerItem(new TopArmor(PlatinumArmor, 2, EntityEquipmentSlot.LEGS), "platinumlegs");

platinumboots = registerItem(new TopArmor(PlatinumArmor, 1, EntityEquipmentSlot.FEET), "platinumboots");

platinumshears = registerItem(new ModShears(), "platinumshears");

platinumbow = registerItem(new ModBowPlatinum(), "platinumbow");

 

//platinum

titanium = registerItem(new Item(), "titanium");

titaniumsword = registerItem(new ModSword(TITANIUM), "titaniumsword");

titaniumpick = registerItem(new ModPick(TITANIUM), "titaniumpick");

titaniumshovel = registerItem(new ModShovel(TITANIUM), "titaniumshovel");

titaniumaxe = registerItem(new ModAxe(TITANIUM), "titaniumaxe");

titaniumhoe = registerItem(new ModHoe(TITANIUM), "titaniumhoe");

titaniumhelm = registerItem(new TopArmor(TitaniumArmor, 1, EntityEquipmentSlot.HEAD), "titaniumhelm");

titaniumchest = registerItem(new TopArmor(TitaniumArmor, 1, EntityEquipmentSlot.CHEST), "titaniumchest");

titaniumlegs = registerItem(new TopArmor(TitaniumArmor, 2, EntityEquipmentSlot.LEGS), "titaniumlegs");

titaniumboots = registerItem(new TopArmor(TitaniumArmor, 1, EntityEquipmentSlot.FEET), "titaniumboots");

titaniumshears = registerItem(new ModShears(), "titaniumshears");

titaniumbow = registerItem(new ModBowTitanium(), "titaniumbow");

 

 

copperpaxel = registerItem(new ModPaxel(COPPER), "copperpaxel");

tinpaxel = registerItem(new ModPaxel(TIN), "tinpaxel");

titaniumpaxel = registerItem(new ModPaxel(LEAD), "leadpaxel");

bronzepaxel = registerItem(new ModPaxel(BRONZE), "bronzepaxel");

steelpaxel = registerItem(new ModPaxel(STEEL), "steelpaxel");

brasspaxel = registerItem(new ModPaxel(BRASS), "brasspaxel");

silverpaxel = registerItem(new ModPaxel(SILVER), "silverpaxel");

electrumpaxel = registerItem(new ModPaxel(ELECTRUM), "electrumpaxel");

cobaltpaxel = registerItem(new ModPaxel(COBALT), "cobaltpaxel");

platinumpaxel = registerItem(new ModPaxel(PLATINUM), "platinumpaxel");

titaniumpaxel = registerItem(new ModPaxel(TITANIUM), "titaniumpaxel");

 

copperknife = registerItem(new CopperKnife(), "copperknife");//11

tinknife = registerItem(new TinKnife(), "tinknife"); //11

bronzeknife = registerItem(new BronzeKnife(), "bronzeknife");//13

steelknife = registerItem(new SteelKnife(), "steelknife");//14

brassknife = registerItem(new BrassKnife(), "brassknife");//17

silverknife = registerItem(new SilverKnife(), "silverknife");//20

electrumknife = registerItem(new ElectrumKnife(), "electrumknife");//22

cobaltknife = registerItem(new CobaltKnife(), "cobaltknife");//24

titaniumknife = registerItem(new TitaniumKnife(), "titaniumknife");//26

platinumknife = registerItem(new PlatinumKnife(), "platinumknife");//41

 

//magnesium

magnesium = registerItem(new Item(), "magnesium");

magnesiumflint = registerItem(new MagnesiumFlint(), "magnesiumflint");

sulphur = registerItem(new Item(), "sulphurcrystal");

niter = registerItem(new Item(), "niter");

 

//zinc/silver

zinc = registerItem(new Item(), "zinc");

uranium = registerItem(new Item(), "uranium");

emptyrod = registerItem(new Item(), "emptyrod");

uraniumrod = registerItem(new Item(), "uraniumrod");

aluminium = registerItem(new Item(), "aluminium");

growth = registerItem(new GrowthItem(), "growth");

 

//misc

ingotcast = registerItem(new Item(), "ingotcast");

 

}

public static final void registerRenders() {

//copper

registerRender(copper);

registerRender(coppersword);

registerRender(copperpick);

registerRender(coppershovel);

registerRender(copperaxe);

registerRender(copperhoe);

registerRender(copperhelm);

registerRender(copperchest);

registerRender(copperlegs);

registerRender(copperboots);

registerRender(coppershears);

registerRender(copperbucket);

registerRender(copperbow);

registerRender(copperwire);

 

//tin

registerRender(tin);

registerRender(tinsword);

registerRender(tinpick);

registerRender(tinshovel);

registerRender(tinaxe);

registerRender(tinhoe);

registerRender(tinhelm);

registerRender(tinchest);

registerRender(tinlegs);

registerRender(tinboots);

registerRender(tinlegs);

registerRender(tinboots);

registerRender(tinbow);

registerRender(tinshears);

 

//bronze

registerRender(bronze);

registerRender(bronzemixture);

registerRender(bronzesword);

registerRender(bronzepick);

registerRender(bronzeshovel);

registerRender(bronzeaxe);

registerRender(bronzehoe);

registerRender(bronzehelm);

registerRender(bronzechest);

registerRender(bronzelegs);

registerRender(bronzeboots);

registerRender(bronzelegs);

registerRender(bronzeboots);

registerRender(bronzebow);

registerRender(bronzeshears);

 

//steel

registerRender(steel);

registerRender(steelmixture);

registerRender(steelsword);

registerRender(steelpick);

registerRender(steelshovel);

registerRender(steelaxe);

registerRender(steelhoe);

registerRender(steelhelm);

registerRender(steelchest);

registerRender(steellegs);

registerRender(steelboots);

registerRender(steellegs);

registerRender(steelboots);

registerRender(steelbow);

registerRender(steelshears);

 

 

 

//brass

registerRender(brass);

registerRender(brassmixture);

registerRender(brasssword);

registerRender(brasspick);

registerRender(brassshovel);

registerRender(brassaxe);

registerRender(brasshoe);

registerRender(brasshelm);

registerRender(brasschest);

registerRender(brasslegs);

registerRender(brassboots);

registerRender(brasslegs);

registerRender(brassbow);

registerRender(brassshears);

registerRender(brassfist);

 

registerRender(silver);

registerRender(silverdagger);

registerRender(silversword);

registerRender(silverpick);

registerRender(silvershovel);

registerRender(silveraxe);

registerRender(silverhoe);

registerRender(silverhelm);

registerRender(silverchest);

registerRender(silverlegs);

registerRender(silverboots);

registerRender(silverlegs);

registerRender(silverbow);

registerRender(silvershears);

 

 

//electrum

registerRender(electrum);

registerRender(electrummixture);

registerRender(electrumsword);

registerRender(electrumpick);

registerRender(electrumshovel);

registerRender(electrumaxe);

registerRender(electrumhoe);

registerRender(electrumhelm);

registerRender(electrumchest);

registerRender(electrumlegs);

registerRender(electrumboots);

registerRender(electrumlegs);

registerRender(electrumbow);

registerRender(electrumshears);

 

//cobalt

registerRender(cobalt);

registerRender(cobaltsword);

registerRender(cobaltpick);

registerRender(cobaltshovel);

registerRender(cobaltaxe);

registerRender(cobalthoe);

registerRender(cobalthelm);

registerRender(cobaltchest);

registerRender(cobaltlegs);

registerRender(cobaltboots);

registerRender(cobaltlegs);

registerRender(cobaltboots);

registerRender(cobaltbow);

registerRender(cobaltshears);

 

//platinum

registerRender(platinum);

registerRender(platinumsword);

registerRender(platinumpick);

registerRender(platinumshovel);

registerRender(platinumaxe);

registerRender(platinumhoe);

registerRender(platinumhelm);

registerRender(platinumchest);

registerRender(platinumlegs);

registerRender(platinumboots);

registerRender(platinumlegs);

registerRender(platinumboots);

registerRender(platinumbow);

registerRender(platinumshears);

 

registerRender(titanium);

registerRender(titaniumsword);

registerRender(titaniumpick);

registerRender(titaniumshovel);

registerRender(titaniumaxe);

registerRender(titaniumhoe);

registerRender(titaniumhelm);

registerRender(titaniumchest);

registerRender(titaniumlegs);

registerRender(titaniumboots);

registerRender(titaniumlegs);

registerRender(titaniumboots);

registerRender(titaniumbow);

registerRender(titaniumshears);

 

registerRender(copperpaxel);

registerRender(tinpaxel);

registerRender(bronzepaxel);

registerRender(steelpaxel);

registerRender(brasspaxel);

registerRender(silverpaxel);

registerRender(electrumpaxel);

registerRender(cobaltpaxel);

registerRender(platinumpaxel);

registerRender(titaniumpaxel);

registerRender(leadpaxel);

 

 

registerRender(copperknife);

registerRender(tinknife);

registerRender(bronzeknife);

registerRender(steelknife);

registerRender(brassknife);

registerRender(silverknife);

registerRender(electrumknife);

registerRender(cobaltknife);

registerRender(titaniumknife);

registerRender(platinumknife);

 

 

//zinc/silver/uranium

registerRender(zinc);

registerRender(uranium);

registerRender(emptyrod);

registerRender(uraniumrod);

registerRender(aluminium);

registerRender(growth);

registerRender(magnesium);

registerRender(magnesiumflint);

registerRender(sulphur);

registerRender(niter);

 

 

//misc

registerRender(ingotcast);

 

}

 

public static final void registerRender(Item i){

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(i,0,

new ModelResourceLocation(Reference.MODID + ":" + i.getRegistryName().getResourcePath(), "inventory"));

 

}

 

public static final Item registerItem(Item i, String n){

ResourceLocation r = new ResourceLocation(Reference.MODID, n);

 

i.setUnlocalizedName(n);

i.setRegistryName®;

i.setCreativeTab(TopTab.toptab);

 

GameRegistry.register(i);

return i;

 

}

}

 

 

 

 

ClientProxy

 

package top.mod.proxy;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.RenderItem;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.client.renderer.entity.RenderSnowball;

import net.minecraftforge.fml.client.registry.RenderingRegistry;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import net.minecraftforge.fml.common.registry.EntityRegistry;

import net.minecraftforge.fml.common.registry.GameRegistry;

import top.mod.block.ModBlocks;

import top.mod.fuel.TopFuelHandler;

import top.mod.item.EntityBrassKnife;

import top.mod.item.EntityBronzeKnife;

import top.mod.item.EntityCobaltKnife;

import top.mod.item.EntityCopperKnife;

import top.mod.item.EntityElectrumKnife;

import top.mod.item.EntityLeadKnife;

import top.mod.item.EntityPlatinumKnife;

import top.mod.item.EntitySilverKnife;

import top.mod.item.EntitySteelKnife;

import top.mod.item.EntityTinKnife;

import top.mod.item.EntityTitaniumKnife;

import top.mod.item.ModItems;

import top.mod.main.TopMod;

import top.mod.worldgen.ModWorldGen;

 

 

public class ClientProxy extends CommonProxy{

 

@Override

public void preinit(FMLPreInitializationEvent event)

{

super.preinit(event);

 

}

@Override

public void init(FMLInitializationEvent event)

{

super.init(event);

 

RenderManager rm = Minecraft.getMinecraft().getRenderManager();

RenderItem ri = Minecraft.getMinecraft().getRenderItem();

 

ModItems.registerRenders();

ModBlocks.registerRenders();

RenderingRegistry.registerEntityRenderingHandler(EntityCopperKnife.class, new RenderSnowball(rm, ModItems.copperknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntityTinKnife.class, new RenderSnowball(rm, ModItems.tinknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntityBronzeKnife.class, new RenderSnowball(rm, ModItems.bronzeknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntitySteelKnife.class, new RenderSnowball(rm, ModItems.steelknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntityBrassKnife.class, new RenderSnowball(rm, ModItems.brassknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntitySilverKnife.class, new RenderSnowball(rm, ModItems.silverknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntityElectrumKnife.class, new RenderSnowball(rm, ModItems.electrumknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntityCobaltKnife.class, new RenderSnowball(rm, ModItems.cobaltknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntityTitaniumKnife.class, new RenderSnowball(rm, ModItems.titaniumknife, ri));

RenderingRegistry.registerEntityRenderingHandler(EntityPlatinumKnife.class, new RenderSnowball(rm, ModItems.platinumknife, ri));

 

 

GameRegistry.registerWorldGenerator(new ModWorldGen(), 0);

GameRegistry.registerFuelHandler(new TopFuelHandler());

 

EntityRegistry.registerModEntity(EntityCopperKnife.class, "copperknife", 999, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntityTinKnife.class, "tinknife", 1000, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntityBronzeKnife.class, "bronzeknife", 1001, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntitySteelKnife.class, "steelknife", 1002, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntityBrassKnife.class, "brassknife", 1003, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntitySilverKnife.class, "silverknife", 1004, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntityElectrumKnife.class, "electrumknife", 1005, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntityCobaltKnife.class, "cobaltknife", 1006, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntityTitaniumKnife.class, "titaniumknife", 1007, TopMod.instance, 80, 10, true);

EntityRegistry.registerModEntity(EntityPlatinumKnife.class, "platinumknife", 1008, TopMod.instance, 80, 10, true);

 

 

 

}

@Override

public void postinit(FMLPostInitializationEvent event)

{

super.postinit(event);

 

 

}

}

 

 

 

Posted

Your best bet would be to make sure you initialize everything that you are registering a render to or put a println before you actually register the tender that will tell you which one it is.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Have some bloody patience and stop bumping your threads every five minutes. Answers are rarely instant on any forum.

 

[10:18:16] [Client thread/ERROR] [FML]: Caught exception from tm

java.lang.NullPointerException

    at top.mod.item.ModItems.registerRender(ModItems.java:652) ~[bin/:?]

    at top.mod.item.ModItems.registerRenders(ModItems.java:617) ~[bin/:?]

    at top.mod.proxy.ClientProxy.init(ClientProxy.java:47) ~[bin/:?]

    at top.mod.main.TopMod.init(TopMod.java:37) ~[bin/:?]

 

Line 617 is the following:

registerRender(leadpaxel);

 

ModItems.leadpaxel

is

null

because you never assign a value to it. Instead, you assign the

ModPaxel

with the

LEAD

ToolMaterial

and

"leadpaxel"

as its registry name to the

ModItems.titaniumpaxel

field.

 

"AL lib: (EE) alc_cleanup: 1 device not closed" is always logged when the client crashes for any reason, it's got nothing to do with what caused the crash.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

I've had to delete everything, put it in a text document then re add it one bit at a time to find the errors

 

You'll have a much easier time if you learn to understand stack traces and exception messages. The crash report told you what where the problem was, you just needed to understand what could cause the problem.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
java.lang.NullPointerException: Initializing game

  at top.mod.item.ModItems.registerRender(ModItems.java:652)

  at top.mod.item.ModItems.registerRenders(ModItems.java:617)

  at top.mod.proxy.ClientProxy.init(ClientProxy.java:47)

  at top.mod.main.TopMod.init(TopMod.java:37)

 

If you're using Eclipse, then each of those line references in the console output is a clickable link to a place in code. Use them to see what led the exception. Set breakpoints and rerun in the debugger so you can examine variables as you step toward the offending line.

 

PS: Do not scold the people here for not responding in under 10 minutes. You're not paying us enough for that. We're just other hobbyists who tune in maybe once or twice a day, sometimes less. Therefore, if you hit a wall and must seek help here, you are possibly done for the day. At the very least, you should take a break to go do something else for a while.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

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

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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