Вопрос по GUI

Версия Minecraft
1.6.4
Добрый вечер. Я догадываюсь, что я всех уже достал, но все же. Прописал код по гайдам для сундука. Но во время открытия последнего, майн вылетает.
Краш лог прилагается.
GuiStorage.java

package assets.testmod.src;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;

public class GuiStorage extends GuiContainer {

private ResourceLocation texture = new ResourceLocation(ModInfo.MODID, "textures/gui/container/storage.png");

private InventoryPlayer inventory;
private TileEntityStorage te;

public GuiStorage(TileEntityStorage te, EntityPlayer player)
{
super(new ContainerStorage(te, player));
inventory = player.inventory;
this.te = te;
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
Minecraft.getMinecraft().renderEngine.bindTexture(texture);

GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

int x = (width - xSize) / 2;
int y = (height - ySize) / 2;

drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
}

@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
fontRenderer.drawString(I18n.getString(te.getInvName()), (xSize / 2) - (fontRenderer.getStringWidth(I18n.getString(te.getInvName())) / 2), 6, 4210752, false);
fontRenderer.drawString(I18n.getString(inventory.getInvName()), 8, ySize - 96 + 2, 4210752);
}
}








TileEnitityStorage.java

package assets.testmod.src;


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

public class TileEntityStorage extends TileEntity implements IInventory{

private ItemStack[] items = new ItemStack[15];

@Override
public int getSizeInventory()
{
return items.length;
}


@Override
public ItemStack getStackInSlot(int slot)
{
return items[slot];
}

@Override
public ItemStack decrStackSize(int slot, int amount)
{
if (items[slot] != null)
{
ItemStack itemstack;

if (items[slot].stackSize == amount)
{
itemstack = items[slot];
items[slot] = null;
onInventoryChanged();
return itemstack; } }
return null;
}

@Override
public ItemStack getStackInSlotOnClosing(int slot) {
if (items[slot] != null)
{
ItemStack itemstack = items[slot];
items[slot] = null;

return itemstack; }
return null; }

@Override
public void setInventorySlotContents(int slot, ItemStack itemstack) {
items[slot] = itemstack;
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
}
onInventoryChanged();

}

@Override
public String getInvName() {

return "container.storage";
}

@Override
public boolean isInvNameLocalized() {
// TODO Auto-generated method stub
return false;
}

@Override
public int getInventoryStackLimit() {

return 64;
}

@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {

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

@Override
public void openChest() {


}

@Override
public void closeChest() {


}

@Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {

return true;
} }


MyGui.java



package assets.testmod.src;

import net.minecraft.client.gui.GuiScreen;

public class MyGui extends GuiScreen
{
public MyGui(){
super();
}
@Override
public void initGui() {
super.initGui();
}
@Override
protected void keyTyped(char par1, int par2){
if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.keyCode)
{
this.mc.thePlayer.closeScreen();
}
}
public boolean doesGuiPauseGame()
{
return false;
}
}




ContainerStorage.java


package assets.testmod.src;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;

public class ContainerStorage extends Container{
private TileEntityStorage te;

private int slotID = 0;

public ContainerStorage(TileEntityStorage te, EntityPlayer player)
{
this.te = te;
//Хранение
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 5; j++)
{
addSlotToContainer(new Slot(te, slotID++, 44 + j * 18, 17 + i * 18));
}
}

//Инвентарь
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
{
addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
}
}
//Хотбар
for (int i = 0; i < 9; i++)
{
addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
}
}

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw)
{
ItemStack stack = null;
Slot slot = (Slot)inventorySlots.get(slotRaw);

if (slot != null && slot.getHasStack())
{
ItemStack stackInSlot = slot.getStack();
stack = stackInSlot.copy();

if (slotRaw < 3 * 9)
{
if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true))
{
return null;
}
}
else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false))
{
return null;
}

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

@Override
public boolean canInteractWith(EntityPlayer player)
{
return te.isUseableByPlayer(player);
}
}


BlockStorage.java





package assets.testmod.src;

import java.util.ArrayList;
import java.util.Random;

import com.jcraft.jorbis.Block;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World;

public class BlockStorage extends BlockContainer {

private static final String name = "storage";

private final Random rand = new Random();




protected BlockStorage(int par1) {
super(par1,Material.wood);
this.setCreativeTab(CreativeTabs.tabDecorations);
GameRegistry.registerBlock(this, name);
}




@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz)
{
if (world.isRemote) return true;

TileEntity te = world.getBlockTileEntity(x, y, z);
if (te != null && te instanceof TileEntityChest)
{
player.openGui(TestMod.mod, 0, world, x, y, z);
return true;
}
return false;
}

public void breakBlock(World world, int x, int y, int z, Block block, int par6)
{
if (world.isRemote) return;

ArrayList drops = new ArrayList();

TileEntity teRaw = world.getBlockTileEntity(x, y, z);

if (teRaw != null && teRaw instanceof TileEntityChest)
{
TileEntityChest te = (TileEntityChest) teRaw;

for (int i = 0; i < te.getSizeInventory(); i++)
{
ItemStack stack = te.getStackInSlot(i);

if (stack != null) drops.add(stack.copy());
}
}

for (int i = 0;i < drops.size();i++)
{
EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i));
item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25);
world.spawnEntityInWorld(item);
}
}

