Jump to content

[Still need help] Gui with container, help!


PlatonCraft
 Share

Recommended Posts

There is an error.

 

i dont know what should i do

 

---- Minecraft Crash Report ----

// I bet Cylons wouldn't have this problem.

 

Time: 21.08.13 19:41

Description: Rendering screen

 

java.lang.ArrayIndexOutOfBoundsException: 2

at platon.mods.unenchant.TileEntityUnEnchTbl.getStackInSlot(TileEntityUnEnchTbl.java:25)

at net.minecraft.inventory.Slot.getStack(Slot.java:91)

at net.minecraft.client.gui.inventory.GuiContainer.drawSlotInventory(GuiContainer.java:404)

at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:150)

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1036)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:934)

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)

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:57)

at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at platon.mods.unenchant.TileEntityUnEnchTbl.getStackInSlot(TileEntityUnEnchTbl.java:25)

at net.minecraft.inventory.Slot.getStack(Slot.java:91)

at net.minecraft.client.gui.inventory.GuiContainer.drawSlotInventory(GuiContainer.java:404)

at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:150)

 

-- Screen render details --

Details:

Screen name: platon.mods.unenchant.GuiUnEnchTbl

Mouse location: Scaled: (213, 119). Absolute: (427, 240)

Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['Player376'/313, l='MpServer', x=239,81, y=71,62, z=85,25]]

Chunk stats: MultiplayerChunkCache: 360

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (240,64,124), Chunk: (at 0,4,12 in 15,7; contains blocks 240,0,112 to 255,255,127), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

Level time: 231802 game time, 26783 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: creative (ID 1). Hardcore: false. Cheats: false

