Jump to content

Recommended Posts

Posted

Hello!

 

I am trying to make a 3x5 crafting table, I should have everything working but when I rightclick to open the gui of it, all it says is:

A mod tried to open a gui on the server without being a NetworkMod

Please help me!

 

Main class:

@Mod(modid = MainModBE.modid, name = "BE mods", version = "Pre-alpha v0.001")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MainModBE {

    public static final String modid = "beautifulexistence";

    @EventHandler
    public void preInit(FMLPreInitializationEvent e) {
        NetworkRegistry.instance().registerGuiHandler(MainModBE.instance, new GuiHandler());
}
    
    @Instance("MainModBE")
    public static MainModBE instance;

 

Gui Handler:

public class GuiHandler implements IGuiHandler {

@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {

switch(id)
{
case 1: return id == 1 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new ContainerBigCrafting(player.inventory, world, x, y, z) : null;
}
return null;
}

@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {

switch(id)
{
case 1: return id == 1 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new GuiBigCrafting(player.inventory, world, x, y, z) : null;
}
return null;
}
}

 

Crafting table block:

public class blockCraftingTable extends Block{

@SideOnly(Side.CLIENT)
private Icon workbenchIconTop;
@SideOnly(Side.CLIENT)
private Icon workbenchIconFront;

public blockCraftingTable(int id, Material par2Material) {
      super(id, par2Material);
      this.setCreativeTab(MainModBE.BETab);
	}

@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2) {
return par1 == 1 ? this.workbenchIconTop : (par1 == 0 ? Block.planks.getBlockTextureFromSide(par1) : (par1 != 2 && par1 != 4 ? this.blockIcon : this.workbenchIconFront));
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
this.blockIcon = par1IconRegister.registerIcon("beautifulexistence:CraftingTableSide");
this.workbenchIconTop = par1IconRegister.registerIcon("beautifulexistence:CraftingTableTop");
this.workbenchIconFront = par1IconRegister.registerIcon("beautifulexistence:CraftingTableFront");
}

public boolean onBlockActivated(World var1, int var2, int var3, int var4, EntityPlayer player, int var6, float var7, float var8, float var9) {
if (!player.isSneaking()) {
player.openGui(MainModBE.instance, 1, var1, var2, var3, var4);
return true; 
}else{
return false;
}
}
}

 

Gui big crafting:

public class GuiBigCrafting extends GuiContainer
{

public GuiBigCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerBigCrafting(par1InventoryPlayer, par2World, par3, par4, par5));
}
public static String GuiTexturePrefix = "beautifulexistence" + ":" + "textures/gui/";

public static ResourceLocation BigCrafting = new ResourceLocation(GuiTexturePrefix + "BigCraftingTable.png");


protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString("Big Crafting Table", 40 + 5, - 10 - 10, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 50 + 14, this.ySize - 96 - 10 - 19, 4210752);
}


protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{

this.mc.getTextureManager().bindTexture(BigCrafting);

this.ySize = 231;
this.xSize = 176;

int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
int var7;

this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}

 

Container:

public class ContainerBigCrafting extends Container
{
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 5);
public IInventory craftResult = new InventoryCraftResult();
private World worldObj;
private int posX;
private int posY;
private int posZ;

public ContainerBigCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
this.worldObj = par2World;
this.posX = par3;
this.posY = par4;
this.posZ = par5;
this.addSlotToContainer(new SlotBigCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 124 + 8, 35 + 1));
int var6;
int var7;

for (var6 = 0; var6 < 5; ++var6)
{
for (var7 = 0; var7 < 3; ++var7)
{
this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18 - 17));
}
}

for (var6 = 0; var6 < 3; ++var6)
{
for (var7 = 0; var7 < 9; ++var7)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18 , 84 + var6 * 18 + 33));
}
}

for (var6 = 0; var6 < 9; ++var6)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18 , 142 + 10 + 23));
}

this.onCraftMatrixChanged(this.craftMatrix);
}

public void onCraftMatrixChanged(IInventory par1IInventory)
{
this.craftResult.setInventorySlotContents(0, CraftingBigManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
}

public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != MainModBE.blockCraftingTable.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
}

public void onContainerClosed(EntityPlayer par1EntityPlayer)
{
super.onContainerClosed(par1EntityPlayer);

if (!this.worldObj.isRemote)
{
for (int i = 0; i < 15; ++i)
{
ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

if (itemstack != null)
{
par1EntityPlayer.dropPlayerItem(itemstack);
}
}
}
}

public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot)this.inventorySlots.get(par2);

if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();

if (par2 == 0)
{
if (!this.mergeItemStack(var5, 10, 46, true))
{
return null;
}

var4.onSlotChange(var5, var3);
}
else if (par2 >= 10 && par2 < 37)
{
if (!this.mergeItemStack(var5, 37, 46, false))
{
return null;
}
}
else if (par2 >= 37 && par2 < 46)
{
if (!this.mergeItemStack(var5, 10, 37, false))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 10, 46, false))
{
return null;
}

if (var5.stackSize == 0)
{
var4.putStack((ItemStack)null);
}
else
{
var4.onSlotChanged();
}