public TileEntity createNewTileEntity(World world)
{
return new TileEntityChest();
} }
 
Краш-лог
2018-12-30 22:13:19 [INFO] [STDOUT] ---- Minecraft Crash Report ----
2018-12-30 22:13:19 [INFO] [STDOUT] // I feel sad now :(
2018-12-30 22:13:19 [INFO] [STDOUT]
2018-12-30 22:13:19 [INFO] [STDOUT] Time: 30.12.18 22:13
2018-12-30 22:13:19 [INFO] [STDOUT] Description: Ticking memory connection
2018-12-30 22:13:19 [INFO] [STDOUT]
2018-12-30 22:13:19 [INFO] [STDOUT] java.lang.ClassCastException: net.minecraft.tileentity.TileEntityChest cannot be cast to assets.testmod.src.TileEntityStorage
2018-12-30 22:13:19 [INFO] [STDOUT] at assets.testmod.src.GuiHandler.getServerGuiElement(GuiHandler.java:20)
2018-12-30 22:13:19 [INFO] [STDOUT] at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:308)
2018-12-30 22:13:19 [INFO] [STDOUT] at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-30 22:13:19 [INFO] [STDOUT] at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-30 22:13:19 [INFO] [STDOUT]
2018-12-30 22:13:19 [INFO] [STDOUT]
2018-12-30 22:13:19 [INFO] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2018-12-30 22:13:19 [INFO] [STDOUT] ---------------------------------------------------------------------------------------
2018-12-30 22:13:19 [INFO] [STDOUT]
2018-12-30 22:13:19 [INFO] [STDOUT] -- Head --
2018-12-30 22:13:19 [INFO] [STDOUT] Stacktrace:
2018-12-30 22:13:19 [INFO] [STDOUT] at assets.testmod.src.GuiHandler.getServerGuiElement(GuiHandler.java:20)
2018-12-30 22:13:19 [INFO] [STDOUT] at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:308)
2018-12-30 22:13:19 [INFO] [STDOUT] at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-30 22:13:19 [INFO] [STDOUT] at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-30 22:13:19 [INFO] [STDOUT]
2018-12-30 22:13:19 [INFO] [STDOUT] -- Ticking connection --
2018-12-30 22:13:19 [INFO] [STDOUT] Details:
2018-12-30 22:13:19 [INFO] [STDOUT] Connection: net.minecraft.network.NetServerHandler@13764aab
2018-12-30 22:13:19 [INFO] [STDOUT] Stacktrace:
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-30 22:13:19 [INFO] [STDOUT] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-30 22:13:19 [INFO] [STDOUT]
2018-12-30 22:13:19 [INFO] [STDOUT] -- System Details --
2018-12-30 22:13:19 [INFO] [STDOUT] Details:
2018-12-30 22:13:19 [INFO] [STDOUT] Minecraft Version: 1.6.4
2018-12-30 22:13:19 [INFO] [STDOUT] Operating System: Windows 7 (amd64) version 6.1
2018-12-30 22:13:19 [INFO] [STDOUT] Java Version: 1.8.0_45, Oracle Corporation
2018-12-30 22:13:19 [INFO] [STDOUT] Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
2018-12-30 22:13:19 [INFO] [STDOUT] Memory: 651198360 bytes (621 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
2018-12-30 22:13:19 [INFO] [STDOUT] JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
2018-12-30 22:13:19 [INFO] [STDOUT] AABB Pool Size: 2284 (127904 bytes; 0 MB) allocated, 2143 (120008 bytes; 0 MB) used
2018-12-30 22:13:19 [INFO] [STDOUT] Suspicious classes: FML and Forge are installed
2018-12-30 22:13:19 [INFO] [STDOUT] IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
2018-12-30 22:13:19 [INFO] [STDOUT] FML: MCP v8.11 FML v6.4.50.1,345 Minecraft Forge 9.11.1.1345 7 mods loaded, 7 mods active
2018-12-30 22:13:19 [INFO] [STDOUT] mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] FML{6.4.50.1,345} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] Forge{9.11.1.1345} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] CodeChickenCore{0.9.0.9} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] NotEnoughItems{1.6.1.9} [Not Enough Items] (NotEnoughItems-1.6.4-1.6.1.9-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] TestMod{1.0.0} [TestMod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] IC2{2.0.397-experimental} [IndustrialCraft 2] (industrialcraft-2-dev-deobf_2.0.397-experimental.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] Profiler Position: N/A (disabled)
2018-12-30 22:13:19 [INFO] [STDOUT] Vec3 Pool Size: 1553 (86968 bytes; 0 MB) allocated, 877 (49112 bytes; 0 MB) used
2018-12-30 22:13:19 [INFO] [STDOUT] Player Count: 1 / 8; [EntityPlayerMP['Player510'/121, l='New World', x=1220,70, y=10,60, z=-49,36]]
2018-12-30 22:13:19 [INFO] [STDOUT] Type: Integrated Server (map_client.txt)
2018-12-30 22:13:19 [INFO] [STDOUT] Is Modded: Definitely; Client brand changed to 'fml,forge'
Краш-лог:
2018-12-30 22:13:19 [INFO] [STDOUT] ---- Minecraft Crash Report ----
2018-12-30 22:13:19 [INFO] [STDOUT] // I feel sad now :(
2018-12-30 22:13:19 [INFO] [STDOUT] 
2018-12-30 22:13:19 [INFO] [STDOUT] Time: 30.12.18 22:13
2018-12-30 22:13:19 [INFO] [STDOUT] Description: Ticking memory connection
2018-12-30 22:13:19 [INFO] [STDOUT] 
2018-12-30 22:13:19 [INFO] [STDOUT] java.lang.ClassCastException: net.minecraft.tileentity.TileEntityChest cannot be cast to assets.testmod.src.TileEntityStorage
2018-12-30 22:13:19 [INFO] [STDOUT] 	at assets.testmod.src.GuiHandler.getServerGuiElement(GuiHandler.java:20)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:308)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-30 22:13:19 [INFO] [STDOUT] 
2018-12-30 22:13:19 [INFO] [STDOUT] 
2018-12-30 22:13:19 [INFO] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2018-12-30 22:13:19 [INFO] [STDOUT] ---------------------------------------------------------------------------------------
2018-12-30 22:13:19 [INFO] [STDOUT] 
2018-12-30 22:13:19 [INFO] [STDOUT] -- Head --
2018-12-30 22:13:19 [INFO] [STDOUT] Stacktrace:
2018-12-30 22:13:19 [INFO] [STDOUT] 	at assets.testmod.src.GuiHandler.getServerGuiElement(GuiHandler.java:20)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:308)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-30 22:13:19 [INFO] [STDOUT] 
2018-12-30 22:13:19 [INFO] [STDOUT] -- Ticking connection --
2018-12-30 22:13:19 [INFO] [STDOUT] Details:
2018-12-30 22:13:19 [INFO] [STDOUT] 	Connection: net.minecraft.network.NetServerHandler@13764aab
2018-12-30 22:13:19 [INFO] [STDOUT] Stacktrace:
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-30 22:13:19 [INFO] [STDOUT] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-30 22:13:19 [INFO] [STDOUT] 
2018-12-30 22:13:19 [INFO] [STDOUT] -- System Details --
2018-12-30 22:13:19 [INFO] [STDOUT] Details:
2018-12-30 22:13:19 [INFO] [STDOUT] 	Minecraft Version: 1.6.4
2018-12-30 22:13:19 [INFO] [STDOUT] 	Operating System: Windows 7 (amd64) version 6.1
2018-12-30 22:13:19 [INFO] [STDOUT] 	Java Version: 1.8.0_45, Oracle Corporation
2018-12-30 22:13:19 [INFO] [STDOUT] 	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
2018-12-30 22:13:19 [INFO] [STDOUT] 	Memory: 651198360 bytes (621 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
2018-12-30 22:13:19 [INFO] [STDOUT] 	JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
2018-12-30 22:13:19 [INFO] [STDOUT] 	AABB Pool Size: 2284 (127904 bytes; 0 MB) allocated, 2143 (120008 bytes; 0 MB) used
2018-12-30 22:13:19 [INFO] [STDOUT] 	Suspicious classes: FML and Forge are installed
2018-12-30 22:13:19 [INFO] [STDOUT] 	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
2018-12-30 22:13:19 [INFO] [STDOUT] 	FML: MCP v8.11 FML v6.4.50.1,345 Minecraft Forge 9.11.1.1345 7 mods loaded, 7 mods active
2018-12-30 22:13:19 [INFO] [STDOUT] 	mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] 	FML{6.4.50.1,345} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] 	Forge{9.11.1.1345} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] 	CodeChickenCore{0.9.0.9} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] 	NotEnoughItems{1.6.1.9} [Not Enough Items] (NotEnoughItems-1.6.4-1.6.1.9-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] 	TestMod{1.0.0} [TestMod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] 	IC2{2.0.397-experimental} [IndustrialCraft 2] (industrialcraft-2-dev-deobf_2.0.397-experimental.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-30 22:13:19 [INFO] [STDOUT] 	Profiler Position: N/A (disabled)
2018-12-30 22:13:19 [INFO] [STDOUT] 	Vec3 Pool Size: 1553 (86968 bytes; 0 MB) allocated, 877 (49112 bytes; 0 MB) used
2018-12-30 22:13:19 [INFO] [STDOUT] 	Player Count: 1 / 8; [EntityPlayerMP['Player510'/121, l='New World', x=1220,70, y=10,60, z=-49,36]]
2018-12-30 22:13:19 [INFO] [STDOUT] 	Type: Integrated Server (map_client.txt)
2018-12-30 22:13:19 [INFO] [STDOUT] 	Is Modded: Definitely; Client brand changed to 'fml,forge'

timaxa007

Модератор
5,831
409
672
TileEntityChest не может быть TileEntityStorage. И вставляй свой код через код.
В чем может быть проблема?
java.lang.ClassCastException: net.minecraft.tileentity.TileEntityChest cannot be cast to assets.testmod.src.TileEntityChest
Код:
package assets.testmod.src;


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

public class TileEntityChest extends TileEntity implements IInventory{

    private ItemStack[] items = new ItemStack[15];

    @Override
      public int getSizeInventory()
    {
        return items.length;
    }


    @Override
     public ItemStack getStackInSlot(int slot)
    {
        return items[slot];
    }

    @Override
     public ItemStack decrStackSize(int slot, int amount)
    {
        if (items[slot] != null)
        {
            ItemStack itemstack;

            if (items[slot].stackSize == amount)
            {
                itemstack = items[slot];
                items[slot] = null;
                onInventoryChanged();
                return itemstack; } }
        return null;
         }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {
        if (items[slot] != null)
        {
            ItemStack itemstack = items[slot];
            items[slot] = null;
       
        return itemstack; }
        return null; }

    @Override
    public void setInventorySlotContents(int slot, ItemStack itemstack) {
        items[slot] = itemstack;
        if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
        {
            itemstack.stackSize = getInventoryStackLimit();
        }
        onInventoryChanged();
       
    }

    @Override
    public String getInvName() {
       
        return "container.storage";
    }

    @Override
    public boolean isInvNameLocalized() {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public int getInventoryStackLimit() {
       
        return 64;
    }

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

    @Override
    public void openChest() {
       
       
    }

    @Override
    public void closeChest() {
       
       
    }

    @Override
    public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
       
        return true;
    } }
 
TileEntityChest не может быть TileEntityStorage. И вставляй свой код через код.
Прости, не могу сообразить. Что я должен сделать?
Новая ошибка :
java.lang.ClassCastException: net.minecraft.entity.player.EntityPlayerMP cannot be cast to net.minecraft.inventory.IInventory
 
Последнее редактирование:

timaxa007

Модератор
5,831
409
672
Прости, не могу сообразить. Что я должен сделать?
Не использовать в блоке TileEntityChest, а использовать TileEntityStorage.
EntityPlayerMP не может быть(/стать) IInventory. Ты используешь (серверного) игрока, а не его инвентарь, если предположить в чём может быть проблема.
 
Определись, чем ты пользуешься TileEntityChest от Minecraft или свой. Смотри импорты в других классах.
Java:
package assets.testmod.src;

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

public class GuiHandler implements IGuiHandler {

    @Override
    public Object getServerGuiElement(int guiID, EntityPlayer player, World world, int x, int y, int z){
        TileEntity te = world.getBlockTileEntity(x, y, z);

        if (te != null)
        {
            if (guiID == 0)
            {
                return new ContainerChest((TileEntityChest)te, (IInventory) player);
            }
        }
        return null;
    }
    @Override
    public Object getClientGuiElement(int guiID, EntityPlayer player, World world, int x, int y, int z) {
        TileEntity te = world.getBlockTileEntity(x, y, z);
         if (te != null)
         {
             if (guiID == 0)
             {
                 return new GuiStorage((TileEntityChest)te, player);
             }
         }
         return null;
     }
 }




Java:
package assets.testmod.src;

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

public class GuiHandler implements IGuiHandler {

    @Override
    public Object getServerGuiElement(int guiID, EntityPlayer player, World world, int x, int y, int z){
        TileEntity te = world.getBlockTileEntity(x, y, z);

        if (te != null)
        {
            if (guiID == 0)
            {
                return new ContainerChest((TileEntityChest)te, (IInventory) player);
            }
        }
        return null;
    }
    @Override
    public Object getClientGuiElement(int guiID, EntityPlayer player, World world, int x, int y, int z) {
        TileEntity te = world.getBlockTileEntity(x, y, z);
         if (te != null)
         {
             if (guiID == 0)
             {
                 return new GuiStorage((TileEntityChest)te, player);
             }
         }
         return null;
     }
 }


Java:
package assets.testmod.src;


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

public class TileEntityChest extends TileEntity implements IInventory{

    private ItemStack[] items = new ItemStack[15];

    @Override
      public int getSizeInventory()
    {
        return items.length;
    }


    @Override
     public ItemStack getStackInSlot(int slot)
    {
        return items[slot];
    }

    @Override
     public ItemStack decrStackSize(int slot, int amount)
    {
        if (items[slot] != null)
        {
            ItemStack itemstack;

            if (items[slot].stackSize == amount)
            {
                itemstack = items[slot];
                items[slot] = null;
                onInventoryChanged();
                return itemstack; } }
        return null;
         }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {
        if (items[slot] != null)
        {
            ItemStack itemstack = items[slot];
            items[slot] = null;
        
        return itemstack; }
        return null; }

    @Override
    public void setInventorySlotContents(int slot, ItemStack itemstack) {
        items[slot] = itemstack;
        if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
        {
            itemstack.stackSize = getInventoryStackLimit();
        }
        onInventoryChanged();
        
    }

    @Override
    public String getInvName() {
        
        return "container.storage";
    }

    @Override
    public boolean isInvNameLocalized() {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public int getInventoryStackLimit() {
        
        return 64;
    }

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

    @Override
    public void openChest() {
        
        
    }

    @Override
    public void closeChest() {
        
        
    }

    @Override
    public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
        
        return true;
    } }
 

timaxa007

Модератор
5,831
409
672
Если этот самый краш, то не знаю. Если к не давнему крашу, я же написал:
Ты используешь (серверного) игрока, а не его инвентарь,
return new ContainerChest((TileEntityChest)te, (IInventory) player);
А должно типа:
Java:
return new ContainerChest((TileEntityChest)te, player.inventory);
 
Не использовать в блоке TileEntityChest, а использовать TileEntityStorage.

EntityPlayerMP не может быть(/стать) IInventory. Ты используешь (серверного) игрока, а не его инвентарь, если предположить в чём может быть проблема.


Код:
2018-12-31 18:25:47 [INFO] [STDERR] net.minecraft.util.ReportedException: Ticking memory connection
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:63)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-31 18:25:47 [INFO] [STDERR] Caused by: java.lang.ArrayIndexOutOfBoundsException: 15
2018-12-31 18:25:47 [INFO] [STDERR]     at assets.testmod.src.TileEntityChest.getStackInSlot(TileEntityChest.java:25)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.inventory.Slot.getStack(Slot.java:91)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.inventory.Container.getInventory(Container.java:69)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:55)
2018-12-31 18:25:47 [INFO] [STDERR]     at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:321)
2018-12-31 18:25:47 [INFO] [STDERR]     at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-31 18:25:47 [INFO] [STDERR]     at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-31 18:25:47 [INFO] [STDERR]     at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-31 18:25:47 [INFO] [STDERR]     ... 6 more
2018-12-31 18:25:47 [SEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking memory connection
    at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:63)
    at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
    at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 15
    at assets.testmod.src.TileEntityChest.getStackInSlot(TileEntityChest.java:25)
    at net.minecraft.inventory.Slot.getStack(Slot.java:91)
    at net.minecraft.inventory.Container.getInventory(Container.java:69)
    at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:55)
    at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:321)
    at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
    at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
    at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
    at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
    at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
    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)
    ... 6 more