Forced entities: 109 total; [EntityClientPlayerMP['Player376'/313, l='MpServer', x=239,81, y=71,62, z=85,25], EntitySkeleton['Скелет'/71, l='MpServer', x=160,91, y=54,00, z=11,53], EntityCreeper['Крипер'/76, l='MpServer', x=175,50, y=30,00, z=114,50], EntityCreeper['Крипер'/77, l='MpServer', x=169,38, y=32,00, z=121,59], EntitySkeleton['Скелет'/72, l='MpServer', x=173,66, y=17,00, z=20,53], EntityChicken['Курица'/73, l='MpServer', x=163,53, y=67,00, z=22,78], EntityCow['Корова'/74, l='MpServer', x=167,81, y=70,00, z=74,66], EntityZombie['Зомби'/75, l='MpServer', x=163,69, y=16,00, z=88,63], EntityCreeper['Крипер'/85, l='MpServer', x=182,56, y=52,00, z=12,03], EntityCreeper['Крипер'/84, l='MpServer', x=184,69, y=51,00, z=11,56], EntitySheep['Овца'/87, l='MpServer', x=191,06, y=70,00, z=21,41], EntityBat['Летучая мышь'/86, l='MpServer', x=195,45, y=10,03, z=16,57], EntityCreeper['Крипер'/83, l='MpServer', x=178,43, y=54,81, z=12,61], EntityZombie['Зомби'/93, l='MpServer', x=190,09, y=26,00, z=113,50], EntitySkeleton['Скелет'/92, l='MpServer', x=176,34, y=30,00, z=112,69], EntitySilverfish['Чешуйница'/95, l='MpServer', x=186,89, y=71,00, z=116,81], EntitySkeleton['Скелет'/94, l='MpServer', x=187,69, y=26,00, z=112,50], EntityBat['Летучая мышь'/89, l='MpServer', x=175,57, y=16,59, z=71,70], EntitySkeleton['Скелет'/88, l='MpServer', x=184,25, y=13,00, z=61,78], EntitySkeleton['Скелет'/91, l='MpServer', x=179,61, y=28,00, z=110,36], EntitySkeleton['Скелет'/90, l='MpServer', x=183,50, y=34,00, z=68,50], EntityBat['Летучая мышь'/103, l='MpServer', x=193,25, y=31,10, z=7,75], EntitySilverfish['Чешуйница'/96, l='MpServer', x=188,72, y=71,00, z=125,51], EntitySkeleton['Скелет'/110, l='MpServer', x=201,31, y=50,00, z=41,66], EntityCow['Корова'/111, l='MpServer', x=196,78, y=71,00, z=103,81], EntityZombie['Зомби'/108, l='MpServer', x=204,28, y=39,00, z=21,84], EntitySpider['Паук'/109, l='MpServer', x=208,56, y=52,00, z=22,75], EntityBat['Летучая мышь'/106, l='MpServer', x=196,31, y=13,10, z=16,25], EntitySkeleton['Скелет'/107, l='MpServer', x=207,50, y=40,00, z=24,50], EntityBat['Летучая мышь'/104, l='MpServer', x=192,07, y=45,75, z=7,49], EntitySilverfish['Чешуйница'/112, l='MpServer', x=201,46, y=72,00, z=114,82], EntitySlime['Слизень'/125, l='MpServer', x=211,31, y=38,00, z=102,31], EntityCow['Корова'/124, l='MpServer', x=217,91, y=70,00, z=17,50], EntityCow['Корова'/123, l='MpServer', x=222,22, y=69,00, z=24,78], EntitySkeleton['Скелет'/122, l='MpServer', x=223,41, y=44,00, z=21,00], EntityCow['Корова'/121, l='MpServer', x=220,13, y=69,00, z=8,09], EntitySkeleton['Скелет'/120, l='MpServer', x=209,50, y=49,00, z=9,50], EntityZombie['Зомби'/137, l='MpServer', x=238,03, y=40,00, z=84,56], EntityZombie['Зомби'/136, l='MpServer', x=238,31, y=43,00, z=93,84], EntityCreeper['Крипер'/139, l='MpServer', x=239,00, y=47,00, z=99,72], EntitySkeleton['Скелет'/138, l='MpServer', x=240,09, y=37,00, z=95,50], EntityBat['Летучая мышь'/141, l='MpServer', x=231,47, y=37,10, z=107,25], EntityZombie['Зомби'/140, l='MpServer', x=236,50, y=45,00, z=97,16], EntitySilverfish['Чешуйница'/143, l='MpServer', x=224,21, y=71,00, z=103,59], EntityCow['Корова'/142, l='MpServer', x=236,50, y=70,00, z=108,53], EntitySquid['Спрут'/128, l='MpServer', x=220,53, y=60,00, z=148,47], EntitySkeleton['Скелет'/133, l='MpServer', x=227,50, y=51,00, z=14,50], EntityZombie['Зомби'/135, l='MpServer', x=233,06, y=51,00, z=18,59], EntitySkeleton['Скелет'/134, l='MpServer', x=228,94, y=51,00, z=16,53], EntityPig['Свинья'/152, l='MpServer', x=252,50, y=63,00, z=145,25], EntityCow['Корова'/153, l='MpServer', x=245,13, y=63,00, z=162,69], EntityZombie['Зомби'/155, l='MpServer', x=258,00, y=39,00, z=9,50], EntityZombie['Зомби'/156, l='MpServer', x=263,21, y=38,67, z=10,47], EntityBat['Летучая мышь'/157, l='MpServer', x=258,66, y=41,10, z=12,75], EntityBat['Летучая мышь'/158, l='MpServer', x=267,25, y=38,00, z=12,44], EntityZombie['Зомби'/144, l='MpServer', x=233,50, y=36,00, z=113,50], EntitySkeleton['Скелет'/150, l='MpServer', x=240,94, y=49,00, z=22,31], EntityZombie['Зомби'/151, l='MpServer', x=248,09, y=35,00, z=98,38], EntityOcelot['Оцелот'/163, l='MpServer', x=265,22, y=69,00, z=66,69], EntityPig['Свинья'/162, l='MpServer', x=264,50, y=71,00, z=62,47], EntitySkeleton['Скелет'/161, l='MpServer', x=262,50, y=64,00, z=44,06], EntityCow['Корова'/160, l='MpServer', x=270,97, y=65,00, z=13,53], EntityPig['Свинья'/167, l='MpServer', x=260,47, y=56,00, z=156,50], EntityZombie['Зомби'/166, l='MpServer', x=263,47, y=46,00, z=127,97], EntityCreeper['Крипер'/165, l='MpServer', x=268,31, y=45,29, z=117,69], EntitySkeleton['Скелет'/164, l='MpServer', x=271,63, y=19,00, z=121,88], EntitySkeleton['Скелет'/186, l='MpServer', x=275,22, y=20,00, z=125,56], EntityItem['item.item.rottenFlesh'/187, l='MpServer', x=276,69, y=67,13, z=122,09], EntityBat['Летучая мышь'/184, l='MpServer', x=283,34, y=52,00, z=107,51], EntityCreeper['Крипер'/185, l='MpServer', x=279,00, y=21,00, z=127,41], EntityCow['Корова'/190, l='MpServer', x=287,16, y=66,00, z=143,56], EntityPig['Свинья'/191, l='MpServer', x=272,47, y=71,00, z=140,06], EntityBat['Летучая мышь'/188, l='MpServer', x=283,24, y=20,50, z=128,79], EntityBat['Летучая мышь'/189, l='MpServer', x=285,41, y=48,72, z=129,75], EntityCreeper['Крипер'/178, l='MpServer', x=287,00, y=36,00, z=14,37], EntityCreeper['Крипер'/179, l='MpServer', x=286,72, y=36,00, z=15,75], EntityZombie['Зомби'/176, l='MpServer', x=285,09, y=33,00, z=7,41], EntityEnderman['Эндермен'/177, l='MpServer', x=284,28, y=35,00, z=13,59], EntitySkeleton['Скелет'/182, l='MpServer', x=278,53, y=26,00, z=34,69], EntityCow['Корова'/183, l='MpServer', x=275,69, y=73,00, z=57,47], EntitySkeleton['Скелет'/180, l='MpServer', x=282,52, y=55,00, z=5,55], EntityCreeper['Крипер'/181, l='MpServer', x=274,94, y=38,00, z=24,53], EntitySheep['Овца'/205, l='MpServer', x=294,75, y=63,00, z=89,94], EntitySheep['Овца'/204, l='MpServer', x=296,19, y=63,00, z=90,19], EntityBat['Летучая мышь'/207, l='MpServer', x=288,22, y=49,77, z=106,41], EntitySheep['Овца'/206, l='MpServer', x=298,19, y=63,00, z=87,19], EntitySheep['Овца'/201, l='MpServer', x=302,50, y=68,00, z=37,53], EntityCreeper['Крипер'/200, l='MpServer', x=291,63, y=36,00, z=16,66], EntitySheep['Овца'/203, l='MpServer', x=295,91, y=63,00, z=73,38], EntitySheep['Овца'/202, l='MpServer', x=303,81, y=67,00, z=35,53], EntityZombie['Зомби'/198, l='MpServer', x=293,54, y=34,00, z=2,93], EntityBat['Летучая мышь'/193, l='MpServer', x=278,31, y=62,38, z=156,36], EntityPig['Свинья'/192, l='MpServer', x=274,53, y=59,00, z=155,50], EntityPig['Свинья'/194, l='MpServer', x=277,91, y=64,00, z=157,34], EntitySheep['Овца'/220, l='MpServer', x=311,50, y=71,00, z=67,50], EntityPig['Свинья'/221, l='MpServer', x=305,53, y=63,00, z=84,59], EntitySheep['Овца'/222, l='MpServer', x=304,50, y=69,00, z=95,50], EntitySheep['Овца'/223, l='MpServer', x=316,53, y=71,00, z=90,84], EntityCow['Корова'/216, l='MpServer', x=308,91, y=63,00, z=32,13], EntityOcelot['Оцелот'/217, l='MpServer', x=304,51, y=63,54, z=31,64], EntitySheep['Овца'/218, l='MpServer', x=313,30, y=75,00, z=46,45], EntitySheep['Овца'/219, l='MpServer', x=318,53, y=71,00, z=77,47], EntityZombie['Зомби'/213, l='MpServer', x=318,55, y=26,00, z=7,97], EntityPig['Свинья'/214, l='MpServer', x=318,63, y=75,00, z=15,53], EntityCow['Корова'/215, l='MpServer', x=307,03, y=63,00, z=31,50], EntitySheep['Овца'/208, l='MpServer', x=303,50, y=69,00, z=97,50], EntityZombie['Зомби'/209, l='MpServer', x=290,50, y=48,00, z=130,03], EntityPig['Свинья'/225, l='MpServer', x=321,52, y=66,00, z=164,85], EntityPig['Свинья'/224, l='MpServer', x=305,78, y=70,00, z=125,75]]

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:2298)

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:844)

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:57)

