Jump to content

Getting Icons[1.7.10] SOLVED i++


Recommended Posts

so yeah, basically I am making a custom bow which is pretty simple in my eyes, my problem is that my minecraft I crashing on this line of code "return iconArray[0];" im not sure why it not returning the icon array  but here is the code and crash report. Thanks.

package com.OlympiansMod.Item;

import com.OlympiansMod.lib.Refstrings;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class CrossBow extends Item{ 

public static final String[] bowPullIconNameArray = new String[] {"Crossbow_0", "Crossbow_1", "Crossbow_2"};
@SideOnly(Side.CLIENT)
private IIcon[] iconArray;
private static final String __OBFID = "CL_00001777";

public CrossBow()
{
    this.maxStackSize = 1;
    this.setMaxDamage(384);
    this.setCreativeTab(CreativeTabs.tabCombat);
}


public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int p_77615_4_)
{
    int j = this.getMaxItemUseDuration(stack) - p_77615_4_;

    ArrowLooseEvent event = new ArrowLooseEvent(player, stack, j);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled())
    {
        return;
    }
    j = event.charge;

    if(player.capabilities.isCreativeMode||player.inventory.consumeInventoryItem(Items.arrow))
   
    		if(!world.isRemote){
    			world.spawnEntityInWorld(new EntityArrow(world, player, 10));
    		}
    		return;
    		
    	} 

    



public int getMaxItemUseDuration(ItemStack stack)
{
    return 72000;
}


public EnumAction getItemUseAction(ItemStack stack)
{
    return EnumAction.bow;
}


public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
    ArrowNockEvent event = new ArrowNockEvent(player, stack);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.isCanceled())
    {
        return event.result;
    }

    if (player.capabilities.isCreativeMode || player.inventory.hasItem(Items.arrow))
    {
    	player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
    }

    return stack;
}


public int getItemEnchantability()
{
    return 1;
}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
IIcon[] iconArray;
 iconArray = new IIcon[4];
 iconArray[0] = iconRegister.registerIcon(Refstrings.MODID + ":textures/items/Crossbow_0");
 iconArray[1] = iconRegister.registerIcon(Refstrings.MODID + ":textures/items/Crossbow_1");
 iconArray[2] = iconRegister.registerIcon(Refstrings.MODID + ":textures/items/Crossbow_2");

 }



@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
if (usingItem == null) { return itemIcon; }
int ticksInUse = stack.getMaxItemUseDuration() - useRemaining;
if (ticksInUse > 0) {
return iconArray[0];
} else if (ticksInUse > 13) {
return iconArray[1];
} else if (ticksInUse > 17) {
return iconArray[2];
} else {
return itemIcon;
}
}
}

 

Crash report

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

-- Head --
Stacktrace:
at com.OlympiansMod.Item.CrossBow.getIcon(CrossBow.java:117)
at net.minecraft.entity.player.EntityPlayer.getItemIcon(EntityPlayer.java:2070)
at net.minecraft.client.renderer.ItemRenderer.renderItem(ItemRenderer.java:106)
at net.minecraft.client.renderer.ItemRenderer.renderItemInFirstPerson(ItemRenderer.java:511)
at net.minecraft.client.renderer.EntityRenderer.renderHand(EntityRenderer.java:797)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1437)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player168'/339, l='MpServer', x=102.69, y=65.62, z=206.93]]
Chunk stats: MultiplayerChunkCache: 25, 25
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (224,64,248), Chunk: (at 0,4,8 in 14,15; contains blocks 224,0,240 to 239,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 28567 game time, 15981 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 34 total; [EntityChicken['Chicken'/64, l='MpServer', x=76.41, y=71.00, z=182.41], EntitySkeleton['Skeleton'/65, l='MpServer', x=73.88, y=68.00, z=195.38], EntityXPOrb['Experience Orb'/133, l='MpServer', x=123.44, y=64.25, z=237.29], EntityBat['Bat'/75, l='MpServer', x=81.36, y=43.78, z=160.50], EntityChicken['Chicken'/76, l='MpServer', x=84.41, y=71.00, z=167.10], EntitySkeleton['Skeleton'/77, l='MpServer', x=83.72, y=66.00, z=189.78], EntityChicken['Chicken'/78, l='MpServer', x=80.94, y=72.00, z=178.78], EntitySkeleton['Skeleton'/145, l='MpServer', x=135.22, y=72.00, z=176.31], EntityChicken['Chicken'/87, l='MpServer', x=108.42, y=68.00, z=162.53], EntityCreeper['Creeper'/88, l='MpServer', x=109.84, y=14.00, z=177.88], EntityChicken['Chicken'/89, l='MpServer', x=108.56, y=70.00, z=178.44], EntityChicken['Chicken'/90, l='MpServer', x=100.59, y=64.00, z=205.47], EntityArrow['arrow'/91, l='MpServer', x=108.50, y=64.00, z=203.88], EntityClientPlayerMP['Player168'/339, l='MpServer', x=102.69, y=65.62, z=206.93], EntityArrow['arrow'/92, l='MpServer', x=104.59, y=64.00, z=203.13], EntityArrow['arrow'/93, l='MpServer', x=104.38, y=64.00, z=203.28], EntityArrow['arrow'/94, l='MpServer', x=104.81, y=64.00, z=204.25], EntityArrow['arrow'/95, l='MpServer', x=104.34, y=64.00, z=204.34], EntityArrow['arrow'/96, l='MpServer', x=104.00, y=64.00, z=203.91], EntityArrow['arrow'/97, l='MpServer', x=104.31, y=64.00, z=204.66], EntityArrow['arrow'/98, l='MpServer', x=103.94, y=64.00, z=204.34], EntityArrow['arrow'/99, l='MpServer', x=104.31, y=64.00, z=204.75], EntityArrow['arrow'/100, l='MpServer', x=104.03, y=64.00, z=204.44], EntityArrow['arrow'/101, l='MpServer', x=103.63, y=64.00, z=204.06], EntityArrow['arrow'/102, l='MpServer', x=104.03, y=64.00, z=204.41], EntityArrow['arrow'/103, l='MpServer', x=103.75, y=64.00, z=204.19], EntityArrow['arrow'/104, l='MpServer', x=103.59, y=64.00, z=204.16], EntityArrow['arrow'/105, l='MpServer', x=103.59, y=64.00, z=204.31], EntityArrow['arrow'/106, l='MpServer', x=103.22, y=64.00, z=203.91], EntityXPOrb['Experience Orb'/107, l='MpServer', x=93.83, y=58.25, z=232.25], EntityXPOrb['Experience Orb'/108, l='MpServer', x=98.75, y=57.81, z=236.76], EntityZombie['Zombie'/61, l='MpServer', x=69.56, y=71.00, z=165.66], EntitySpider['Spider'/62, l='MpServer', x=70.50, y=71.00, z=164.41], EntityZombie['Zombie'/63, l='MpServer', x=74.06, y=43.00, z=181.53]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2556)
at net.minecraft.client.Minecraft.run(Minecraft.java:980)
at net.minecraft.client.main.Main.main(Main.java:164)
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 net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_45, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 673182128 bytes (641 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
theolympiansmod{0.1} [The Olympians Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: AMD Radeon HD 8400 GL version 4.3.12804 Compatibility Profile Context 13.352.1004.1007, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

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)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
[22:41:25] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Boone.mcfuzz\Desktop\Olympians Mod\eclipse\.\crash-reports\crash-2015-06-30_22.41.25-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

Im serious don't look at it!!

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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