if (var5.stackSize == var3.stackSize)
{
return null;
}

var4.onPickupFromSlot(par1EntityPlayer, var5);
}

return var3;
}


public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot)
{
return par2Slot.inventory != this.craftResult && super.func_94530_a(par1ItemStack, par2Slot);
}
}

 

I think that's the code you need. Otherwise it's just crafting handlers.

I really hope that I can get some help, I have searched everywhere on internet and not found anything...

Posted

1) Always post updated code.

2) Remove all the useless checks in your GuiHandler:

case 1: return id == 1

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

1) Always post updated code.

2) Remove all the useless checks in your GuiHandler:

case 1: return id == 1

 

Nope still says the same thing :/

I think this is really weird and I have no idea what is wrong...

 

Main Class:

@Mod(modid = MainModBE.modid, name = "BE mods", version = "Pre-alpha v0.001")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MainModBE {

    public static final String modid = "beautifulexistence";

    @EventHandler
    public void preInit(FMLPreInitializationEvent e) {
        NetworkRegistry.instance().registerGuiHandler(MainModBE.instance, new GuiHandler());
}
    
    @Instance("beautifulexistance")
    public static MainModBE instance;

 

Gui Handler:

public class GuiHandler implements IGuiHandler {

@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {

switch(id) {
}
return null;
}

@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {

switch(id) {
}
return null;
}
}

 

Crafting table block:

public class blockCraftingTable extends Block{

@SideOnly(Side.CLIENT)
private Icon workbenchIconTop;
@SideOnly(Side.CLIENT)
private Icon workbenchIconFront;

public blockCraftingTable(int id, Material par2Material) {
      super(id, par2Material);
      this.setCreativeTab(MainModBE.BETab);
	}

@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2) {
return par1 == 1 ? this.workbenchIconTop : (par1 == 0 ? Block.planks.getBlockTextureFromSide(par1) : (par1 != 2 && par1 != 4 ? this.blockIcon : this.workbenchIconFront));
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
this.blockIcon = par1IconRegister.registerIcon("beautifulexistence:CraftingTableSide");
this.workbenchIconTop = par1IconRegister.registerIcon("beautifulexistence:CraftingTableTop");
this.workbenchIconFront = par1IconRegister.registerIcon("beautifulexistence:CraftingTableFront");
}

public boolean onBlockActivated(World var1, int var2, int var3, int var4, EntityPlayer player, int var6, float var7, float var8, float var9) {
if (!player.isSneaking()) {
player.openGui(MainModBE.instance, 1, var1, var2, var3, var4);
return true; 
}else{
return false;
}
}
}

 

Crafting Gui:

public class GuiBigCrafting extends GuiContainer
{

public GuiBigCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerBigCrafting(par1InventoryPlayer, par2World, par3, par4, par5));
}
public static String GuiTexturePrefix = "beautifulexistence" + ":" + "textures/gui/";

public static ResourceLocation BigCrafting = new ResourceLocation(GuiTexturePrefix + "BigCraftingTable.png");


protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString("Big Crafting Table", 40 + 5, - 10 - 10, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 50 + 14, this.ySize - 96 - 10 - 19, 4210752);
}


protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{

this.mc.getTextureManager().bindTexture(BigCrafting);

this.ySize = 231;
this.xSize = 176;

int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
int var7;

this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}

 

Container:

public class ContainerBigCrafting extends Container
{
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 5);
public IInventory craftResult = new InventoryCraftResult();
private World worldObj;
private int posX;
private int posY;
private int posZ;

public ContainerBigCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
this.worldObj = par2World;
this.posX = par3;
this.posY = par4;
this.posZ = par5;
this.addSlotToContainer(new SlotBigCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 124 + 8, 35 + 1));
int var6;
int var7;

for (var6 = 0; var6 < 5; ++var6)
{
for (var7 = 0; var7 < 3; ++var7)
{
this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18 - 17));
}
}

for (var6 = 0; var6 < 3; ++var6)
{
for (var7 = 0; var7 < 9; ++var7)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18 , 84 + var6 * 18 + 33));
}
}

for (var6 = 0; var6 < 9; ++var6)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18 , 142 + 10 + 23));
}

this.onCraftMatrixChanged(this.craftMatrix);
}

public void onCraftMatrixChanged(IInventory par1IInventory)
{
this.craftResult.setInventorySlotContents(0, CraftingBigManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
}

public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != MainModBE.blockCraftingTable.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
}

public void onContainerClosed(EntityPlayer par1EntityPlayer)
{
super.onContainerClosed(par1EntityPlayer);

if (!this.worldObj.isRemote)
{
for (int i = 0; i < 15; ++i)
{
ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

if (itemstack != null)
{
par1EntityPlayer.dropPlayerItem(itemstack);
}
}
}
}

public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot)this.inventorySlots.get(par2);

if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();

if (par2 == 0)
{
if (!this.mergeItemStack(var5, 10, 46, true))
{
return null;
}

var4.onSlotChange(var5, var3);
}
else if (par2 >= 10 && par2 < 37)
{
if (!this.mergeItemStack(var5, 37, 46, false))
{
return null;
}
}
else if (par2 >= 37 && par2 < 46)
{
if (!this.mergeItemStack(var5, 10, 37, false))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 10, 46, false))
{
return null;
}