at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

 

-- System Details --

Details:

Minecraft Version: 1.6.2

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_25, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 788159232 bytes (751 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 17636 (987616 bytes; 0 MB) allocated, 1473 (82488 bytes; 0 MB) used

Suspicious classes: FML and Forge are installed

IntCache: cache: 15, tcache: 0, allocated: 3, tallocated: 63

FML: MCP v8.04 FML v6.2.35.804 Minecraft Forge 9.10.0.804 8 mods loaded, 8 mods active

mcp{8.04} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{6.2.35.804} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{9.10.0.804} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

CodeChickenCore{0.9.0.1}

[CodeChicken Core] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
NotEnoughItems{1.6.0.5} [Not Enough Items] (NotEnoughItems 1.6.0.5.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
IronChest{1.0} [iron Chests] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
flintstonetools{1.1.3a} [Flintstone Tools] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
unenchtbl{0.1.1} [unenchanting Table] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.6
LWJGL: 2.9.0
OpenGL: AMD Radeon HD 6800 Series GL version 4.3.12414 Compatibility Profile Context 13.150.100.1000, ATI Technologies Inc.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Pack: Default
Current Language: Р СѓСЃСЃРєРёР№ (Р РѕСЃСЃРёСЏ)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 1077 (60312 bytes; 0 MB) allocated, 316 (17696 bytes; 0 MB) used[/spoiler]
I found a tutorial, but i still dont know what should i do
here it is: http://www.minecraftforum.net/topic/1924178-forge-162-micros-furnace-tutorials/



[spoiler= Base]
package platon.mods.unenchant;

import platon.mods.flintstonetools.FlintBase;
import platon.mods.flintstonetools.ItemFlintHoe;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.src.BaseMod;
import net.minecraft.src.ModLoader;
@Mod (modid = EnchantBase.modid, name = "Unenchanting Table", version = "0.1.1") 
@NetworkMod (clientSideRequired = true, serverSideRequired = false)
public class EnchantBase extends BaseMod{

public static Block unenchtbl = new BlockUnEnchTbl(648).setUnlocalizedName("unenchtbl");

public static final String modid = "unenchtbl";

public static EnchantBase instance = new EnchantBase();

@EventHandler
public void init(FMLInitializationEvent event)
{
GameRegistry.registerBlock(unenchtbl);
//GameRegistry.addRecipe(new ItemStack(FlintBase.flinthoe, 1), new Object[]{ " XX", " # ", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick});
GameRegistry.registerTileEntity(TileEntityUnEnchTbl.class, "tileEntityUnEnchTbl");
LanguageRegistry.instance().addNameForObject(unenchtbl, "en_US", "Unenchantment Table");
LanguageRegistry.instance().addNameForObject(unenchtbl, "ru_RU", "Стол снятий зачарований");
ModLoader.registerContainerID(this, 1);
}

public GuiContainer getContainerGUI(EntityClientPlayerMP player,int id, int x, int y, int z)
{
switch(id){
	case 1:
		return new GuiUnEnchTbl (player, player.worldObj, x, y, z);
	default:
		return null;
}
}

public String getVersion(){return "0.1.1";}
public void load(){}
}

 

 

[spoiler=Block]

package platon.mods.unenchant;


import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.src.ModLoader;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class BlockUnEnchTbl extends BlockContainer {

public BlockUnEnchTbl(int par1)
{
super(par1, Material.rock);
this.setHardness(3.0F);
this.setCreativeTab(CreativeTabs.tabDecorations);
this.setResistance(5.0F);
this.setLightValue(0.0F);
}

@Override
public void registerIcons(IconRegister reg){
this.blockIcon = reg.registerIcon("unenchant:BlockUnEnchTbl");
}

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c)
{
TileEntityUnEnchTbl unenchtbl = (TileEntityUnEnchTbl) world.getBlockTileEntity(x, y, z);

if(player instanceof EntityPlayerMP && unenchtbl !=null)
{
	ModLoader.serverOpenWindow((EntityPlayerMP) player, new ContainerUnEnchTbl(player, world, x, y, z), 1, x, y, z);
}
else
{
	ModLoader.openGUI((EntityPlayerSP) player, new GuiUnEnchTbl(player, world, x, y, z));
}
return true;
}

public TileEntity createNewTileEntity(World par1World)
{
return new TileEntityUnEnchTbl();
}
}

 

 

 

[spoiler=TileEntity]

package platon.mods.unenchant;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;

public class TileEntityUnEnchTbl extends TileEntity implements ISidedInventory {

ItemStack[] itemslots = new ItemStack[2];

private String localizedName;

public int playersCurrentlyUsingTbl;

private String StuffName;

public int getSizeInventory() {
	return this.itemslots.length;
}

public ItemStack getStackInSlot(int j) {
	return this.itemslots[j];
}

public ItemStack decrStackSize(int i, int j) {
	return null;
}

public ItemStack getStackInSlotOnClosing(int i) {
	return null;
}

public void setInventorySlotContents(int i, ItemStack itemstack) {

}

@Override
public void writeToNBT(NBTTagCompound nbt){
	super.writeToNBT(nbt);
	NBTTagList nbttaglist = new NBTTagList();

	for(int i = 0; i < this.itemslots.length; i++){
		if(this.itemslots[i] !=null){
			NBTTagCompound tag = new NBTTagCompound();
			tag.setByte("Slot", (byte) i);

			this.itemslots[i].writeToNBT(tag);

			nbttaglist.appendTag(tag);
		}
	}

	nbt.setTag("Stuff", nbttaglist);

	if(this.isInvNameLocalized()){
		nbt.setString("StuffName", this.StuffName);
	}
}
@Override
public void readFromNBT(NBTTagCompound nbt){
	super.readFromNBT(nbt);

	NBTTagList nbttaglist = nbt.getTagList("Stuff");
	this.itemslots = new ItemStack[this.getSizeInventory()];

	for(int i = 0; i < nbttaglist.tagCount(); i++){
		int var1 = nbt.getByte("Slot") & 255;

		if(var1 <= 0 && var1 < this.itemslots.length){
			this.itemslots[var1] = ItemStack.loadItemStackFromNBT(nbt);
		}
	}

	if(nbt.hasKey("StuffName")){
		this.StuffName = nbt.getString("StuffName");
	}
}

public String getInvName() {
	return this.isInvNameLocalized() ? this.localizedName : "container.UnEnchTbl";
}

public boolean isInvNameLocalized() {
	return this.localizedName != null && this.localizedName.length() > 0;
}

/**
 * Setting the localizedName Variable
 * @param localizedName
 */
public void func_94043_a(String par1Str){
	this.localizedName = par1Str;
}

public int getInventoryStackLimit() {
	return 64;
}

public boolean isUseableByPlayer(EntityPlayer entityplayer) {
	return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : entityplayer.getDistanceSq((double)xCoord+0.5D, (double)yCoord+0.5D, (double)zCoord+0.5D) <= 64.0D ;
}

public void openChest() {
}

public void closeChest() {

}

public boolean isItemValidForSlot(int i, ItemStack itemstack) {
	return true;
}

public int[] getAccessibleSlotsFromSide(int var1) {
	return null;
}

public boolean canInsertItem(int i, ItemStack itemstack, int j) {
	return false;
}

public boolean canExtractItem(int i, ItemStack itemstack, int j) {
	return false;
}

}

 

 

 

[spoiler=Container]

package platon.mods.unenchant;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class ContainerUnEnchTbl extends Container {

private IInventory itemSlot;

public ContainerUnEnchTbl(EntityPlayer player, World world, int x, int y, int z){
	TileEntityUnEnchTbl unenchtbl = (TileEntityUnEnchTbl) world.getBlockTileEntity(x, y, z);
	IInventory inv = player.inventory;

	for(int j = 0; j < unenchtbl.getSizeInventory();j++){
		inv.setInventorySlotContents(j, null);
	}

	for(int j = 0; j < unenchtbl.getSizeInventory();j++)
	{
		inv.setInventorySlotContents(j, unenchtbl.getStackInSlot(j));
	}

	this.itemSlot = unenchtbl;
	int var3;


		this.addSlotToContainer(new Slot(unenchtbl, 1, 14, 15));
		this.addSlotToContainer(new Slot(unenchtbl, 2, 14, 10));

         for (var3 = 0; var3 < 3; ++var3)
         {
                 for (int var4 = 0; var4 < 9; ++var4)
                 {
                         this.addSlotToContainer(new Slot(inv, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
                 }
         }
         for (var3 = 0; var3 < 9; ++var3)
         {
                 this.addSlotToContainer(new Slot(inv, var3, 8 + var3 * 18, 142));
         }
	}

public boolean canInteractWith(EntityPlayer entityplayer) {
	return this.itemSlot.isUseableByPlayer(entityplayer);
}

@Override
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 == 2)
                 {
                         if (!this.mergeItemStack(var5, 3, 39, true))
                         {
                                 return null;
                         }
                         var4.onSlotChange(var5, var3);
                 }
                 else if (par2 != 1 && par2 != 0)
                 {
                	 if (par2 >= 3 && par2 < 30)
                         {
                                 if (!this.mergeItemStack(var5, 30, 39, false))
                                 {
                                         return null;
                                 }
                         }
                         else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false))
                         {
                                 return null;
                         }
                 }
                 else if (!this.mergeItemStack(var5, 3, 39, 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;
}
}

 

 

[spoiler=Gui]

package platon.mods.unenchant;

import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class GuiUnEnchTbl extends GuiContainer{

public GuiUnEnchTbl(EntityPlayer player, World world, int x, int y, int z) {

	super(new ContainerUnEnchTbl(player, world, x, y, z));

}

@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
	this.fontRenderer.drawString("Стол Снятия Зачарований", 0, 0, 4210752);
	this.fontRenderer.drawString("Инвентарь", 0, 0, 4210752);
}

protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
{
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	this.mc.renderEngine.func_110577_a(new ResourceLocation("unenchant", "gui/unenchtblgui.png"));

	this.xSize=176;
	this.ySize=166;

	int var1 = (this.width-this.xSize)/2;
	int var2 = (this.height-this.ySize)/2;

	this.drawTexturedModalRect(var1, var2, 0, 0, this.xSize, this.ySize);
}

}

 

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