2018-12-31 18:25:47 [INFO] [STDOUT] Inserted super call into net.minecraft.client.gui.inventory.GuiContainerCreative.updateScreen
2018-12-31 18:25:47 [SEVERE] [Minecraft-Server] This crash report has been saved to: D:\forge\forge164\13\forge\mcp\jars\.\crash-reports\crash-2018-12-31_18.25.47-server.txt
2018-12-31 18:25:47 [INFO] [Minecraft-Server] Stopping server
2018-12-31 18:25:47 [INFO] [Minecraft-Server] Saving players
2018-12-31 18:25:47 [INFO] [Minecraft-Server] Player877 left the game
2018-12-31 18:25:47 [INFO] [STDOUT] Unloading Player: Player877
2018-12-31 18:25:47 [INFO] [Minecraft-Server] Saving worlds
2018-12-31 18:25:47 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2018-12-31 18:25:47 [SEVERE] [ForgeModLoader] A TileEntity type assets.testmod.src.TileEntityChest has throw an exception trying to write state. It will not persist. Report this to the mod author
java.lang.RuntimeException: class assets.testmod.src.TileEntityChest is missing a mapping! This is a bug!
    at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:108)
    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:899)
    at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:360)
    at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:393)
    at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:242)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:537)
    at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-31 18:25:47 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether
