Jump to content

[1.7.10]Could not open guis


End_KG

Recommended Posts

Hello! I Install own Mod in my client , and it can work well,but when I try to open it and let it show its guis then the game suddenly collapsed.

I don't know what's causing this,and I hope to get helps,My English is not good,I hope you understand what I'm saying,Thanks in advance!

 

Here's my log and my code.

[13:36:31] [server thread/ERROR]: Encountered an unexpected exception
java.lang.AbstractMethodError
at net.minecraft.inventory.Slot.func_75211_c(Slot.java:67) ~[aay.class:?]
at net.minecraft.inventory.Container.func_75138_a(SourceFile:64) ~[zs.class:?]
at inc.jiuzhou.mod.client.gui.containers.ContainerCanshe.func_75132_a(ContainerCanshe.java:116) ~[ContainerCanshe.class:?]
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:88) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2209) ~[yz.class:?]
at inc.jiuzhou.mod.common.textile.blocks.Canshe.func_149727_a(Canshe.java:66) ~[Canshe.class:?]
at net.minecraft.server.management.ItemInWorldManager.func_73078_a(ItemInWorldManager.java:376) ~[mx.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147346_a(NetHandlerPlayServer.java:556) ~[nh.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.func_148833_a(SourceFile:60) ~[jo.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.func_148833_a(SourceFile:9) ~[jo.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.MinecraftServer.func_71217_p(MinecraftServer.java:547) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:186) ~[bsx.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:427) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [?:?]

 

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import inc.jiuzhou.mod.common.BlockFunction.tileEntities.TileEntityCanshe;
import inc.jiuzhou.mod.common.core.JiuZhouItems;

public class ContainerCanshe extends Container {
private TileEntityCanshe tile;
private int nowBeMothTime;
private int beMothTime;
private int makeTime;
private int nowMakeTime;

public ContainerCanshe(InventoryPlayer inventory, TileEntityCanshe TileEntity) {
	tile = TileEntity;
	bindPlayerInventory(inventory);
	bindGuiSlot();
}

@Override
public boolean canInteractWith(EntityPlayer player) {
	return true;
}

protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 9; j++) {
			addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
		}
	}
	for (int i = 0; i < 9; i++) {
		addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
	}
}

private void bindGuiSlot() {

	addSlotToContainer(new Slot(tile, 0, 65, 13) {
		@Override
		public boolean isItemValid(ItemStack is) {
			return tile.haveFeed() ? is.getItem().equals(JiuZhouItems.Can) : false;
		}

	});
	addSlotToContainer(new Slot(tile, 1, 95, 13) {
		@Override
		public boolean isItemValid(ItemStack is) {
			return is.getItem().equals(JiuZhouItems.Sangye);
		}
	});
	addSlotToContainer(new Slot(tile, 2, 48, 46) {
		@Override
		public boolean isItemValid(ItemStack is) {
			return is.getItem().equals(JiuZhouItems.Jian);
		}
	});
	addSlotToContainer(new Slot(tile, 3, 112, 46) {
		@Override
		public boolean isItemValid(ItemStack is) {
			return false;
		}
	});
}

@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {

	return null;
}

@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2) {

	if (par1 == 0) {
		this.tile.nowBeMothTime = par2;
	}
	if (par1 == 1) {
		this.tile.MakeTime = par2;
	}
	if (par1 == 2) {
		this.tile.nowMakeTime = par2;
	}
}

@Override
public void detectAndSendChanges() {
	super.detectAndSendChanges();

	for (int i = 0; i < this.crafters.size(); ++i) {
		ICrafting icrafting = (ICrafting) this.crafters.get(i);
		if (this.nowBeMothTime != this.tile.nowBeMothTime) {
			icrafting.sendProgressBarUpdate(this, 0, this.tile.nowBeMothTime);
		}
		if (this.makeTime != this.tile.MakeTime) {
			icrafting.sendProgressBarUpdate(this, 1, this.tile.MakeTime);
		}
		if (this.nowMakeTime != this.tile.nowMakeTime) {
			icrafting.sendProgressBarUpdate(this, 2, this.tile.nowMakeTime);
		}
	}
}

Link to comment
Share on other sites

We need more code:

- IGuiHandler

- The method in which you open your gui

- Your gui code

 

Preferably on gist.github.com, pastebin.com or a GitHub account.

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/