well start by posting the error...

 

 

Sorry, my bad. I have already. :)

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

You are genius, i am stupid. I thought that index is not should be in array.

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I have one more question: When i put item to created by me slot it destoyes the item. how can i fix that?

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I have one more question: When i put item to created by me slot it destoyes the item. how can i fix that?

You are opening your GUI wrongly. You need an IGUiHandler and then use EntityPlayer.openGui

 

 

I created following class

[spoiler=IGUIHandler]

package platon.mods.unenchant;

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

public class GuiHandlerUnEnchant 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 new ContainerUnEnchTbl(player, 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 new GuiUnEnchTbl(player, world, x, y, z);
}
return null;
}
}

 

 

 

How to register it? And where should i call EntityPlayer.openGui. Tell me fullly, please.

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I did it. When i click any thing in inventory it doesnt moving and i getting error  "A mod tried to open a gui on the server without being a NetworkMod" And when come out yo menu there is an error

 

 

2013-08-22 00:41:17 [sEVERE] [ForgeModLoader] A TileEntity type platon.mods.unenchant.TileEntityUnEnchTbl has throw an exception trying to write state. It will not persist. Report this to the mod author

java.lang.IllegalArgumentException: Empty string not allowed

at net.minecraft.nbt.NBTTagString.<init>(NBTTagString.java:24)

