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"};
private IIcon[] iconArray;
private static final String __OBFID = "CL_00001777";

public CrossBow()
    this.maxStackSize = 1;

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);
    if (event.isCanceled())
    j = event.charge;

    			world.spawnEntityInWorld(new EntityArrow(world, player, 10));


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);
    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;

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");


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 --
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 --
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
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 --
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 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{} [Forge Mod Loader] (forgeSrc-1.7.10- Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{} [Minecraft Forge] (forgeSrc-1.7.10- 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.

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.

  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Minecraft java and forge seem to have it out for me, any ideas? I have had issues with exit code 1 while loading forge -fabric was having the same issues, but I seemed to fix it in these repairs? (tried different versions upwards from 1.19 to 1.20.2 for forge, nothing worked and I'm confident older versions wouldn't either) -The launcher itself loads fine, it will load the game within the launcher, and then crash the moment it tries to load outside of the launcher. I have tried the default launcher, legacy launcher, and the curse forge launcher, none have worked! (all have had the same problem) I think this started when I took a break and upgraded to windows 11 and wonder if that changed anything? I have tried the following: uninstalled & reinstalled java, (I have having issues where I download jdk 17 but only 8 would show up (would not show up anywhere but the control panel, not even the official uninstaller, I *think* I got that fixed) tried jarfix uninstalled & reinstalled minecraft tried alternate launchers -forge & legacy, & repaired them too. tried without mods updated game drivers uninstalled and reinstalled forge -including completely wiping it from my system changed java excutable path followed everything in the error code 1 post completely reset my pc I tried to change the launch path but couldn't seem to get it to work -the default launcher wont let me even see properties as an option, i have yet to try with the other two (i did try on legacy but it was being weird) I want to include my debug log; but its over the max size? sorry my brains gone numb from trying to fix this for the past 2 days
    • I personally create registries using DataPackRegistryEvent.NewRegistry. It's pretty powerful as long as you know how to make codecs. In some class, make a registry key like so: public static final ResourceKey<Registry<MyDataType>> MY_REGISTRY = ResourceKey.createRegistryKey(new ResourceLocation(MyMod.MOD_ID, "registry_name")); This will make a registry that holds objects of type "MyDataType". JSON files stored in data/<datapack_namespace>/modid/registryname/ will be parsed and put into this registry. Note that the directory structure has a folder named after your mod inside your datapack directory, so the actual path would look like: data/my_mod/my_mod/registry_name (or if another mod uses your registry: data/their_mod/my_mod/registry_name. To register this registry, subscribe to the DataPackRegistryEvent.NewRegistry event on the MOD event bus and call event.dataPackRegistry() for every registry you have. An example of what I'm doing for my mod (this is in the constructor for the main mod file): IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener((DataPackRegistryEvent.NewRegistry event) -> { event.dataPackRegistry(ModRegistries.INSULATOR_DATA, InsulatorData.CODEC); }); CODEC is a public static field inside the class for the custom data type I am registering. It holds a Codec<InsulatorData> that tells Minecraft how to serialize/deserialize the data. Most of my data so far can be represented by records, so I use RecordCodecBuilder.create() to do this: public static final Codec<InsulatorData> CODEC = RecordCodecBuilder.create(instance -> instance.group( // Yadda yadda ).apply(instance, InsulatorData::new)); What exactly to put here depends on what you're trying to do, so that's up to you. But basically you're just defining a list of codecs that correspond to the parameters of the record (data type). Most primitive data types have records in the Codec class (ex. Codec.INT) that you can use, and other classes like ResourceLocation have their own codecs as a static field (ex. ResourceLocation.CODEC). Hopefully this is what you're looking for, and that this helps.
    • Good days  I finnaly manage to fix and get a working gui from BlockItem and from BlockEntity the next issues i have to fix is this the block Entity model for some reason is moved to the south west  this briefcase model must be centered but is moved to a side, i have nothing weird in the code but this is happening // ########## ########## ########## ########## @Override public RenderShape getRenderShape(BlockState blkstate) {     return RenderShape.MODEL; } the block model is out of place However The hitBox of the block is right in place   ########################################################################################################### This next issue  Mi gui also adds the 5 slots from the player equipment the thing is theres no filter to determine whats can be put in an armor slot and what not      i have this method that draws the slots for the armor, the part i dont get i slike wheres the code that responds when you set an item in a item slot to do checks and allow the item to be set or not  //########## ########## ########## //Draw Player Armor private void addPlayerArmorSlots(Inventory playerInventory) { // 36 this.addSlot(new Slot(playerInventory, 39, 8, 8)); this.addSlot(new Slot(playerInventory, 38, 8, 26)); this.addSlot(new Slot(playerInventory, 37, 8, 44)); this.addSlot(new Slot(playerInventory, 36, 8, 62)); this.addSlot(new Slot(playerInventory, 40, 26, 53)); }   theres must be a method that triggers when you set a itemstack inside an slot and allows to do a check if its a valid item for that slot                                             
    • No like how do I use my new PreperableReloadListener, I know how to set it up now and register it, I just need to know how to use it in other classes.
    • Completely out of the blue my forge loader is lagging, although at 120 fps. Like when I turn it lags, or hit mobs it lags, or run sometimes although staying at 120 fps. I found another person having a similar problem:  But there was no solution I dont think. I tried everything from: 1. Updating my computer 2. Updating/reinstalling forge 3. Testing if allocated memory was problem (if it was low or high or mid nothing changed) 4. Adding various performance mods 5. Deleting most of my profiles if storage was a problem.   Really not sure what to do next or if forge is just broken for ever for me now.  
  • Topics

  • Create New...

Important Information

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