if (var5.stackSize == 0)
{
var4.putStack((ItemStack)null);
}
else
{
var4.onSlotChanged();
}

if (var5.stackSize == var3.stackSize)
{
return null;
}

var4.onPickupFromSlot(par1EntityPlayer, var5);
}

return var3;
}


public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot)
{
return par2Slot.inventory != this.craftResult && super.func_94530_a(par1ItemStack, par2Slot);
}
}

 

Slots:

public class SlotBigCrafting extends Slot
{
private final IInventory craftMatrix;

private EntityPlayer thePlayer;

private int amountCrafted;

public SlotBigCrafting(EntityPlayer par1EntityPlayer, IInventory par2IInventory, IInventory par3IInventory, int par4, int par5, int par6)
{
super(par3IInventory, par4, par5, par6);
this.thePlayer = par1EntityPlayer;
this.craftMatrix = par2IInventory;
}

public boolean isItemValid(ItemStack par1ItemStack)
{
return false;
}

public ItemStack decrStackSize(int par1)
{
if (this.getHasStack())
{
this.amountCrafted += Math.min(par1, this.getStack().stackSize);
}

return super.decrStackSize(par1);
}

protected void onCrafting(ItemStack par1ItemStack, int par2)
{
this.amountCrafted += par2;
this.onCrafting(par1ItemStack);
}

public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
{
GameRegistry.onItemCrafted(par1EntityPlayer, par2ItemStack, craftMatrix);
this.onCrafting(par2ItemStack);

for (int var3 = 0; var3 < this.craftMatrix.getSizeInventory(); ++var3)
{
ItemStack var4 = this.craftMatrix.getStackInSlot(var3);

if (var4 != null)
{
this.craftMatrix.decrStackSize(var3, 1);

if (var4.getItem().hasContainerItem())
{
ItemStack var5 = var4.getItem().getContainerItemStack(var4);

if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage())
{
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, var5));
var5 = null;
}

if (var5 != null && (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4) || !this.thePlayer.inventory.addItemStackToInventory(var5)))
{
if (this.craftMatrix.getStackInSlot(var3) == null)
{
this.craftMatrix.setInventorySlotContents(var3, var5);
}
else
{
this.thePlayer.dropPlayerItem(var5);
}
}
}
}
}
}
}

Posted

You are now returning no GUI at all in your GuiHandler. I only said to remove the useless checks, because  your checking that if the case is 1, if the case is 1, and then you return the gui. (Yeah, you read that good.)

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

You are now returning no GUI at all in your GuiHandler. I only said to remove the useless checks, because  your checking that if the case is 1, if the case is 1, and then you return the gui. (Yeah, you read that good.)

 

Haha, yeah... That was a big fail.

But I've tried possibly every method except the correct one and I just can't figure it out.

Nothing works, it keeps giving me the same error:

A mod tried to open a gui on the server without being a NetworkMod

But it should work since It is a network mod...

 

@Mod(modid = MainModBE.modid, name = "BE mods", version = "Pre-alpha v0.001")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MainModBE {

    public static final String modid = "beautifulexistence";

    @EventHandler
    public void preInit(FMLPreInitializationEvent e) {
        NetworkRegistry.instance().registerGuiHandler(MainModBE.instance, new GuiHandler());
}
    
    @Instance("beautifulexistance")
    public static MainModBE instance;

 

So I have no idea what to do...

 

Here is what i tried in the GuiHandler:

package net.be.mods;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler {

@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
return id == 1 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new ContainerBigCrafting(player.inventory, world, x, y, z) : null;
}

@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
return id == 1 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new GuiBigCrafting(player.inventory, world, x, y, z) : null;
}
}

Posted

You are now returning no GUI at all in your GuiHandler. I only said to remove the useless checks, because  your checking that if the case is 1, if the case is 1, and then you return the gui. (Yeah, you read that good.)

 

Now I've also tried this(I only changed the code in the class I'm showing):

public class GuiHandler implements IGuiHandler
{
        @Override
        public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
        {
                TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
                switch(id)
                {
                        case 0: return id == 0 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new ContainerBigCrafting(player.inventory, world, x, y, z) : null;
                        case 1: return new ContainerBigCrafting(null, world, x, y, z);
                }
                return null;
                }
        @Override
        public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
        {
                TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
                switch(id)
                {
                        case 0: return id == 0 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new GuiBigCrafting(player.inventory, world, x, y, z) : null;
                        case 1: return new GuiBigCrafting(player.inventory, world, x, y, z);
                }
                return null;
        }
}

Posted

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

 

You should set the "serverSideRequired" to true.

since you are using GUI, you have to make your mod as Universal.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

 

You should set the "serverSideRequired" to true.

since you are using GUI, you have to make your mod as Universal.

 

I changed the "serverSideRequired" to true but nothing changed, still says the same thing when I try to open it...

I am really confused over why it's not working...

