Hello,
I recently have tried making a block with Meta Data. After countless attempts of getting a console error of the same slot being occupied, I finally seemed to get that error. Instead, I get a crash when I try to start the game:
---- Minecraft Crash Report ----
// Sorry
Time: 6/14/13 10:42 PM
Description: Failed to start game
java.lang.ArrayIndexOutOfBoundsException: 3
at pikadex.oremod.BlockCoreOre.registerIcons(BlockCoreOre.java:37)
at net.minecraft.client.renderer.texture.TextureMap.refreshTextures(TextureMap.java:68)
at net.minecraft.client.renderer.RenderEngine.refreshTextureMaps(RenderEngine.java:520)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:443)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:732)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.5.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_21, Oracle Corporation
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1000472896 bytes (954 MB) / 1065025536 bytes (1015 MB) up to 1065025536 bytes (1015 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.51 FML v5.2.2.684 Minecraft Forge 7.8.0.684 4 mods loaded, 4 mods active
mcp{7.44} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{5.2.2.684} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized
Forge{7.8.0.684} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized
pikadexOres{v1.0 Alpha} [Minology] (bin) Unloaded->Constructed->Pre-initialized
LWJGL: 2.4.2
OpenGL: GeForce GT 520/PCIe/SSE2 GL version 4.3.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
You may see that I bolded the following:
java.lang.ArrayIndexOutOfBoundsException: 3
at pikadex.oremod.BlockCoreOre.registerIcons(BlockCoreOre.java:37)
From this, I know that this is referring to my BlockCoreOre class. I'm not sure what it is I need to change, but I know I need to do something with it. If it's any help, I am trying to make 3 blocks using the same metadata, eventually 4 or 5.
package pikadex.oremod;
import java.util.List;
import java.util.Random;
import org.bouncycastle.asn1.cms.MetaData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
public class BlockCoreOre extends Block {
public BlockCoreOre(int id, Material material) {
super(id, material);
}
public int quantityDropped(Random rand) {
return 1;
}
@SideOnly(Side.CLIENT)
private Icon[] oreIcons;
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
oreIcons = new Icon[3];
for(int i = 0; 0 < oreIcons.length; i++) {
oreIcons[i] = par1IconRegister.registerIcon(PikadexOres.modid + ":" + this.getUnlocalizedName().substring(5) + i);
}
}
@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2) {
return oreIcons[par2];
}
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for(int i = 0; i < 1; i++) {
par3List.add(new ItemStack(par1, 0, i));
}
}
}
If you feel that you may need code from any other classes to sort out the problem, please notify me so I can add it.
Okay, to the point, I would like to know what I have to do in order to fix my class, and what I need to do in order to add more blocks in.
I recently have tried making a block with Meta Data. After countless attempts of getting a console error of the same slot being occupied, I finally seemed to get that error. Instead, I get a crash when I try to start the game:
// Sorry
Time: 6/14/13 10:42 PM
Description: Failed to start game
java.lang.ArrayIndexOutOfBoundsException: 3
at pikadex.oremod.BlockCoreOre.registerIcons(BlockCoreOre.java:37)
at net.minecraft.client.renderer.texture.TextureMap.refreshTextures(TextureMap.java:68)
at net.minecraft.client.renderer.RenderEngine.refreshTextureMaps(RenderEngine.java:520)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:443)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:732)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.5.2
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_21, Oracle Corporation
Java VM Version: Java HotSpotâ„¢ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1000472896 bytes (954 MB) / 1065025536 bytes (1015 MB) up to 1065025536 bytes (1015 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.51 FML v5.2.2.684 Minecraft Forge 7.8.0.684 4 mods loaded, 4 mods active
mcp{7.44} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized
FML{5.2.2.684} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized
Forge{7.8.0.684} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized
pikadexOres{v1.0 Alpha} [Minology] (bin) Unloaded->Constructed->Pre-initialized
LWJGL: 2.4.2
OpenGL: GeForce GT 520/PCIe/SSE2 GL version 4.3.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null
You may see that I bolded the following:
java.lang.ArrayIndexOutOfBoundsException: 3
at pikadex.oremod.BlockCoreOre.registerIcons(BlockCoreOre.java:37)
From this, I know that this is referring to my BlockCoreOre class. I'm not sure what it is I need to change, but I know I need to do something with it. If it's any help, I am trying to make 3 blocks using the same metadata, eventually 4 or 5.
If you feel that you may need code from any other classes to sort out the problem, please notify me so I can add it.
Okay, to the point, I would like to know what I have to do in order to fix my class, and what I need to do in order to add more blocks in.
Thanks,
Pikadex
It should be i < oreIcons.length;, or else it will keep going on forever.
Whoops! Guess I didn't notice that. It works now; thanks.