Jump to content

[SOLVED]1.7.2 Crash with java.lang.ArrayIndexOutOfBoundsException: 64


Recommended Posts

Posted

Hi there I am getting a weird crash every time I enter a world with the ChemicalWaste item in my inventory when I don't have a Hazmat suit in my inventory or if I take the suit out of the inventory. this forces me to delete the world because it's not joinable with out a crash.

 

ItemChemicalWaste

package info.coremodding.realchemics.items;

import info.coremodding.realchemics.creativetabs.RCCreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

/**
* The chemical waste item class
*/
public class ItemChemicalWaste extends Item {

/**
 * An itemstack of this
 */
public static ItemStack ChemicalWaste = new ItemStack(Items.ChemicalWaste);

public void onUpdate(ItemStack itemstack, World world, Entity par3Entity, int par4, boolean par5) {
	EntityPlayer a = ((EntityPlayer)par3Entity);
	//Searches for the ItemChemicalWaste in the player's inventory
	if (a.inventory.hasItemStack(new ItemStack(Items.ChemicalWaste))){

	//Checks if the player has the Hazmat Suit Boots. I only took boots for testing purposes.	
	if (a.inventory.getStackInSlot(100).equals(new ItemStack(Items.ArmorHazmatSuitBoots))) {
		//Only to see if it give the effect
		System.out.println("Giving Effect");

		//Giving Potion effects
		a.addPotionEffect(new PotionEffect(Potion.poison.id, 1000, 3, false));
		a.addPotionEffect(new PotionEffect(Potion.confusion.id, 1000 , 3 ,false));
		a.addPotionEffect(new PotionEffect(Potion.blindness.id, 1000, 3 , false));
		a.addPotionEffect(new PotionEffect(Potion.hunger.id, 1000, 3 , false));
	}

}

}

{
	/**
	 * Set's the Creative Tab of the Item
	 */
	this.setCreativeTab(RCCreativeTabs.tabRealChem);
	this.setUnlocalizedName("itemChemicalWaste");

}
}

 

 

Log

---- Minecraft Crash Report ----
// Why did you do that?

Time: 2014-04-12 01:56
Description: Ticking player

java.lang.ArrayIndexOutOfBoundsException: 64
at net.minecraft.entity.player.InventoryPlayer.getStackInSlot(InventoryPlayer.java:648)
at info.coremodding.realchemics.items.ItemChemicalWaste.onUpdate(ItemChemicalWaste.java:34)
at net.minecraft.item.ItemStack.updateAnimation(ItemStack.java:477)
at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:349)
at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:625)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1820)
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:342)
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341)
at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:326)
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37)
at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:716)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:604)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:742)


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

-- Head --
Stacktrace:
at net.minecraft.entity.player.InventoryPlayer.getStackInSlot(InventoryPlayer.java:648)
at info.coremodding.realchemics.items.ItemChemicalWaste.onUpdate(ItemChemicalWaste.java:34)
at net.minecraft.item.ItemStack.updateAnimation(ItemStack.java:477)
at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:349)
at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:625)
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1820)
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:342)

-- Player being ticked --
Details:
Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
Entity ID: 190
Entity Name: Player703
Entity's Exact location: 564,81, 4,00, 196,32
Entity's Block location: World: (564,4,196), Chunk: (at 4,0,4 in 35,12; contains blocks 560,0,192 to 575,255,207), Region: (1,0; contains chunks 32,0 to 63,31, blocks 512,0,0 to 1023,255,511)
Entity's Momentum: 0,00, -0,08, 0,00
Stacktrace:
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341)
at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:326)
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37)
at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@5880cefe
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:716)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:604)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:742)