I haven't set an id for the gui, could it be that?

Posted

I think this is really weird and I have no idea what is wrong...

 

Main Class:

public static final String modid = "beautifulexistence";

@Instance("beautifulexistance")
public static MainModBE instance;

<cough> misspelling <cough>

 

Seriously, what's the point of defining a constant when you don't use it? One of the main benefits of constants is to prevent just this sort of error from happening.

Posted

I think this is really weird and I have no idea what is wrong...

 

Main Class:

public static final String modid = "beautifulexistence";

@Instance("beautifulexistance")
public static MainModBE instance;

<cough> misspelling <cough>

 

Seriously, what's the point of defining a constant when you don't use it? One of the main benefits of constants is to prevent just this sort of error from happening.

 

Haha, I feel like the biggest dumbass ever...

 

Now it just crashes when I rightclick the block.

 

Crash report:

---- Minecraft Crash Report ----
// Everything's going to plan. No, really, that was supposed to happen.

Time: 2014-04-07 12:03
Description: Unexpected error

java.lang.ExceptionInInitializerError
at net.be.mods.ContainerBigCrafting.onCraftMatrixChanged(ContainerBigCrafting.java:62)
at net.be.mods.ContainerBigCrafting.<init>(ContainerBigCrafting.java:53)
at net.be.mods.GuiBigCrafting.<init>(GuiBigCrafting.java:14)
at net.be.mods.GuiHandler.getClientGuiElement(GuiHandler.java:28)
at cpw.mods.fml.common.network.NetworkRegistry.openLocalGui(NetworkRegistry.java:341)
at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:375)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2555)
at net.be.mods.block.blockCraftingTable.onBlockActivated(blockCraftingTable.java:39)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:373)
at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1390)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1870)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:910)
at net.minecraft.client.Minecraft.run(Minecraft.java:839)
at net.minecraft.client.main.Main.main(Main.java:93)
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:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.charAt(Unknown Source)
at net.be.mods.CraftingBigManager.addShapedRecipe(CraftingBigManager.java:199)
at net.be.mods.CraftingBigManager.<init>(CraftingBigManager.java:92)
at net.be.mods.CraftingBigManager.<clinit>(CraftingBigManager.java:17)
... 20 more


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

-- Head --
Stacktrace:
at net.be.mods.ContainerBigCrafting.onCraftMatrixChanged(ContainerBigCrafting.java:62)
at net.be.mods.ContainerBigCrafting.<init>(ContainerBigCrafting.java:53)
at net.be.mods.GuiBigCrafting.<init>(GuiBigCrafting.java:14)
at net.be.mods.GuiHandler.getClientGuiElement(GuiHandler.java:28)
at cpw.mods.fml.common.network.NetworkRegistry.openLocalGui(NetworkRegistry.java:341)
at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:375)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2555)
at net.be.mods.block.blockCraftingTable.onBlockActivated(blockCraftingTable.java:39)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:373)
at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1390)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player339'/73, l='MpServer', x=272,37, y=5,62, z=-561,17]]
Chunk stats: MultiplayerChunkCache: 441
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options: 
Level spawn location: World: (265,4,-558), Chunk: (at 9,0,2 in 16,-35; contains blocks 256,0,-560 to 271,255,-545), Region: (0,-2; contains chunks 0,-64 to 31,-33, blocks 0,0,-1024 to 511,255,-513)
Level time: 342927 game time, 84193 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: survival (ID 0). Hardcore: false. Cheats: false
Forced entities: 58 total; [EntityChicken['Chicken'/5, l='MpServer', x=204,53, y=4,00, z=-546,47], EntityPig['Pig'/6, l='MpServer', x=199,16, y=4,00, z=-517,19], EntityPig['Pig'/8, l='MpServer', x=221,66, y=4,00, z=-489,81], EntityPig['Pig'/13, l='MpServer', x=238,28, y=4,00, z=-512,09], EntityItemFrame['entity.ItemFrame.name'/17, l='MpServer', x=255,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/16, l='MpServer', x=255,50, y=5,50, z=-559,06], EntityPig['Pig'/19, l='MpServer', x=243,03, y=4,00, z=-539,16], EntityItemFrame['entity.ItemFrame.name'/18, l='MpServer', x=255,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/21, l='MpServer', x=257,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/20, l='MpServer', x=256,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/23, l='MpServer', x=258,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/22, l='MpServer', x=258,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/25, l='MpServer', x=256,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/24, l='MpServer', x=257,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/27, l='MpServer', x=258,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/26, l='MpServer', x=257,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/29, l='MpServer', x=256,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/28, l='MpServer', x=269,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/31, l='MpServer', x=269,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/30, l='MpServer', x=269,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/34, l='MpServer', x=267,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/35, l='MpServer', x=267,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/32, l='MpServer', x=268,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/33, l='MpServer', x=268,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/38, l='MpServer', x=266,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/39, l='MpServer', x=265,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/36, l='MpServer', x=267,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/37, l='MpServer', x=266,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/42, l='MpServer', x=264,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/43, l='MpServer', x=264,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/40, l='MpServer', x=265,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/41, l='MpServer', x=264,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/46, l='MpServer', x=263,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/47, l='MpServer', x=262,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/44, l='MpServer', x=263,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/45, l='MpServer', x=263,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/51, l='MpServer', x=261,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/50, l='MpServer', x=261,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/49, l='MpServer', x=262,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/48, l='MpServer', x=262,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/55, l='MpServer', x=259,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/54, l='MpServer', x=259,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/53, l='MpServer', x=260,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/52, l='MpServer', x=261,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/59, l='MpServer', x=268,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/58, l='MpServer', x=260,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/57, l='MpServer', x=260,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/56, l='MpServer', x=259,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/63, l='MpServer', x=270,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/62, l='MpServer', x=271,50, y=6,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/61, l='MpServer', x=271,50, y=4,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/60, l='MpServer', x=270,50, y=4,50, z=-559,06], EntitySheep['Sheep'/68, l='MpServer', x=318,70, y=4,00, z=-493,64], EntityItemFrame['entity.ItemFrame.name'/64, l='MpServer', x=271,50, y=5,50, z=-559,06], EntityItemFrame['entity.ItemFrame.name'/65, l='MpServer', x=270,50, y=5,50, z=-559,06], EntityBat['Bat'/66, l='MpServer', x=289,75, y=5,10, z=-561,25], EntityBat['Bat'/67, l='MpServer', x=289,75, y=5,10, z=-561,47], EntityClientPlayerMP['Player339'/73, l='MpServer', x=272,37, y=5,62, z=-561,17]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2312)
at net.minecraft.client.Minecraft.run(Minecraft.java:864)
at net.minecraft.client.main.Main.main(Main.java:93)
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:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)