at net.minecraft.nbt.NBTTagCompound.setString(NBTTagCompound.java:145)

at platon.mods.unenchant.TileEntityUnEnchTbl.writeToNBT(TileEntityUnEnchTbl.java:60)

at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:317)

at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:127)

at net.minecraft.world.gen.ChunkProviderServer.safeSaveChunk(ChunkProviderServer.java:232)

at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:284)

at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:897)

at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:358)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:591)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)

at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

 

 

I fixed it by setting  "private String StuffName" equal to "StuffName". Now error dissapeared but I do not know whether it was possible to do so.

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

What i need to do to be a @NetworkMod

 

I have @NetworkMod (clientSideRequired = true, serverSideRequired = false) this.

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

[spoiler=EnchantBase]

package platon.mods.unenchant;

 

import platon.mods.flintstonetools.FlintBase;

import platon.mods.flintstonetools.ItemFlintHoe;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.Mod.Instance;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.event.FMLPreInitializationEvent;

import cpw.mods.fml.common.network.NetworkMod;

import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;

import cpw.mods.fml.common.network.NetworkRegistry;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

import net.minecraft.block.Block;

import net.minecraft.client.entity.EntityClientPlayerMP;

import net.minecraft.client.gui.inventory.GuiContainer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.src.BaseMod;

