Jump to content

Recommended Posts

Posted

I have a few problems with my mod while testing it with other mods

 

when I'm trying to do something in my container, it gives me a little error that causes disconnecting

 

It is in my container, while taking somethibng out of my Furnance slot

 

java.lang.IndexOutOfBoundsException: Index: 47, Size: 45

at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_51]

at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_51]

at net.minecraft.inventory.Container.func_75144_a(SourceFile:206) ~[zs.class:?]

at net.minecraft.network.NetHandlerPlayServer.func_147351_a(NetHandlerPlayServer.java:883) ~[nh.class:?]

at net.minecraft.network.play.client.C0EPacketClickWindow.func_148833_a(SourceFile:32) ~[ix.class:?]

at net.minecraft.network.play.client.C0EPacketClickWindow.func_148833_a(SourceFile:10) ~[ix.class:?]

at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) ~[ej.class:?]

at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) [nc.class:?]

at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659) [MinecraftServer.class:?]

at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:334) [lt.class:?]

at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [li.class:?]

[11:17:06] [server thread/INFO] [net.minecraft.network.NetHandlerPlayServer]: Intektor lost connection: TextComponent{text='Internal server error', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}

 

package de.intektor.modarmor.container;

import de.intektor.modarmor.advanced.AdvancedContainer;
import de.intektor.modarmor.advanced.AdvancedResultSlot;
import de.intektor.modarmor.advanced.AdvancedSlot;
import de.intektor.modarmor.tileentity.TileEntityArmorModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntityFurnace;

public class ContainerArmorModifier extends AdvancedContainer{

ItemStack spaceHolderStack = new ItemStack(Items.bed);

public ContainerArmorModifier(InventoryPlayer invPlayer, TileEntityArmorModifier te) {
	tileEntity = te;
	te.container = this;
	theUser = invPlayer.player;
	tileEntity.specialEvent(2, theUser);
	this.addSlotToContainer(new AdvancedSlot(te, 0, 48, 35));
	this.addSlotToContainer(new AdvancedSlot(te, 1, 79, 14));
	this.addSlotToContainer(new AdvancedResultSlot(invPlayer.player, te, 2, 108, 36));
	int i;
	int j;
	for (i = 0; i < 3; ++i)
	{
		for (j = 0; j < 3; ++j)
		{
			this.addSlotToContainer(new AdvancedSlot(te, j + i * 3 + 3, 30 + j * 18, 17 + i * 18));
		}
	}

	this.addSlotToContainer(new AdvancedResultSlot(invPlayer.player, te, 12, 124, 35));

	for (i = 0; i < 3; ++i)
	{
		for (j = 0; j < 9; ++j)
		{
			this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
		}
	}

	for (i = 0; i < 9; ++i)
	{
		this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
	}
}

@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_)
{
	ItemStack itemstack = null;
	Slot slot = (Slot)this.inventorySlots.get(p_82846_2_);

	if (slot != null && slot.getHasStack())
	{
		ItemStack itemstack1 = slot.getStack();
		itemstack = itemstack1.copy();

		if (p_82846_2_ == 2)
		{
			if (!this.mergeItemStack(itemstack1, 3, 39, true))
			{
				return null;
			}

			slot.onSlotChange(itemstack1, itemstack);
		}
		else if (p_82846_2_ != 1 && p_82846_2_ != 0)
		{
			if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null)
			{
				if (!this.mergeItemStack(itemstack1, 0, 1, false))
				{
					return null;
				}
			}
			else if (TileEntityFurnace.isItemFuel(itemstack1))
			{
				if (!this.mergeItemStack(itemstack1, 1, 2, false))
				{
					return null;
				}
			}
			else if (p_82846_2_ >= 3 && p_82846_2_ < 30)
			{
				if (!this.mergeItemStack(itemstack1, 30, 39, false))
				{
					return null;
				}
			}
			else if (p_82846_2_ >= 30 && p_82846_2_ < 39 && !this.mergeItemStack(itemstack1, 3, 30, false))
			{
				return null;
			}
		}
		else if (!this.mergeItemStack(itemstack1, 3, 39, false))
		{
			return null;
		}

		if (itemstack1.stackSize == 0)
		{
			slot.putStack((ItemStack)null);
		}
		else
		{
			slot.onSlotChanged();
		}

		if (itemstack1.stackSize == itemstack.stackSize)
		{
			return null;
		}

		slot.onPickupFromSlot(p_82846_1_, itemstack1);
	}

	return itemstack;
}

@Override
public boolean canInteractWith(EntityPlayer playerIn) {
	return true;
	System.cu
}

@Override
public ItemStack slotClick(int num1, int num2, int num3, EntityPlayer player) {
	tileEntity.specialEvent(2, theUser);
	if(tileEntity instanceof TileEntityArmorModifier){
		TileEntityArmorModifier tileEntity = (TileEntityArmorModifier) this.tileEntity;
		if(player.inventory.getItemStack() == null){
			if(num1 == 2 || num1 == 12){
				if(num1 == 2){
					if(tileEntity.slots[2] != null){
						//							ModArmMod.network.sendToServer(new ClientToServerMessage(1));
						tileEntity.specialEvent(0, null);
					}
				}else if (num1 == 12){
					if(tileEntity.slots[12] != null){
						tileEntity.specialEvent(1, null);
					}
				}
			}
		}
	}
	super.slotClick(num1, num2, num3, player);

	return null;

}


}

 

The whole thing does only happen while plaing with other mods, thats why I didn't see it while coding

 

whole log

 

  Reveal hidden contents

 

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted
  On 8/8/2015 at 10:15 AM, Failender said:

For gods sake use spoiler tags

And show the code for ur slot

 

 

I'm sorry

 