-- System Details --
Details:
Minecraft Version: 1.6.4
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 642756560 bytes (612 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 13641 (763896 bytes; 0 MB) allocated, 5 (280 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 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{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
beautifulexistence{Pre-alpha v0.001} [bE mods] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: AMD Radeon HD 7570 GL version 4.2.11476 Compatibility Profile Context, ATI Technologies Inc.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Pack: Default
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 89 (4984 bytes; 0 MB) allocated, 26 (1456 bytes; 0 MB) used

 

GuiHandler:

public class GuiHandler implements IGuiHandler
{
        @Override
        public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
        {
                TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
                switch(id)
                {
                        case 0: return id == 0 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new ContainerBigCrafting(player.inventory, world, x, y, z) : null;
                        case 1: return new ContainerBigCrafting(null, world, x, y, z);
                }
                return null;
                }
        @Override
        public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
        {
                TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
                switch(id)
                {
                        case 0: return id == 0 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new GuiBigCrafting(player.inventory, world, x, y, z) : null;
                        case 1: return new GuiBigCrafting(player.inventory, world, x, y, z);
                }
                return null;
        }
}

 

MainMod:

@Mod(modid = MainModBE.modid, name = "BE mods", version = "Pre-alpha v0.001")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class MainModBE {

    public static final String modid = "beautifulexistence";

    @EventHandler
    public void preInit(FMLPreInitializationEvent e) {
        NetworkRegistry.instance().registerGuiHandler(MainModBE.instance, new GuiHandler());
}
    
    @Instance("beautifulexistence")
    public static MainModBE instance;

 

Crafting table:

public class blockCraftingTable extends Block{

@SideOnly(Side.CLIENT)
private Icon workbenchIconTop;
@SideOnly(Side.CLIENT)
private Icon workbenchIconFront;

public blockCraftingTable(int id, Material par2Material) {
      super(id, par2Material);
      this.setCreativeTab(MainModBE.BETab);
	}

@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2) {
return par1 == 1 ? this.workbenchIconTop : (par1 == 0 ? Block.planks.getBlockTextureFromSide(par1) : (par1 != 2 && par1 != 4 ? this.blockIcon : this.workbenchIconFront));
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
this.blockIcon = par1IconRegister.registerIcon("beautifulexistence:CraftingTableSide");
this.workbenchIconTop = par1IconRegister.registerIcon("beautifulexistence:CraftingTableTop");
this.workbenchIconFront = par1IconRegister.registerIcon("beautifulexistence:CraftingTableFront");
}

public boolean onBlockActivated(World var1, int var2, int var3, int var4, EntityPlayer player, int var6, float var7, float var8, float var9) {
if (!player.isSneaking()) {
player.openGui(MainModBE.instance, 1, var1, var2, var3, var4);
return true; 
}else{
return false;
}
}
}

 

Gui Container:

public class GuiBigCrafting extends GuiContainer
{

public GuiBigCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerBigCrafting(par1InventoryPlayer, par2World, par3, par4, par5));
}
public static String GuiTexturePrefix = "beautifulexistence" + ":" + "textures/gui/";

public static ResourceLocation BigCrafting = new ResourceLocation(GuiTexturePrefix + "BigCraftingTable.png");


protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString("Big Crafting Table", 40 + 5, - 10 - 10, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 50 + 14, this.ySize - 96 - 10 - 19, 4210752);
}


protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{

this.mc.getTextureManager().bindTexture(BigCrafting);

this.ySize = 231;
this.xSize = 176;

int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
int var7;

this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}

 

Container:

public class ContainerBigCrafting extends Container
{
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 5);
public IInventory craftResult = new InventoryCraftResult();
private World worldObj;
private int posX;
private int posY;
private int posZ;

public ContainerBigCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
this.worldObj = par2World;
this.posX = par3;
this.posY = par4;
this.posZ = par5;
this.addSlotToContainer(new SlotBigCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 124 + 8, 35 + 1));
int var6;
int var7;

