Jump to content

Recommended Posts

Posted

So I started up my client to test out this model I made for an item, however I crashed with this error:

 

2012-11-02 23:46:07 [iNFO] [sTDERR] cpw.mods.fml.common.LoaderException: java.lang.reflect.InvocationTargetException
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.transition(LoadController.java:102)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.loadMods(Loader.java:461)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:141)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.startGame(Minecraft.java:405)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:737)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] Caused by: java.lang.reflect.InvocationTargetException
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:371)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.post(EventBus.java:268)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:124)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at com.google.common.eventbus.EventBus.post(EventBus.java:268)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:81)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.loadMods(Loader.java:460)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	... 4 more
2012-11-02 23:46:07 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at arcticraft.ClientProxy.registerRenderInformation(ClientProxy.java:23)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	at arcticraft.Arcticraft.preInit(Arcticraft.java:211)
2012-11-02 23:46:07 [iNFO] [sTDERR] 	... 30 more

 

ClientProxy stuff:


package arcticraft;                                                             
import arcticraft.entities.*;
import arcticraft.models.*;
import arcticraft.renderers.*;
import net.minecraft.src.*;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.TickRegistry;

public class ClientProxy extends CommonProxy
{
@Override
@SideOnly(Side.CLIENT)
public void registerRenderInformation() 
{  
	MinecraftForgeClient.registerItemRenderer(Arcticraft.staff.shiftedIndex, new AC_ItemRenderStaff());		
}

}

 

ItemRenderer file:


package arcticraft.renderers;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import arcticraft.models.AC_ModelStaff;
import net.minecraft.src.*;
import net.minecraftforge.client.*;

public class AC_ItemRenderStaff implements IItemRenderer
{
private static AC_ModelStaff staffModel = new AC_ModelStaff();

public boolean handleRenderType(ItemStack item, ItemRenderType type) 
{
	if (type == ItemRenderType.EQUIPPED) { return true; }
	return false;
}

public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) 
{
	return false;
}

public void renderItem(ItemRenderType type, ItemStack item, Object... data) 
{
	switch (type)
	{
	case ENTITY: renderTool(-0.5F, 0.5F, -0.5F); break;
	case EQUIPPED: renderTool(0F, 0.4F, 0F); break;
	case INVENTORY: renderTool(1F, 0.65F, 1F); break;
	default: break;
	}
}

private void renderTool(float x, float y, float z) 
{
	Tessellator tesselator = Tessellator.instance;
	GL11.glPushMatrix(); //start
	ForgeHooksClient.bindTexture("/arcticraft/textures/mobs/evilIceMage.png", 0);
	GL11.glTranslatef(x, y, z); //size
	float var10 = 0.0625F;
	staffModel.render((Entity)null, 0.0F, 0.0F, 0.0F, 1.0F, 0.0F, var10);
	GL11.glPopMatrix(); //end
}
}

 

Staff code and clientproxy registering in my base file(Arcticraft.java)

 

public static Item staff;

@PreInit
public void preInit(FMLPreInitializationEvent event)
{
	proxy.registerRenderInformation();
        }

@Init
public void Init(FMLInitializationEvent event)
{
this.initItems();
}

public void initItems() 
{
	this.staff = (new AC_ItemStaff(1950).setItemName("staff").setIconCoord(13, 2));
}

 

AC_ItemStaff:


package arcticraft.items;

import arcticraft.entities.AC_EntityStaffBall;
import net.minecraft.src.*;

import net.minecraft.client.Minecraft;

public class AC_ItemStaff extends Item
{
public AC_ItemStaff(int par1)
{
	super(par1);
	this.maxStackSize = 1;
	maxStackSize = 1;	  //1 for durability | 1-64 for consumption	
	setMaxDamage(1000);    //Durability = # + 1
	setTabToDisplayOn(CreativeTabs.tabCombat);
}




public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
	if(entityplayer.capabilities.isCreativeMode)
	{
		world.playSoundAtEntity(entityplayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

		if (!world.isRemote)
		{
			world.spawnEntityInWorld(new AC_EntityStaffBall(world, entityplayer, entityplayer, iconIndex, iconIndex));
		}

		return itemstack;
	}

	if (entityplayer.ridingEntity != null)
	{
		return itemstack;
	}
	else
	{

		world.playSoundAtEntity(entityplayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

		if (!world.isRemote)
		{
			world.spawnEntityInWorld(new AC_EntityStaffBall(world, entityplayer, entityplayer, iconIndex, iconIndex));
		}

		itemstack.damageItem(1, entityplayer); 
		return itemstack;}
}


public String getTextureFile()
{
	return "/arcticraft/textures/ACItems.png";
}
}


 

And thats probably all the code you need to know about. But yeah, I need help on this!

Posted

I liked the part where you tried to reference the item before you initalized the item.

God that was hilarious.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • 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