package de.intektor.modarmor.advanced;

import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;

public class AdvancedSlot extends Slot{

private int xNormal;
private int yNormal;
public AdvancedSlot(IInventory inventoryIn, int index, int xPosition, int yPosition) {
	super(inventoryIn, index, xPosition, yPosition);
	xNormal = xPosition;
	yNormal = yPosition;
}

public int getNormalX(){
	return xNormal;
}

public int getNormalY(){
	return yNormal;
}

public void setNormalX(int x){
	xNormal = x;
}

public void setNormalY(int y){
	yNormal = y;
}

public void shootToMoon(){
	this.xDisplayPosition = 100000;
	this.yDisplayPosition = 100000;
}

public void setNormal(){
	this.xDisplayPosition = xNormal;
	this.yDisplayPosition = yNormal;
}
}

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

Its basicly the same

 

package de.intektor.modarmor.advanced;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.SlotFurnace;

public class AdvancedResultSlot extends SlotFurnace{

private int xNormal;
private int yNormal;

public AdvancedResultSlot(EntityPlayer player, IInventory p_i45793_2_, int slotIndex, int xPosition, int yPosition) {
	super(player, p_i45793_2_, slotIndex, xPosition, yPosition);
	xNormal = xPosition;
	yNormal = yPosition;
}

public int getNormalX(){
	return xNormal;
}

public int getNormalY(){
	return yNormal;
}

public void setNormalX(int x){
	xNormal = x;
}

public void setNormalY(int y){
	yNormal = y;
}

public void shootToMoon(){
	this.xDisplayPosition = 100000;
	this.yDisplayPosition = 100000;
}

public void setNormal(){
	this.xDisplayPosition = xNormal;
	this.yDisplayPosition = yNormal;
}
}

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

So I figured now out how this is happening, not why, when there are another mods installed, it seems like it doesn't sychronize the slots with the server anymnore, why I know this? In fact I installed those mods in my developement mods folder and debuged, but I think, some mod has bad code, ore my mod is bad, so please if you have any Idea why my mod stops synchro, please tell

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

java.lang.IndexOutOfBoundsException: Index: 47, Size: 45

 

 

The problem is called out right there. 

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

I fixed that crashing somehow, I don't know, but It doesn't synchro the slots, I mean its working fine when the mod is the only mod, but here, look:

 

@Override
public void updateEntity() {
	System.out.println(slots[0]);
//		if(theUser != null){
//			finishedNBT.setBoolean(theUser.getDisplayName(), true);
//		}
//
//		Side side = FMLCommonHandler.instance().getEffectiveSide();
//		if(side == Side.CLIENT){
//			if(System.currentTimeMillis() - 750 >= switchingTimer){
//				if(switcherNumber == 3){
//					switcherNumber = 0;
//				}else{
//					switcherNumber++;
//				}
//				switchingTimer = System.currentTimeMillis();
//				if(isRecipeinModifierFieldShown){
//					putRecipeinModifierField(currentShownRecipeID);
//				}
//			}
//			if(synchronize){
//				if(areItemStackSaved){
//					loadSaveBack();
//					areItemStackSaved = false;
//				}
//				if(theUser != null){
//					handleResearchState();
//				}
//				if(theUser != null){
//					ItemStack[] sl = new ItemStack[10];
//					for(int i = 0; i < sl.length; i++){
//						sl[i] = slots[i+3];
//						slots[12] = rh2.update(sl, theUser);
//						if(slots[12] != null){
//							if(slots[12].getItem() instanceof ModArmor){
//								if(!slots[12].hasTagCompound()){
//									slots[12].setTagCompound(new NBTTagCompound());
//								}
//								slots[12].getTagCompound().setBoolean(theUser.getDisplayName(), true);
//								slots[12].getTagCompound().setBoolean("FullNow", true);
//							}
//						}
//					}
//					slots[2] = null;
//					if(theUser != null){
//						handleModificationSystem();
//					}
//				}
//			}
//		}
//		if(side == Side.SERVER){
//			if(theUser != null){
//				int research = PlayerProperties.get(theUser).getResearchState();
//				handleResearchState();
//			}
//			if(theUser != null){
//				ItemStack[] sl = new ItemStack[10];
//				for(int i = 0; i < sl.length; i++){
//					sl[i] = slots[i+3];
//				}
//				slots[12] = rh2.update(sl, theUser);
//				if(slots[12] != null){
//					if(slots[12].getItem() instanceof ModArmor){
//						if(!slots[12].hasTagCompound()){
//							slots[12].setTagCompound(new NBTTagCompound());
//						}
//						slots[12].getTagCompound().setBoolean(theUser.getDisplayName(), true);
//						slots[12].getTagCompound().setBoolean("FullNow", true);
//					}
//				}
//			}
//			slots[2] = null;
//			if(theUser != null){
//				handleModificationSystem();
//			}
//		}
}

 

Client:

[15:07:58] [Client thread/INFO] [sTDOUT]: [de.intektor.modarmor.tileentity.TileEntityArmorModifier:updateEntity:87]: 64xtile.stonebrick@0

 

Server:

[15:08:38] [server thread/INFO] [sTDOUT]: [de.intektor.modarmor.tileentity.TileEntityArmorModifier:updateEntity:87]: null

 

 

 

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

I have no idea what or why you are doing all that.

 

For a container and Gui look at the standard tutorials

Need an inventory

Need a container that utilizes this inventory and the player inventory to build

Need a gui for the above.

Need a guihandler

 

What entity are you updating?  Is this inventory in a custom entity you made or a tilentity?  If its a customentity, you will need a packet to update the client.  If its a tile, then setblockforupdate works fine.

Long time Bukkit & Forge Programmer

Happy to try and help

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.