import net.minecraft.src.ModLoader;

import net.minecraftforge.common.Configuration;

@Mod (modid = EnchantBase.modid, name = "Unenchanting", version = "0.1.1")

@NetworkMod (clientSideRequired = true, serverSideRequired = false)

public class EnchantBase extends BaseMod{

 

@Instance("EnchantBase")

public static EnchantBase instance = new EnchantBase();

 

public static Block unenchtbl = new BlockUnEnchTbl(648).setUnlocalizedName("unenchtbl");

 

public static final String modid = "EnchantBase";

 

public static String unenchtblname = "Unenchantment Table";

 

private GuiHandlerUnEnchant guiHandler = new GuiHandlerUnEnchant();

 

@EventHandler

public void preinit(FMLPreInitializationEvent event)

{

Configuration config = new Configuration(event.getSuggestedConfigurationFile());

config.load();

config.addCustomCategoryComment("unenchtbl", "You may change the default name of Unenchantment Table to whatever you want");

unenchtblname = config.get("unenchtbl", "unenchtbllocalizedname", unenchtblname).getString();

config.save();

}

 

@EventHandler

public void init(FMLInitializationEvent event)

{

GameRegistry.registerBlock(unenchtbl);

//GameRegistry.addRecipe(new ItemStack(FlintBase.flinthoe, 1), new Object[]{ " XX", " # ", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick});

GameRegistry.registerTileEntity(TileEntityUnEnchTbl.class, "tileEntityUnEnchTbl");

LanguageRegistry.addName(unenchtbl, unenchtblname);

LanguageRegistry.instance().addNameForObject(unenchtbl, "ru_RU", "Стол снятия зачарований");

ModLoader.registerContainerID(this, 1);

NetworkRegistry.instance().registerGuiHandler(this, guiHandler);

 

if (unenchtbl.getLocalizedName() == "Стол снятия зачарований"){

TileEntityUnEnchTbl.func_94043_a(unenchtblname);

}

else{

    TileEntityUnEnchTbl.func_94043_a("Стол снятия зачаровани");

}

}

 

public GuiContainer getContainerGUI(EntityClientPlayerMP player,int id, int x, int y, int z)

{

switch(id){

case 1:

return new GuiUnEnchTbl (player, player.worldObj, x, y, z);

default:

return null;

}

}

 

public String getVersion(){return "0.1.1";}

public void load(){}

}

 

 

 

[spoiler=Block]

package platon.mods.unenchant;