    • Maybe there are other mods, not compatible with 47.4.4 - the 2nd 4 indicates mayor changes - so some mods may not compatible with it
    • Nope still the same issue exit code 1
    • I have no idea what the flip is going on, I can load the modpack just fine at forge 42.2.0 but any forge version above it insta-crashes with exit code 1. Can somebody tell me what's going on, this is minecraft 1.20.1 Latest.log: https://pastebin.com/pBUL1ZFa
    • does anyone know how to incorporate custom noise settings into a custom dimension through the use of datagen, I have created a custon json file for the noise settings that I want but I just don't know how to get it to register with the generated json file of the custom dimension.   here is the code for the dimension class package net.hurst.lustria.worldgen.dimension; import com.mojang.datafixers.util.Pair; import net.hurst.lustria.Lustria; import net.hurst.lustria.worldgen.biome.ModBiomes; import net.hurst.lustria.worldgen.registries.LustriaNoiseSettings; import net.minecraft.core.HolderGetter; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstapContext; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.util.valueproviders.ConstantInt; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.*; import net.minecraft.world.level.dimension.BuiltinDimensionTypes; import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.dimension.LevelStem; import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; import java.util.List; import java.util.OptionalLong; public class ModDimensions { public static final ResourceKey<LevelStem> LUSTRIA_KEY = ResourceKey.create(Registries.LEVEL_STEM, ResourceLocation.fromNamespaceAndPath(Lustria.MOD_ID, "lustriadim")); public static final ResourceKey<Level> LUSTRIA_LEVEL_KEY = ResourceKey.create(Registries.DIMENSION, ResourceLocation.fromNamespaceAndPath(Lustria.MOD_ID, "lustriadim")); public static final ResourceKey<DimensionType> LUSTRIA_DIM_TYPE = ResourceKey.create(Registries.DIMENSION_TYPE, ResourceLocation.fromNamespaceAndPath(Lustria.MOD_ID, "lustriadim_type")); public static void bootstrapType(BootstapContext<DimensionType> context) { context.register(LUSTRIA_DIM_TYPE, new DimensionType( OptionalLong.of(12000), // fixedTime false, // hasSkylight true, // hasCeiling false, // ultraWarm false, // natural 1.0, // coordinateScale true, // bedWorks false, // respawnAnchorWorks -64, // minY 256, // height 256, // logicalHeight BlockTags.INFINIBURN_OVERWORLD, // infiniburn BuiltinDimensionTypes.OVERWORLD_EFFECTS, // effectsLocation 0.0f, // ambientLight new DimensionType.MonsterSettings(false, false, ConstantInt.of(0), 0))); } public static void bootstrapStem(BootstapContext<LevelStem> context) { HolderGetter<Biome> biomeRegistry = context.lookup(Registries.BIOME); HolderGetter<DimensionType> dimTypes = context.lookup(Registries.DIMENSION_TYPE); HolderGetter<NoiseGeneratorSettings> noiseGenSettings = context.lookup(Registries.NOISE_SETTINGS); NoiseBasedChunkGenerator wrappedChunkGenerator = new NoiseBasedChunkGenerator( new FixedBiomeSource(biomeRegistry.getOrThrow(Biomes.BEACH)), noiseGenSettings.getOrThrow(NoiseGeneratorSettings.CAVES)); NoiseBasedChunkGenerator noiseBasedChunkGenerator = new NoiseBasedChunkGenerator( MultiNoiseBiomeSource.createFromList( new Climate.ParameterList<>(List.of(Pair.of( Climate.parameters(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F), biomeRegistry.getOrThrow(Biomes.BEACH)), Pair.of( Climate.parameters(0.1F, 0.2F, 0.0F, 0.2F, 0.0F, 0.0F, 0.0F), biomeRegistry.getOrThrow(Biomes.BIRCH_FOREST)), Pair.of( Climate.parameters(0.3F, 0.6F, 0.1F, 0.1F, 0.0F, 0.0F, 0.0F), biomeRegistry.getOrThrow(Biomes.OCEAN)), Pair.of( Climate.parameters(0.4F, 0.3F, 0.2F, 0.1F, 0.0F, 0.0F, 0.0F), biomeRegistry.getOrThrow(Biomes.DARK_FOREST)) ))), noiseGenSettings.getOrThrow(NoiseGeneratorSettings.CAVES)); LevelStem stem = new LevelStem(dimTypes.getOrThrow(ModDimensions.LUSTRIA_DIM_TYPE), noiseBasedChunkGenerator); context.register(LUSTRIA_KEY, stem); } } minecraft version is 1.20.1
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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