for (var6 = 0; var6 < 5; ++var6)
{
for (var7 = 0; var7 < 3; ++var7)
{
this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18 - 17));
}
}

for (var6 = 0; var6 < 3; ++var6)
{
for (var7 = 0; var7 < 9; ++var7)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18 , 84 + var6 * 18 + 33));
}
}

for (var6 = 0; var6 < 9; ++var6)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18 , 142 + 10 + 23));
}

this.onCraftMatrixChanged(this.craftMatrix);
}

public ContainerBigCrafting(InventoryPlayer inventory, BigTileEntity tileEntity) {
// TODO Auto-generated constructor stub
}

public void onCraftMatrixChanged(IInventory par1IInventory)
{
this.craftResult.setInventorySlotContents(0, CraftingBigManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
}

public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != MainModBE.blockCraftingTable.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
}

public void onContainerClosed(EntityPlayer par1EntityPlayer)
{
super.onContainerClosed(par1EntityPlayer);

if (!this.worldObj.isRemote)
{
for (int i = 0; i < 15; ++i)
{
ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

if (itemstack != null)
{
par1EntityPlayer.dropPlayerItem(itemstack);
}
}
}
}

public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot)this.inventorySlots.get(par2);

if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();

if (par2 == 0)
{
if (!this.mergeItemStack(var5, 10, 46, true))
{
return null;
}

var4.onSlotChange(var5, var3);
}
else if (par2 >= 10 && par2 < 37)
{
if (!this.mergeItemStack(var5, 37, 46, false))
{
return null;
}
}
else if (par2 >= 37 && par2 < 46)
{
if (!this.mergeItemStack(var5, 10, 37, false))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 10, 46, false))
{
return null;
}

if (var5.stackSize == 0)
{
var4.putStack((ItemStack)null);
}
else
{
var4.onSlotChanged();
}

if (var5.stackSize == var3.stackSize)
{
return null;
}

var4.onPickupFromSlot(par1EntityPlayer, var5);
}

return var3;
}


public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot)
{
return par2Slot.inventory != this.craftResult && super.func_94530_a(par1ItemStack, par2Slot);
}
}

 

Slots:

public class SlotBigCrafting extends Slot
{
private final IInventory craftMatrix;

private EntityPlayer thePlayer;

private int amountCrafted;

public SlotBigCrafting(EntityPlayer par1EntityPlayer, IInventory par2IInventory, IInventory par3IInventory, int par4, int par5, int par6)
{
super(par3IInventory, par4, par5, par6);
this.thePlayer = par1EntityPlayer;
this.craftMatrix = par2IInventory;
}

public boolean isItemValid(ItemStack par1ItemStack)
{
return false;
}

public ItemStack decrStackSize(int par1)
{
if (this.getHasStack())
{
this.amountCrafted += Math.min(par1, this.getStack().stackSize);
}

return super.decrStackSize(par1);
}

protected void onCrafting(ItemStack par1ItemStack, int par2)
{
this.amountCrafted += par2;
this.onCrafting(par1ItemStack);
}

public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
{
GameRegistry.onItemCrafted(par1EntityPlayer, par2ItemStack, craftMatrix);
this.onCrafting(par2ItemStack);

for (int var3 = 0; var3 < this.craftMatrix.getSizeInventory(); ++var3)
{
ItemStack var4 = this.craftMatrix.getStackInSlot(var3);

if (var4 != null)
{
this.craftMatrix.decrStackSize(var3, 1);

if (var4.getItem().hasContainerItem())
{
ItemStack var5 = var4.getItem().getContainerItemStack(var4);

if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage())
{
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, var5));
var5 = null;
}

if (var5 != null && (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4) || !this.thePlayer.inventory.addItemStackToInventory(var5)))
{
if (this.craftMatrix.getStackInSlot(var3) == null)
{
this.craftMatrix.setInventorySlotContents(var3, var5);
}
else
{
this.thePlayer.dropPlayerItem(var5);
}
}
}
}
}
}
}

Posted

public static final String modid = "beautifulexistence";

@Instance("beautifulexistence")

public static String GuiTexturePrefix = "beautifulexistence" + ":" + "textures/gui/";

[/quote]
Unrelated, but all of those should be using "MainModBE.modid", NOT "beautifulexistence". Otherwise you may as well not even bother with defining "public static final String modid".

Anyway, your problem is this:
[code]
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at net.be.mods.CraftingBigManager.addShapedRecipe(CraftingBigManager.java:199)

 

Looks like you messed up one of your recipes.

Posted

public static final String modid = "beautifulexistence";

@Instance("beautifulexistence")