import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IInventory;
import net.minecraft.src.ModLoader;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class BlockUnEnchTbl extends BlockContainer {

public BlockUnEnchTbl(int par1)
{
super(par1, Material.rock);
this.setHardness(3.0F);
this.setCreativeTab(CreativeTabs.tabDecorations);
this.setResistance(5.0F);
this.setLightValue(0.0F);
}

@Override
public void registerIcons(IconRegister reg){
this.blockIcon = reg.registerIcon("unenchant:BlockUnEnchTbl");
}

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c)
{
TileEntityUnEnchTbl unenchtbl = (TileEntityUnEnchTbl) world.getBlockTileEntity(x, y, z);
if(player instanceof EntityPlayerMP && unenchtbl !=null)
{
	player.openGui(EnchantBase.modid, 1, world, x, y, z);
	ModLoader.serverOpenWindow((EntityPlayerMP) player, new ContainerUnEnchTbl(player, world, x, y, z), 1, x, y, z);
}
else
{
	ModLoader.openGUI((EntityPlayerSP) player, new GuiUnEnchTbl(player, world, x, y, z));
}
return true;
}

public TileEntity createNewTileEntity(World par1World)
{
return new TileEntityUnEnchTbl();
}
}

 

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

1) Remove ALL references to modloader. NOW. Don't read on before you haven't done that. You are using forge.

2) Have you followed step 1?

3) You should not pass the ModId, but the actual mod instance (@Instance) to openGui.

4) don't initialize the @Instance field yourself. FML will do it for you.

Link to comment
Share on other sites

But if i'll delete all ModLoader strings, what should i paste instead of them?

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

But if i'll delete all ModLoader strings, what should i paste instead of them?

For the stuff you use to (try and) open a gui: just remove it completely. Use player.openGui and you're done for.

For all the other stuff: look at what the methods actually do, they are just a compatibly layer and redirect to FML methods.

Link to comment
Share on other sites

Now my OnBlockUse is

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c)
{
player.openGui(EnchantBase.instance, 1, world, x, y, z);
return true;
}

I didn't changed anything else

When i click my block, animation does but gui doesn't opens and no errors

What should i change also?

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I copied OnBlockActivated from tutorial, now in opens, but when i open it , items from first and second slot disappears.

When i trying to put item to my own slots in blocks they're also disappears

 

My code in archive https://mega.co.nz/#!jccCwKJL!aZ1C0jbz_KFPz-9SaNJQ41TWESxUy7h5BDrO6SdEhwM

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I changed id from 0 to 1 which i registereg and block stopped to open completely

I registering id with this  "ModLoader.registerContainerID(this, 1);"

 

I changed 0 to 1 in GuiHandler, problem is pre previous. Things disapperars

 

http://pastebin.com/ttPWwvji

http://pastebin.com/nSMjqfFF

http://pastebin.com/2As32ubj

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

removed, nothing changed.

 

I fixed one problem. Now the only problem is when i put something to slots in block(both of them) that disappears

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I fixed a half of second problem. Now i can put items in the slots, but i cant get 'em out of slots  :)  :)

 

[spoiler=TileEntity]

package platon.mods.unenchant;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;

public class TileEntityUnEnchTbl extends TileEntity implements ISidedInventory {

ItemStack[] itemslots = new ItemStack[2];

public static String localizedName;

public int getSizeInventory() {
	return this.itemslots.length;
}

public ItemStack getStackInSlot(int i) {
	return this.itemslots[i];
}

public ItemStack decrStackSize(int i, int j) {
	return null;
}

public ItemStack getStackInSlotOnClosing(int i) {
	return null;
}

public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {
	this.itemslots[par1] = par2ItemStack;
        if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
        {
                par2ItemStack.stackSize = this.getInventoryStackLimit();
        }
}

public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
         super.readFromNBT(par1NBTTagCompound);
         NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items");
         this.itemslots = new ItemStack[this.getSizeInventory()];
         for (int i = 0; i < nbttaglist.tagCount(); ++i)
         {
                 NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
                 byte b0 = nbttagcompound1.getByte("Slot");
                 if (b0 >= 0 && b0 < this.itemslots.length)
                 {
                         this.itemslots[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
                 }
         }
         
         if (par1NBTTagCompound.hasKey("CustomName"))
         {
                 this.localizedName = par1NBTTagCompound.getString("CustomName");
         }
}
/**
         * Writes a tile entity to NBT.
         */
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
         super.writeToNBT(par1NBTTagCompound);
         NBTTagList nbttaglist = new NBTTagList();
         for (int i = 0; i < this.itemslots.length; ++i)
         {
                 if (this.itemslots[i] != null)
                 {
                         NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                         nbttagcompound1.setByte("Slot", (byte)i);
                         this.itemslots[i].writeToNBT(nbttagcompound1);
                         nbttaglist.appendTag(nbttagcompound1);
                 }
         }
         par1NBTTagCompound.setTag("Items", nbttaglist);
         if (this.isInvNameLocalized())
         {
                 par1NBTTagCompound.setString("CustomName", this.localizedName);
         }
}