-- System Details --
Details:
Minecraft Version: 1.7.2
Operating System: Windows 8 (amd64) version 6.2
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 954064056 bytes (909 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 3297 (184632 bytes; 0 MB) allocated, 3083 (172648 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.01-pre FML v7.2.156.1056 Minecraft Forge 10.12.0.1056 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.2.156.1056} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1056.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.12.0.1056} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1056.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
CoreModding_RealChemics{Not Even A Version Yet!} [Real Chemics] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 436 (24416 bytes; 0 MB) allocated, 402 (22512 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player703'/190, l='New World', x=564,81, y=4,00, z=196,32]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
#@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-04-12_01.56.07-server.txt
[01:56:08] [Client Shutdown Thread/INFO]: Stopping server
[01:56:08] [Client Shutdown Thread/INFO]: Saving players
AL lib: (EE) alc_cleanup: 1 device not closed

Posted

Hi

 

Where does this magic number 100 come from in this line?

if (a.inventory.getStackInSlot(100).equals(new ItemStack(Items.ArmorHazmatSuitBoots))) {

 

Tracing through getStackInSlot I find

    public ItemStack getStackInSlot(int par1)
    {
        ItemStack[] aitemstack = this.mainInventory;

        if (par1 >= aitemstack.length)
        {
            par1 -= aitemstack.length;
            aitemstack = this.armorInventory;
        }

        return aitemstack[par1];
    }

The definition of InventoryPlayer.mainInventory and armorInventory are

    /**
     * An array of 36 item stacks indicating the main player inventory (including the visible bar).
     */
    public ItemStack[] mainInventory = new ItemStack[36];

    /** An array of 4 item stacks containing the currently worn armor pieces. */
    public ItemStack[] armorInventory = new ItemStack[4];

So your error index 64 comes from 100 - 36 = 64 which is bigger than the size of armorInventory.

 

-TGG

 

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

    • I want to create block with entity, that will have height of 3 or more(configurable) and I tried to change first VoxelShape by increasing collision box on height I want and for changing block height on visual side i tried to configure BlockModelBuilder:  base.element() .from(0, 0, 0) .to(16f, 48f, 16f) .face(Direction.UP).texture("#top").end() .face(Direction.DOWN).texture("#bottom").end() .face(Direction.NORTH).texture("#side").end() .face(Direction.SOUTH).texture("#side").end() .face(Direction.WEST).texture("#side").end() .face(Direction.EAST).texture("#side").end() .end(); but, getting crash with next error: Position y out of range, must be within [-16, 32]. Found: %d [48.0]; Looks like game wont to block height modified by more than 32. Is there any way to fix that problem?
    • As long as the packets you are sending aren't lost, there's nothing wrong with what you're currently doing. Although, this sounds like something that would benefit from you making your own datapack registry instead of trying to arbitrarily sync static maps. Check out `DataPackRegistryEvent.NewRegistry`.
    • Hey all, I've been working a lot with datapacks lately, and I'm wondering what the most efficient way to get said data from server to client is.  I'm currently using packets, but given that a lot of the data I'm storing involves maps along the lines of Map<ResourceLocation, CustomDataType>, it can easily start to get messy if I need to transmit a lot of that data all at once. Recently I started looking into the ReloadableServerResources class, which is where Minecraft stores its built-ins.  I see you can access it via the server from the server's resources.managers, and it seems like this can be done even from the client to appropriately retrieve data from the server, unless I'm misunderstanding.  However, from what I can tell, this only works via built-in methods such as getRecipeManager() or getLootTables(), etc.  These are all SimpleJsonResourceReloadListeners, just like my datapack entries are, so it seems like it could be possible for me to access my datapack entries similarly?  But I don't see anywhere in ReloadableServerResources that stores loaded modded entries, so either I'm looking in the wrong place or it doesn't seem to be a thing. Are packets really the best way of doing this, or am I missing a method that would let me use ReloadableServerResources or something similar?
    • Hi, everyone! I'm new to minecraft modding stuff and want ask you some questions. 1. I checked forge references and saw there com.mojang and net.minecraft (not net.minecraftforge) and as I understand it's original game packages with all minecraft logic inside including renderers and so on, right? 2. Does it mean that forge has a limited set of instruments which doesn't cover all the aspects of the game? If make my question more specific then does forge provide such instruments that allow me totally change minecraft itself, like base mechanics and etc.? Or I have to use "original game packages" to implement such things? 3. I actively learning basic concepts with forge documentation and tutorials. So in my plans make different inventory system like in diabloids. Is that possible with forge? 4. It is last question related to the second one. So how deeply I can change minecraft with forge? I guess all my questions above because of that I haven't globally understanding what forge is and how it works inside and how it works with minecraft. It would be great if you provide some links or topics about it or explain it by yourself but I guess it's to big to be explained in that post at once. Anyway, thank you all for any help!
    • Im trying add to block a hole in center, just a usual block and in center of it on up side, there is should be a hole. I tried to add it via BlockModelBuilder, but its not working. Problem is that it only can change block size outside. I tried it to do with VoxelShape and its working, but its has been on server side and looks like its just changed collision shape, but for client, there is a texture covering this hole. I tried to use: base.renderType("cutout"); and removed some pixels from texture. I thought its should work, but game optimization makes block inside looks transparent. So, only custom model?
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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