2018-12-31 18:25:47 [INFO] [Minecraft-Server] Saving chunks for level 'New World'/The End
2018-12-31 18:25:47 [INFO] [ForgeModLoader] Unloading dimension 0
2018-12-31 18:25:47 [INFO] [ForgeModLoader] Unloading dimension -1
2018-12-31 18:25:47 [INFO] [ForgeModLoader] Unloading dimension 1
2018-12-31 18:25:47 [INFO] [ForgeModLoader] The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
2018-12-31 18:25:47 [INFO] [STDOUT] ---- Minecraft Crash Report ----
2018-12-31 18:25:47 [INFO] [STDOUT] // Daisy, daisy...
2018-12-31 18:25:47 [INFO] [STDOUT]
2018-12-31 18:25:47 [INFO] [STDOUT] Time: 31.12.18 18:25
2018-12-31 18:25:47 [INFO] [STDOUT] Description: Ticking memory connection
2018-12-31 18:25:47 [INFO] [STDOUT]
2018-12-31 18:25:47 [INFO] [STDOUT] java.lang.ArrayIndexOutOfBoundsException: 15
2018-12-31 18:25:47 [INFO] [STDOUT]     at assets.testmod.src.TileEntityChest.getStackInSlot(TileEntityChest.java:25)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.inventory.Slot.getStack(Slot.java:91)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.inventory.Container.getInventory(Container.java:69)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:55)
2018-12-31 18:25:47 [INFO] [STDOUT]     at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:321)
2018-12-31 18:25:47 [INFO] [STDOUT]     at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-31 18:25:47 [INFO] [STDOUT]     at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-31 18:25:47 [INFO] [STDOUT]
2018-12-31 18:25:47 [INFO] [STDOUT]
2018-12-31 18:25:47 [INFO] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2018-12-31 18:25:47 [INFO] [STDOUT] ---------------------------------------------------------------------------------------
2018-12-31 18:25:47 [INFO] [STDOUT]
2018-12-31 18:25:47 [INFO] [STDOUT] -- Head --
2018-12-31 18:25:47 [INFO] [STDOUT] Stacktrace:
2018-12-31 18:25:47 [INFO] [STDOUT]     at assets.testmod.src.TileEntityChest.getStackInSlot(TileEntityChest.java:25)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.inventory.Slot.getStack(Slot.java:91)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.inventory.Container.getInventory(Container.java:69)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:55)
2018-12-31 18:25:47 [INFO] [STDOUT]     at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:321)
2018-12-31 18:25:47 [INFO] [STDOUT]     at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-31 18:25:47 [INFO] [STDOUT]     at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-31 18:25:47 [INFO] [STDOUT]
2018-12-31 18:25:47 [INFO] [STDOUT] -- Ticking connection --
2018-12-31 18:25:47 [INFO] [STDOUT] Details:
2018-12-31 18:25:47 [INFO] [STDOUT]     Connection: net.minecraft.network.NetServerHandler@5c83a9d9
2018-12-31 18:25:47 [INFO] [STDOUT] Stacktrace:
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-31 18:25:47 [INFO] [STDOUT]     at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-31 18:25:47 [INFO] [STDOUT]
2018-12-31 18:25:47 [INFO] [STDOUT] -- System Details --
2018-12-31 18:25:47 [INFO] [STDOUT] Details:
2018-12-31 18:25:47 [INFO] [STDOUT]     Minecraft Version: 1.6.4
2018-12-31 18:25:47 [INFO] [STDOUT]     Operating System: Windows 7 (amd64) version 6.1
2018-12-31 18:25:47 [INFO] [STDOUT]     Java Version: 1.8.0_45, Oracle Corporation
2018-12-31 18:25:47 [INFO] [STDOUT]     Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
2018-12-31 18:25:47 [INFO] [STDOUT]     Memory: 701794864 bytes (669 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
2018-12-31 18:25:47 [INFO] [STDOUT]     JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
2018-12-31 18:25:47 [INFO] [STDOUT]     AABB Pool Size: 1969 (110264 bytes; 0 MB) allocated, 1734 (97104 bytes; 0 MB) used
2018-12-31 18:25:47 [INFO] [STDOUT]     Suspicious classes: FML and Forge are installed
2018-12-31 18:25:47 [INFO] [STDOUT]     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
2018-12-31 18:25:47 [INFO] [STDOUT]     FML: MCP v8.11 FML v6.4.50.1,345 Minecraft Forge 9.11.1.1345 7 mods loaded, 7 mods active
2018-12-31 18:25:47 [INFO] [STDOUT]     mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-31 18:25:47 [INFO] [STDOUT]     FML{6.4.50.1,345} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-31 18:25:47 [INFO] [STDOUT]     Forge{9.11.1.1345} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-31 18:25:47 [INFO] [STDOUT]     CodeChickenCore{0.9.0.9} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-31 18:25:47 [INFO] [STDOUT]     NotEnoughItems{1.6.1.9} [Not Enough Items] (NotEnoughItems-1.6.4-1.6.1.9-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-31 18:25:47 [INFO] [STDOUT]     TestMod{1.0.0} [TestMod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-31 18:25:47 [INFO] [STDOUT]     IC2{2.0.397-experimental} [IndustrialCraft 2] (industrialcraft-2-dev-deobf_2.0.397-experimental.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2018-12-31 18:25:47 [INFO] [STDOUT]     Profiler Position: N/A (disabled)
2018-12-31 18:25:47 [INFO] [STDOUT]     Vec3 Pool Size: 296 (16576 bytes; 0 MB) allocated, 287 (16072 bytes; 0 MB) used
2018-12-31 18:25:47 [INFO] [STDOUT]     Player Count: 1 / 8; [EntityPlayerMP['Player877'/102, l='New World', x=1218,48, y=11,00, z=-50,25]]
2018-12-31 18:25:47 [INFO] [STDOUT]     Type: Integrated Server (map_client.txt)
2018-12-31 18:25:47 [INFO] [STDOUT]     Is Modded: Definitely; Client brand changed to 'fml,forge'
2018-12-31 18:25:47 [INFO] [STDOUT] #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2018-12-31_18.25.47-server.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
 
Обычно - не зарегистрировал ты свой TileEntityChest.

Java:
     public static final Item Concrete = new Concrete(2013).setUnlocalizedName("Concrete");
     public static final Item Cigarettes = new Cigarettes(2014).setUnlocalizedName("Cigarettes");
     public static final Block AsphaltD = new AsphaltD(2016).setUnlocalizedName("Asphalt");
     public static final Block AsphaltF = new AsphaltF(2017).setUnlocalizedName("Asphalt");
     public static final Block AsphaltC = new AsphaltC(2018).setUnlocalizedName("Asphalt");
     public static final Block AsphaltX = new AsphaltX(2019).setUnlocalizedName("Asphalt");
     public static final Block AsphaltO = new AsphaltO(2020).setUnlocalizedName("Asphalt");
     public static final Block Lamp = new Lamp(2028).setUnlocalizedName("Lamp");
А в этих как? Я тут обычно id прописываю
 

timaxa007

Модератор
5,831
409
672
Тебе нужен метод типа load или init, учитывая что это версия 1.6.4, ищи в своём главном классе и под конец метода напиши регистрацию. Так как я не сторонник регистрации блока, предмета и т.п. в самом конструкторе класса.
 

timaxa007

Модератор
5,831
409
672
41 строчка:
Java:
package timaxa007.potion_making;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraftforge.common.Configuration;

@Mod(modid = PotionMakingMod.MODID, name = PotionMakingMod.NAME, version = PotionMakingMod.VERSION)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class PotionMakingMod {

    public static final String
    MODID = "potion_making",
    NAME = "Potion Making Mod",
    VERSION = "1.0";

    @Mod.Instance(MODID)
    public static PotionMakingMod instance;

    @SidedProxy(modId = MODID,
            serverSide = "timaxa007.potion_making.server.ProxyServer",
            clientSide = "timaxa007.potion_making.client.ProxyClient")
    public static ProxyCommon proxy;

    public static Block
    block_potion_making_stand
    ;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        config.load();

        block_potion_making_stand = new BlockPotionMakingStand(config.getBlock("block_potion_making_stand", 2500).getInt());
        GameRegistry.registerBlock(block_potion_making_stand, "block_potion_making_stand");
        GameRegistry.registerTileEntity(TileEntityPotionMakingStand.class, "TileEntityPotionMakingStand");

        NetworkRegistry.instance().registerGuiHandler(instance, proxy);
        proxy.preInit(event);
    }

    @Mod.EventHandler
    public void postInit(FMLPostInitializationEvent event) {
        proxy.postInit();
    }

}
Других кодов для 1.6.4, с использованием TileEntity, не знаю где у меня находиться.
 
Тебе нужен метод типа load или init, учитывая что это версия 1.6.4, ищи в своём главном классе и под конец метода напиши регистрацию. Так как я не сторонник регистрации блока, предмета и т.п. в самом конструкторе класса.
Нет, я не это просил, а как для TileEnitity прописывать id? Я про это. Это не блок ведь, или яччто-то не понимаю?
Java:
2018-12-31 23:38:58 [INFO] [STDOUT] java.lang.ArrayIndexOutOfBoundsException: 15
2018-12-31 23:38:58 [INFO] [STDOUT]     at assets.testmod.src.TileEntityChest.getStackInSlot(TileEntityChest.java:26)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.inventory.Slot.getStack(Slot.java:91)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.inventory.Container.getInventory(Container.java:69)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:55)
2018-12-31 23:38:58 [INFO] [STDOUT]     at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:321)
2018-12-31 23:38:58 [INFO] [STDOUT]     at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-31 23:38:58 [INFO] [STDOUT]     at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-31 23:38:58 [INFO] [STDOUT]
2018-12-31 23:38:58 [INFO] [STDOUT]
2018-12-31 23:38:58 [INFO] [STDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2018-12-31 23:38:58 [INFO] [STDOUT] ---------------------------------------------------------------------------------------
2018-12-31 23:38:58 [INFO] [STDOUT]
2018-12-31 23:38:58 [INFO] [STDOUT] -- Head --
2018-12-31 23:38:58 [INFO] [STDOUT] Stacktrace:
2018-12-31 23:38:58 [INFO] [STDOUT]     at assets.testmod.src.TileEntityChest.getStackInSlot(TileEntityChest.java:26)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.inventory.Slot.getStack(Slot.java:91)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.inventory.Container.getInventory(Container.java:69)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:55)
2018-12-31 23:38:58 [INFO] [STDOUT]     at cpw.mods.fml.common.network.NetworkRegistry.openRemoteGui(NetworkRegistry.java:321)
2018-12-31 23:38:58 [INFO] [STDOUT]     at cpw.mods.fml.common.network.FMLNetworkHandler.openGui(FMLNetworkHandler.java:353)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2480)
2018-12-31 23:38:58 [INFO] [STDOUT]     at assets.testmod.src.BlockStorage.onBlockActivated(BlockStorage.java:45)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.item.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:421)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:556)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2018-12-31 23:38:58 [INFO] [STDOUT]
2018-12-31 23:38:58 [INFO] [STDOUT] -- Ticking connection --
2018-12-31 23:38:58 [INFO] [STDOUT] Details:
2018-12-31 23:38:58 [INFO] [STDOUT]     Connection: net.minecraft.network.NetServerHandler@757e5213
2018-12-31 23:38:58 [INFO] [STDOUT] Stacktrace:
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2018-12-31 23:38:58 [INFO] [STDOUT]     at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2018-12-31 23:38:58 [INFO] [STDOUT]
 