public static String GuiTexturePrefix = "beautifulexistence" + ":" + "textures/gui/";

[/quote]
Unrelated, but all of those should be using "MainModBE.modid", NOT "beautifulexistence". Otherwise you may as well not even bother with defining "public static final String modid".

Anyway, your problem is this:
[code]
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at net.be.mods.CraftingBigManager.addShapedRecipe(CraftingBigManager.java:199)

 

Looks like you messed up one of your recipes.

 

Now I get this error after the gui opens for a split second.

The texture thing is noted although this method works for me for rendering textures so I'll probably stick to it.

 

---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.

Time: 2014-04-07 12:35
Description: Ticking memory connection

java.lang.NullPointerException
at net.be.mods.ContainerBigCrafting.<init>(ContainerBigCrafting.java:28)
at net.be.mods.GuiHandler.getServerGuiElement(GuiHandler.java:17)
at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:320)
at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:371)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2555)
at net.be.mods.block.blockCraftingTable.onBlockActivated(blockCraftingTable.java:39)
at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:434)
at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:557)
at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:699)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:595)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:134)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:489)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)


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

-- Head --
Stacktrace:
at net.be.mods.ContainerBigCrafting.<init>(ContainerBigCrafting.java:28)
at net.be.mods.GuiHandler.getServerGuiElement(GuiHandler.java:17)
at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:320)
at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:371)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2555)
at net.be.mods.block.blockCraftingTable.onBlockActivated(blockCraftingTable.java:39)
at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:434)
at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:557)
at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetServerHandler@4a0babf5
Stacktrace:
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:699)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:595)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:134)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:489)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

-- System Details --
Details:
Minecraft Version: 1.6.4
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_51, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 659319344 bytes (628 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 735 (41160 bytes; 0 MB) allocated, 400 (22400 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v8.11 FML v6.4.49.965 Minecraft Forge 9.11.1.965 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{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
beautifulexistence{Pre-alpha v0.001} [bE mods] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 61 (3416 bytes; 0 MB) allocated, 50 (2800 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player436'/73, l='New World', x=272,37, y=4,00, z=-561,17]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

 

Main File:

@Mod(modid = MainModBE.modid, name = "BE mods", version = "Pre-alpha v0.001")
@NetworkMod(clientSideRequired = true, serverSideRequired = true)
public class MainModBE {

    public static final String modid = "beautifulexistence";

    @EventHandler
    public void preInit(FMLPreInitializationEvent e) {
        NetworkRegistry.instance().registerGuiHandler(MainModBE.instance, new GuiHandler());
}
    
    @Instance("beautifulexistence")
    public static MainModBE instance;

 

Gui Handler:

public class GuiHandler implements IGuiHandler
{
        @Override
        public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
        {
                TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
                switch(id)
                {
                        case 0: return id == 0 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new ContainerBigCrafting(player.inventory, world, x, y, z) : null;
                        case 1: return new ContainerBigCrafting(null, world, x, y, z);
                }
                return null;
                }
        @Override
        public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
        {
                TileEntity tile_entity = world.getBlockTileEntity(x, y, z);
                switch(id)
                {
                        case 0: return id == 0 && world.getBlockId(x, y, z) == MainModBE.blockCraftingTable.blockID ? new GuiBigCrafting(player.inventory, world, x, y, z) : null;
                        case 1: return new GuiBigCrafting(player.inventory, world, x, y, z);
                }
                return null;
        }
}

 

Crafting Table:

public class blockCraftingTable extends Block{

@SideOnly(Side.CLIENT)
private Icon workbenchIconTop;
@SideOnly(Side.CLIENT)
private Icon workbenchIconFront;

public blockCraftingTable(int id, Material par2Material) {
      super(id, par2Material);
      this.setCreativeTab(MainModBE.BETab);
	}

@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2) {
return par1 == 1 ? this.workbenchIconTop : (par1 == 0 ? Block.planks.getBlockTextureFromSide(par1) : (par1 != 2 && par1 != 4 ? this.blockIcon : this.workbenchIconFront));
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
this.blockIcon = par1IconRegister.registerIcon("beautifulexistence:CraftingTableSide");
this.workbenchIconTop = par1IconRegister.registerIcon("beautifulexistence:CraftingTableTop");
this.workbenchIconFront = par1IconRegister.registerIcon("beautifulexistence:CraftingTableFront");
}

public boolean onBlockActivated(World var1, int var2, int var3, int var4, EntityPlayer player, int var6, float var7, float var8, float var9) {
if (!player.isSneaking()) {
player.openGui(MainModBE.instance, 1, var1, var2, var3, var4);
return true; 
}else{
return false;
}
}
}

 

Gui Container:

public class GuiBigCrafting extends GuiContainer
{

public GuiBigCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
super(new ContainerBigCrafting(par1InventoryPlayer, par2World, par3, par4, par5));
}
public static String GuiTexturePrefix = "beautifulexistence" + ":" + "textures/gui/";

public static ResourceLocation BigCrafting = new ResourceLocation(GuiTexturePrefix + "BigCraftingTable.png");


protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
this.fontRenderer.drawString("Big Crafting Table", 40 + 5, - 10 - 10, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 50 + 14, this.ySize - 96 - 10 - 19, 4210752);
}


protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{

this.mc.getTextureManager().bindTexture(BigCrafting);

this.ySize = 231;
this.xSize = 176;

int var5 = (this.width - this.xSize) / 2;
int var6 = (this.height - this.ySize) / 2;
int var7;

this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
}
}

 

Container:

public class ContainerBigCrafting extends Container
{
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 5);
public IInventory craftResult = new InventoryCraftResult();
private World worldObj;
private int posX;
private int posY;
private int posZ;

public ContainerBigCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
{
this.worldObj = par2World;
this.posX = par3;
this.posY = par4;
this.posZ = par5;
this.addSlotToContainer(new SlotBigCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 124 + 8, 35 + 1));
int var6;
int var7;

for (var6 = 0; var6 < 5; ++var6)
{
for (var7 = 0; var7 < 3; ++var7)
{
this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18 - 17));
}
}