Link to comment
Share on other sites

Okay!

 

GuiHandler:

public class GuiHandler implements IGuiHandler {
public static final int GuiCanshe = 0, GuiLuzao = 1, GuiZhuguo = 2;

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	switch (ID) {
	case GuiCanshe:
		TileEntityCanshe tileEntityCanshe = (TileEntityCanshe) world.getTileEntity(x, y, z);
		return new ContainerCanshe(player.inventory, tileEntityCanshe);
	case GuiZhuguo:
		TileEntityZhuguo tileEntityZhuguo = (TileEntityZhuguo) world.getTileEntity(x, y, z);
		return new ContainerZhuguo(player.inventory, tileEntityZhuguo);
	case GuiLuzao:
		TileEntityLuzao tileEntityLuzao = (TileEntityLuzao) world.getTileEntity(x, y, z);
		return new ContainerLuzao(player.inventory, tileEntityLuzao);
	default:
		return null;
	}
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	switch (ID) {
	case GuiCanshe:
		TileEntityCanshe tileEntityCanshe = (TileEntityCanshe) world.getTileEntity(x, y, z);
		return new GuiCanshe(player.inventory, tileEntityCanshe);
	case GuiZhuguo:
		TileEntityZhuguo tileEntityZhuguo = (TileEntityZhuguo) world.getTileEntity(x, y, z);
		return new GuiZhuguo(player.inventory, tileEntityZhuguo);
	case GuiLuzao:
		TileEntityLuzao tileEntityLuzao = (TileEntityLuzao) world.getTileEntity(x, y, z);
		return new GuiLuzao(player.inventory, tileEntityLuzao);
	default:
		return null;
	}
}

}

 

Gui:

public class GuiCanshe extends GuiContainer {
private static final ResourceLocation backgroundimage = new ResourceLocation(Strings.Te + "textures/gui/GuiCanshe.png");
private final TileEntityCanshe tile;

public GuiCanshe(InventoryPlayer iP, TileEntityCanshe TEC) {
	super(new ContainerCanshe(iP, TEC));
	this.tile = TEC;
	xSize = 176;
	ySize = 166;
}

@Override
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
	this.fontRendererObj.drawString("Can She", 7, 4, 4210752);
}

@Override
protected void drawGuiContainerBackgroundLayer(float f, int var1, int var2) {
	this.mc.getTextureManager().bindTexture(backgroundimage);
	var1 = (this.width - xSize) / 2;
	var2 = (this.height - ySize) / 2;
	drawTexturedModalRect(var1, var2, 0, 0, xSize, ySize);
	if (tile.haveFeed()) {
		drawTexturedModalRect(var1, var2, 0, 166, 176, 86);
	} else {
		drawTexturedModalRect(var1 + 96, var2 + 14, 241, 13, 15, 15);
	}
	if (tile.getItem(0) == null) {
		drawTexturedModalRect(var1 + 67, var2 + 15, 244, 0, 12, 13);
	}
	if (tile.isBecomeMoth()) {
		final int maxsize = 23;
		float BT = tile.beMothTime * 1.0F;
		drawTexturedModalRect(var1 + 76, var2 + 52, 176, 0, (int) (maxsize * ((float) tile.nowBeMothTime / BT)), 3);
	}
	return;
}
}

 

Block:

public class Canshe extends BlockContainer {

public Canshe(CreativeTabs c, Material m, String name) {
	super(m);
	this.setBlockName(name);
	this.setCreativeTab(c);
	this.setHardness(3f);
	this.setHarvestLevel("axe", 0);
}

@Override
public int getRenderType() {
	return -1;
}

public Item getItemDropped(int a, Random b, int c) {
	return Item.getItemFromBlock(JiuZhouBlocks.Canshe);
}

@Override
public boolean isOpaqueCube() {
	return false;
}

@Override
public boolean renderAsNormalBlock() {
	return false;
}

@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister Icon) {
	this.blockIcon = Icon.registerIcon("log_oak");
}

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par1, float par2, float par3, float par4) {
	if (world.isRemote) {
		return true;
	}
	if (entityPlayer.isSneaking()) {
		return true;
	}
	entityPlayer.openGui(JiuZhouMod.instance, GuiHandler.GuiCanshe, world, x, y, z);
	return true;
}

@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
	return new TileEntityCanshe();
}

}

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.

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.