Последнее редактирование:

timaxa007

Модератор
5,831
409
672
как для TileEnitity прописывать id?
ID для регистрации виде String, а не int как у блока. registerTileEntity - мы через это регистрируем наш TileEntity.
Caused by: java.lang.ArrayIndexOutOfBoundsException: 15
Типа пытается получить доступ к 15 слоту или типа того, но размер листа где находиться слоты, не видит этого слота. Я точно не знаю из-за чего у тебя такое.
 
Тебе нужен метод типа load или init, учитывая что это версия 1.6.4, ищи в своём главном классе и под конец метода напиши регистрацию. Так как я не сторонник регистрации блока, предмета и т.п. в самом конструкторе класса.
Java:
package assets.testmod.src;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;

public class ContainerStorage extends Container{
     private TileEntityChest te;

        private int slotID = 0;

        public ContainerStorage(TileEntityChest te, EntityPlayer player)
        {
            this.te = te;
        //Хранение
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 5; j++)
            {
                addSlotToContainer(new Slot(te, slotID++, 44 + j * 18, 17 + i * 18));
            }
        }

        //Инвентарь
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 9; j++)
            {
                addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
            }
        }
        //Хотбар
        for (int i = 0; i < 9; i++)
        {
            addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
        }
    }

 

    @Override
    public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw)
    {
        ItemStack stack = null;
        Slot slot = (Slot)inventorySlots.get(slotRaw);

        if (slot != null && slot.getHasStack())
        {
            ItemStack stackInSlot = slot.getStack();
            stack = stackInSlot.copy();

            if (slotRaw < 3 * 9)
            {
                if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true))
                {
                    return null;
                }
            }
            else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false))
            {
                return null;
            }

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

    @Override
    public boolean canInteractWith(EntityPlayer player)
    {
        return te.isUseableByPlayer(player);
    }
}
Код:
package assets.testmod.src;