for (var6 = 0; var6 < 3; ++var6)
{
for (var7 = 0; var7 < 9; ++var7)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18 , 84 + var6 * 18 + 33));
}
}

for (var6 = 0; var6 < 9; ++var6)
{
this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18 , 142 + 10 + 23));
}

this.onCraftMatrixChanged(this.craftMatrix);
}

public ContainerBigCrafting(InventoryPlayer inventory, BigTileEntity tileEntity) {
// TODO Auto-generated constructor stub
}

public void onCraftMatrixChanged(IInventory par1IInventory)
{
this.craftResult.setInventorySlotContents(0, CraftingBigManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
}

public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != MainModBE.blockCraftingTable.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
}

public void onContainerClosed(EntityPlayer par1EntityPlayer)
{
super.onContainerClosed(par1EntityPlayer);

if (!this.worldObj.isRemote)
{
for (int i = 0; i < 15; ++i)
{
ItemStack itemstack = this.craftMatrix.getStackInSlotOnClosing(i);

if (itemstack != null)
{
par1EntityPlayer.dropPlayerItem(itemstack);
}
}
}
}

public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
{
ItemStack var3 = null;
Slot var4 = (Slot)this.inventorySlots.get(par2);

if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();

if (par2 == 0)
{
if (!this.mergeItemStack(var5, 10, 46, true))
{
return null;
}

var4.onSlotChange(var5, var3);
}
else if (par2 >= 10 && par2 < 37)
{
if (!this.mergeItemStack(var5, 37, 46, false))
{
return null;
}
}
else if (par2 >= 37 && par2 < 46)
{
if (!this.mergeItemStack(var5, 10, 37, false))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 10, 46, false))
{
return null;
}

if (var5.stackSize == 0)
{
var4.putStack((ItemStack)null);
}
else
{
var4.onSlotChanged();
}

if (var5.stackSize == var3.stackSize)
{
return null;
}

var4.onPickupFromSlot(par1EntityPlayer, var5);
}

return var3;
}


public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot)
{
return par2Slot.inventory != this.craftResult && super.func_94530_a(par1ItemStack, par2Slot);
}
}

 

Slots:

public class SlotBigCrafting extends Slot
{
private final IInventory craftMatrix;

private EntityPlayer thePlayer;

private int amountCrafted;

public SlotBigCrafting(EntityPlayer par1EntityPlayer, IInventory par2IInventory, IInventory par3IInventory, int par4, int par5, int par6)
{
super(par3IInventory, par4, par5, par6);
this.thePlayer = par1EntityPlayer;
this.craftMatrix = par2IInventory;
}

public boolean isItemValid(ItemStack par1ItemStack)
{
return false;
}

public ItemStack decrStackSize(int par1)
{
if (this.getHasStack())
{
this.amountCrafted += Math.min(par1, this.getStack().stackSize);
}

return super.decrStackSize(par1);
}

protected void onCrafting(ItemStack par1ItemStack, int par2)
{
this.amountCrafted += par2;
this.onCrafting(par1ItemStack);
}

public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
{
GameRegistry.onItemCrafted(par1EntityPlayer, par2ItemStack, craftMatrix);
this.onCrafting(par2ItemStack);

for (int var3 = 0; var3 < this.craftMatrix.getSizeInventory(); ++var3)
{
ItemStack var4 = this.craftMatrix.getStackInSlot(var3);

if (var4 != null)
{
this.craftMatrix.decrStackSize(var3, 1);

if (var4.getItem().hasContainerItem())
{
ItemStack var5 = var4.getItem().getContainerItemStack(var4);

if (var5.isItemStackDamageable() && var5.getItemDamage() > var5.getMaxDamage())
{
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, var5));
var5 = null;
}

if (var5 != null && (!var4.getItem().doesContainerItemLeaveCraftingGrid(var4) || !this.thePlayer.inventory.addItemStackToInventory(var5)))
{
if (this.craftMatrix.getStackInSlot(var3) == null)
{
this.craftMatrix.setInventorySlotContents(var3, var5);
}
else
{
this.thePlayer.dropPlayerItem(var5);
}
}
}
}
}
}
}

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.