public String getInvName() {
	return this.isInvNameLocalized() ? this.localizedName : "container.UnEnchTbl";
}

public boolean isInvNameLocalized() {
	return this.localizedName != null && this.localizedName.length() > 0;
}

/**
 * Setting the localizedName Variable
 * @param localizedName
 */
public static void func_94043_a(String par1Str){
	localizedName = par1Str;
}

public int getInventoryStackLimit() {
	return 1;
}

public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
{
         return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
}

public void openChest() {
}

public void closeChest() {

}

public boolean isItemValidForSlot(int i, ItemStack itemstack) {
	return true;
}

public int[] getAccessibleSlotsFromSide(int var1) {
	return null;
}

public boolean canInsertItem(int i, ItemStack itemstack, int j) {
	return true;
}

public boolean canExtractItem(int i, ItemStack itemstack, int j) {
	return true;
}

}

 

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I fixed a half of second problem. Now i can put items in the slots, but i cant get 'em out of slots  :)  :)

You need to implement decrStackSize properly in your Inventory. Look at other inventories in mc, the implementation is always the same (great code design notch *cough cough*).

Also I suggest implementing getStackInSlotOnClosing (same deal).

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
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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I created an SOUL_JAR Item that has been registered for each mob like - mod:soul_jar_minecraft_cow etc.. but it all has different registry names, i have a model file name soul_jar.json and i want to know how to bind each of those items to this class (When mod iterates through all of vanilla mobs and registering items for them).   I didn't found any info about it because all of info is outdated, and forge docs is complicated asf (i wish there would be more examples) i also used AI but it showing me only outdated info, but theres some code where i registering my item and trying to bind it to model ->   public static void register(IEventBus eventBus){ ITEMS.register(eventBus); Set<ResourceLocation> entityKeyList = ForgeRegistries.ENTITY_TYPES.getKeys(); for (ResourceLocation k : entityKeyList) { EntityType<?> entityType = ForgeRegistries.ENTITY_TYPES.getValue(k); if (!entityType.getCategory().equals(MobCategory.MISC)) { RegistryObject<Item> SOUL_JAR = ITEMS.register("soul_jar" + '_' + k.toString().replace(':', '_').replace('.', '_'), () -> new JarItem(new Item.Properties().rarity(Rarity.RARE).tab(ModTabs.MAGICAL_OBSESSION_JARS), entityType)); if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.CLIENT) { ItemModelShaper itemModelShaper = Minecraft.getInstance().getItemRenderer().getItemModelShaper(); itemModelShaper.register(SOUL_JAR.get().asItem(), new ModelResourceLocation("item.soul_jar", "inventory")); } } } } I also have more questions like how to iterate through all other mods mobs also, or render mob inside of a jar in inventory, but i will try to figure it out.
    • I looked into OctoEconomyAPI and saw that it was a JAR api for fabric. This means you have a fabric mod in your mods folder. I downloaded your mod folder and wasted 2 solid hours creating a Python script to try to find the faulty mod, and eventually just gave up. I suggest you create two installations with half or the mods in each, find which one doesn't launch, cut that one in half, and repeat until you find the fabric mod. Investigué OctoEconomyAPI y vi que era una API JAR para fabric. Esto significa que tienes un mod de Fabric en tu carpeta de mods. Descargué su carpeta de mods y desperdicié 2 horas completas creando un script de Python para tratar de encontrar el mod defectuoso, y finalmente me di por vencido. Le sugiero que cree dos instalaciones con la mitad o las modificaciones en cada una, encuentre cuál no se inicia, córtela por la mitad y repita hasta que encuentre la modificación Fabric.   (The Python script I made is here): (El script de Python que hice está aquí):  
    • I've got it to work now. Instead of using the texture manager I used the Render System:   RenderSystem.setShaderTexture(0, new ResourceLocation("mcaquests", "textures/item/questbook.png"));  
    • Hello ive been having the same issue over Curse Forge's auto modding or when i use manual modding. The error seems to be within either Oculus or Rubidium. Im using 1.19 with the latest 1.19 forge + 1.19 compatible Oculus and Rubidium. Just in case the versions i am using; Oculus - oculus-1.4.3a Rubidium - rubidium-0.6.3 Note: I tried removing the two and add Optifine and it opens without a problem. I didnt use all 3 together to get this error im talking tho, i know they are not compatible with optifine dont worry. Logs Debug The actual error code im getting on start-up is ''1'' and nothing else on the pop up box. I have tried finding the jar files on the internet and insert them on my own but that didnt go too far.
  • Topics

×
×
  • Create New...

Important Information

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