import java.util.ArrayList;
import java.util.Random;

import com.jcraft.jorbis.Block;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

public class BlockStorage extends BlockContainer {

    private static final String name = "storage";

    private final Random rand = new Random();


    
    
    protected BlockStorage(int par1) {
        super(par1,Material.wood);
        this.setCreativeTab(CreativeTabs.tabDecorations);
        GameRegistry.registerBlock(this, name);
    }




    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz)
    {
        if (world.isRemote) return true;

        TileEntity te = world.getBlockTileEntity(x, y, z);
        if (te != null && te instanceof TileEntityChest)
        {
            player.openGui(TestMod.mod, 0, world, x, y, z);
            return true;
        }
        return false;
    }

    public void breakBlock(World world, int x, int y, int z, Block block, int par6)
    {
        if (world.isRemote) return;

        ArrayList drops = new ArrayList();

        TileEntity teRaw = world.getBlockTileEntity(x, y, z);

        if (teRaw != null && teRaw instanceof TileEntityChest)
        {
            TileEntityChest te = (TileEntityChest) teRaw;

            for (int i = 0; i < te.getSizeInventory(); i++)
            {
                ItemStack stack = te.getStackInSlot(i);

                if (stack != null) drops.add(stack.copy());
            }
        }

        for (int i = 0;i < drops.size();i++)
        {
            EntityItem item = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, (ItemStack) drops.get(i));
            item.setVelocity((rand.nextDouble() - 0.5) * 0.25, rand.nextDouble() * 0.5 * 0.25, (rand.nextDouble() - 0.5) * 0.25);
            world.spawnEntityInWorld(item);
        }
    }

    public TileEntity createNewTileEntity(World world)
    {
        return new TileEntityChest();
    } }
Код:
package assets.testmod.src;


import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;

public class TileEntityChest extends TileEntity implements IInventory{

    private ItemStack[] items = new ItemStack[15];

    @Override
      public int getSizeInventory()
    {
        return items.length;
    }


    @Override
     public ItemStack getStackInSlot(int slot)
    {
        return items[slot];
    }

    @Override
     public ItemStack decrStackSize(int slot, int amount)
    {
        if (items[slot] != null)
        {
            ItemStack itemstack;

            if (items[slot].stackSize == amount)
            {
                itemstack = items[slot];
                items[slot] = null;
                onInventoryChanged();
                return itemstack; } }
        return null;
         }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {
        if (items[slot] != null)
        {
            ItemStack itemstack = items[slot];
            items[slot] = null;
        
        return itemstack; }
        return null; }

    @Override
    public void setInventorySlotContents(int slot, ItemStack itemstack) {
        items[slot] = itemstack;
        if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
        {
            itemstack.stackSize = getInventoryStackLimit();
        }
        onInventoryChanged();
        
    }

    @Override
    public String getInvName() {
        
        return "container.storage";
    }

    @Override
    public boolean isInvNameLocalized() {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public int getInventoryStackLimit() {
        
        return 64;
    }

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

    @Override
    public void openChest() {
        
        
    }

    @Override
    public void closeChest() {
        
        
    }

    @Override
    public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
        
        return true;
    } }
 
Сверху