Jump to content

Crash On init (GUIHANDLER)


alexschopbarteld

Recommended Posts

I am making a drawer with 1 slot to store stuff.

on startup it gives this error wich seems to come from the commonproxy (Init my handlers)

Crash Report:

 

at net.minecraftforge.fml.common.network.NetworkRegistry.registerGuiHandler(NetworkRegistry.java:218)

at com.runecraft.proxy.CommonProxy.registerGuiHandler(CommonProxy.java:27)

at com.runecraft.Runecraft.init(Runecraft.java:58)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:518)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208)

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)

at com.google.common.eventbus.EventBus.post(EventBus.java:275)

at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118)

at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:692)

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:291)

at net.minecraft.client.Minecraft.startGame(Minecraft.java:521)

 

-- Initialization --

Details:

Stacktrace:

at net.minecraft.client.Minecraft.run(Minecraft.java:356)

at net.minecraft.client.main.Main.main(Main.java:117)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

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

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.8

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_111, Oracle Corporation

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

Memory: 211631448 bytes (201 MB) / 390070272 bytes (372 MB) up to 951058432 bytes (907 MB)

JVM Flags: 0 total;

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.10 FML v8.0.37.1334 Minecraft Forge 11.14.1.1334 4 mods loaded, 4 mods active

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

FML{8.0.37.1334} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1334.jar) Unloaded->Constructed->Pre-initialized->Initialized

Forge{11.14.1.1334} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1334.jar) Unloaded->Constructed->Pre-initialized->Initialized

RC{1.0} [Runecraft] (bin) Unloaded->Constructed->Pre-initialized->Errored

Loaded coremods (and transformers):

Launched Version: 1.8

LWJGL: 2.9.1

OpenGL: AMD Radeon R9 200 Series GL version 4.5.14008 Compatibility Profile Context 21.19.137.1, ATI Technologies Inc.

GL Caps: Using GL 1.3 multitexturing.

Using GL 1.3 texture combiners.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Shaders are available because OpenGL 2.1 is supported.

VBOs are available because OpenGL 1.5 is supported.

 

Using VBOs: No

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

[22:18:18] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\alex\Desktop\Java\.\crash-reports\crash-2016-11-15_22.18.18-client.txt

AL lib: (EE) alc_cleanup: 1 device not closed

 

 

 

proxy's

 

common:

 

package com.runecraft.proxy;

 

import com.runecraft.Runecraft;

import com.runecraft.handlers.GuiHandler;

import com.runecraft.tileentities.TileEntityDrawers2;

import com.sun.glass.ui.Application.EventHandler;

 

 

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.fml.common.network.NetworkRegistry;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

public class CommonProxy {

 

public void registerRenders() {

 

}

 

 

 

 

public void registerTileEntities() {

GameRegistry.registerTileEntity(TileEntityDrawers2.class, "mini_chest");

}

 

public void registerGuiHandler() {

NetworkRegistry.INSTANCE.registerGuiHandler(Runecraft.instance, new GuiHandler());

}

 

public void registerEntityRenders() {

 

}

 

}

 

 

 

Client:

 

package com.runecraft.proxy;

 

import com.runecraft.Runecraft;

import com.runecraft.handlers.GuiHandler;

import com.runecraft.tileentities.TileEntityDrawers2;

import com.sun.glass.ui.Application.EventHandler;

 

 

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.fml.common.network.NetworkRegistry;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

public class CommonProxy {

 

public void registerRenders() {

 

}

 

 

 

 

public void registerTileEntities() {

GameRegistry.registerTileEntity(TileEntityDrawers2.class, "mini_chest");

}

 

public void registerGuiHandler() {

NetworkRegistry.INSTANCE.registerGuiHandler(Runecraft.instance, new GuiHandler());

}

 

public void registerEntityRenders() {

 

}

 

}

 

 

 

Main mod class:

 

package com.runecraft;

 

 

import com.runecraft.CreativeTabs.RunecraftBlocksTab;

import com.runecraft.CreativeTabs.RunecraftEquipmentTab;

import com.runecraft.CreativeTabs.RunecraftItemsTab;

import com.runecraft.blocks.BlockBar;

import com.runecraft.init.RunecraftBlocks;

import com.runecraft.init.RunecraftItems;

import com.runecraft.proxy.ClientProxy;

import com.runecraft.proxy.CommonProxy;

 

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.fml.common.FMLCommonHandler;

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.SidedProxy;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

 

 

 

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION)

public class Runecraft {

 

@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)

public static CommonProxy proxy;

 

 

    @Mod.Instance("rc")

    public static Runecraft instance;

   

public static final RunecraftBlocksTab Runecraft_Blocks = new RunecraftBlocksTab("Runecraft_Blocks");

public static final RunecraftItemsTab Runecraft_Items = new RunecraftItemsTab("Runecraft_Items");

public static final RunecraftEquipmentTab Runecraft_Equipment = new RunecraftEquipmentTab("Runecraft_Equipment");

 

    public static final String MODID = Reference.MOD_ID;

    public static final String VERSION = Reference.VERSION;

 

 

 

//public static BlockBar

 

@EventHandler

public void preInit(FMLPreInitializationEvent event)

{

proxy.registerTileEntities();

RunecraftBlocks.init();

RunecraftBlocks.register();

RunecraftItems.init();

RunecraftItems.register();

}

 

@EventHandler

public void init(FMLInitializationEvent event)

{

proxy.registerGuiHandler();

proxy.registerRenders();

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event)

{

 

}

 

}

 

 

 

TileEntityDrawer:

 

package com.runecraft.tileentities;

 

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;

import net.minecraft.util.ChatComponentText;

import net.minecraft.util.ChatComponentTranslation;

import net.minecraft.util.IChatComponent;

 

public class TileEntityDrawers2 extends TileEntity implements IInventory {

 

private ItemStack[] inventory;

private String customName;

 

public TileEntityDrawers2() {

this.inventory = new ItemStack[this.getSizeInventory()];

 

}

 

public String getCustomName() {

return customName;

}

public void setCustomName(String customName) {

this.customName = customName;

}

 

@Override

public String getName() {

return this.hasCustomName() ? this.customName : "container.Drawers";

}

@Override

public boolean hasCustomName() {

return this.customName != null && !this.customName.equals("");

}

@Override

public IChatComponent getDisplayName() {

return this.hasCustomName() ? new ChatComponentText(this.getName()) : new ChatComponentTranslation(this.getName());

}

 

@Override

public int getSizeInventory() {

return 1;

}

 

@Override

public ItemStack getStackInSlot(int index) {

    if (index < 0 || index >= this.getSizeInventory())

        return null;

    return this.inventory[index];

}

 

@Override

public ItemStack decrStackSize(int index, int count) {

    if (this.getStackInSlot(index) != null) {

        ItemStack itemstack;

 

        if (this.getStackInSlot(index).stackSize <= count) {

            itemstack = this.getStackInSlot(index);

            this.setInventorySlotContents(index, null);

            this.markDirty();

            return itemstack;

        } else {

            itemstack = this.getStackInSlot(index).splitStack(count);

 

            if (this.getStackInSlot(index).stackSize <= 0) {

                this.setInventorySlotContents(index, null);

            } else {

                //Just to show that changes happened

                this.setInventorySlotContents(index, this.getStackInSlot(index));

            }

 

            this.markDirty();

            return itemstack;

        }

    } else {

        return null;

    }

}

 

@Override

public void setInventorySlotContents(int index, ItemStack stack) {

    if (index < 0 || index >= this.getSizeInventory())

        return;

 

    if (stack != null && stack.stackSize > this.getInventoryStackLimit())

        stack.stackSize = this.getInventoryStackLimit();

       

    if (stack != null && stack.stackSize == 0)

        stack = null;

 

    this.inventory[index] = stack;

    this.markDirty();

}

 

public ItemStack removeStackFromSlot(int index) {

    ItemStack stack = this.getStackInSlot(index);

    this.setInventorySlotContents(index, null);

    return stack;

}

 

@Override

public int getInventoryStackLimit() {

return 64;

}

 

@Override

public boolean isUseableByPlayer(EntityPlayer player) {

return this.worldObj.getTileEntity(this.getPos()) == this && player.getDistanceSq(this.pos.add(0.5, 0.5, 0.5)) <= 64;

}

 

@Override

public void openInventory(EntityPlayer player) {

}

@Override

public void closeInventory(EntityPlayer player) {

}

 

@Override

public boolean isItemValidForSlot(int index, ItemStack stack) {

return true;

}

 

@Override

public int getField(int id) {

return 0;

}

 

@Override

public void setField(int id, int value) {

 

}

 

@Override

public int getFieldCount() {

return 0;

}

 

@Override

public void clear() {

for(int i = 0; i < this.getSizeInventory(); i++)

this.setInventorySlotContents(i, null);

}

 

@Override

public void writeToNBT(NBTTagCompound nbt) {

    super.writeToNBT(nbt);

 

    NBTTagList list = new NBTTagList();

    for (int i = 0; i < this.getSizeInventory(); ++i) {

        if (this.getStackInSlot(i) != null) {

            NBTTagCompound stackTag = new NBTTagCompound();

            stackTag.setByte("Slot", (byte) i);

            this.getStackInSlot(i).writeToNBT(stackTag);

            list.appendTag(stackTag);

        }

    }

    nbt.setTag("Items", list);

 

    if (this.hasCustomName()) {

        nbt.setString("CustomName", this.getCustomName());

    }

}

 

 

@Override

public void readFromNBT(NBTTagCompound nbt) {

    super.readFromNBT(nbt);

 

    NBTTagList list = nbt.getTagList("Items", 10);

    for (int i = 0; i < list.tagCount(); ++i) {

        NBTTagCompound stackTag = list.getCompoundTagAt(i);

        int slot = stackTag.getByte("Slot") & 255;

        this.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(stackTag));

    }

 

    if (nbt.hasKey("CustomName", 8)) {

        this.setCustomName(nbt.getString("CustomName"));

    }

}

 

@Override

public ItemStack getStackInSlotOnClosing(int index) {

    ItemStack stack = this.getStackInSlot(index);

    this.setInventorySlotContents(index, null);

    return stack;

}

 

 

}

 

 

 

Block init

 

package com.runecraft.init;

 

import com.runecraft.Reference;

import com.runecraft.Runecraft;

import com.runecraft.blocks.BlockBar;

import com.runecraft.blocks.Hanging_Lantern;

import com.runecraft.blocks.Sword_case;

import com.runecraft.blocks.kruk;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.client.Minecraft;

import net.minecraft.client.resources.model.ModelResourceLocation;

import net.minecraft.item.Item;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

public class RunecraftBlocks {

 

public static Block bar;

public static Block kruk;

public static Block lantern;

public static Block sword_case;

public static BlockContainer Drawers;

 

 

public static void init()

{

bar = new BlockBar("bar");

kruk = new kruk(Material.wood).setUnlocalizedName("kruk").setCreativeTab(Runecraft.Runecraft_Blocks);

lantern = new Hanging_Lantern("lantern");

sword_case = new Sword_case("sword_case");

Drawers = new com.runecraft.blocks.Drawers("Drawers");

 

}

 

public static void register()

{

GameRegistry.registerBlock(bar, bar.getUnlocalizedName().substring(5));

GameRegistry.registerBlock(kruk, kruk.getUnlocalizedName().substring(5));

GameRegistry.registerBlock(lantern, lantern.getUnlocalizedName().substring(5));

GameRegistry.registerBlock(sword_case, sword_case.getUnlocalizedName().substring(5));

GameRegistry.registerBlock(Drawers, Drawers.getUnlocalizedName().substring(5));

}

 

public static void registerRenders()

{

registerRender(bar);

registerRender(kruk);

registerRender(lantern);

registerRender(sword_case);

registerRender(Drawers);

 

}

 

public static void registerBlock(Block block) {

GameRegistry.registerBlock(block, block.getUnlocalizedName().substring(5));

System.out.println("Registered Block: " + block.getUnlocalizedName().substring(5));

}

 

public static void registerRender(Block block)

{

Item item = Item.getItemFromBlock(block);

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));

}

}

 

 

 

 

Guihandler

 

package com.runecraft.handlers;

 

import com.runecraft.client.gui.guiDrawers;

import com.runecraft.container.containerDrawers;

import com.runecraft.tileentities.TileEntityDrawers2;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.util.BlockPos;

import net.minecraft.world.World;

import net.minecraftforge.fml.common.network.IGuiHandler;

 

public class GuiHandler implements IGuiHandler {

 

public static final int DRAWERS = 0;

 

@Override

public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

if(ID == DRAWERS) {

return new containerDrawers(player.inventory, (TileEntityDrawers2) world.getTileEntity(new BlockPos(x, y, z)));

}

return null;

}

 

@Override

public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {

if(ID == DRAWERS) {

return new guiDrawers(player.inventory, (TileEntityDrawers2) world.getTileEntity(new BlockPos(x, y, z)));

}

return null;

}

 

}

 

 

 

containerDrawers class:

 

 

package com.runecraft.container;

 

import com.runecraft.tileentities.TileEntityDrawers2;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.inventory.Container;

import net.minecraft.inventory.IInventory;

import net.minecraft.inventory.Slot;

import net.minecraft.item.ItemStack;

 

public class containerDrawers extends Container {

 

private TileEntityDrawers2 te;

 

public containerDrawers(IInventory playerInv, TileEntityDrawers2 te) {

this.te = te;

 

this.addSlotToContainer(new Slot(te, 0, 80, 16));

 

//Player Inventory

for (int y = 0; y < 3; ++y) {

for (int x = 0; x < 9; ++x) {

this.addSlotToContainer(new Slot(playerInv, x + y * 9 + 9, 8 + x * 18, 41 + y * 18));

}

}

//Player Hotbar

for (int x = 0; x < 9; ++x) {

this.addSlotToContainer(new Slot(playerInv, x, 8 + x * 18, 99));

}

 

}

 

@Override

public ItemStack transferStackInSlot(EntityPlayer playerIn, int fromSlot) {

ItemStack previous = null;

Slot slot = (Slot) this.inventorySlots.get(fromSlot);

 

if (slot != null && slot.getHasStack()) {

ItemStack current = slot.getStack();

        previous = current.copy();

 

        if (fromSlot < 1) {

// From TE Inventory to Player Inventory

        if (!this.mergeItemStack(current, 1, this.inventorySlots.size(), true)){

                    return null;

                }

        } else {

            // From Player Inventory to TE Inventory

            if (!this.mergeItemStack(current, 0, 1, false))

                return null;

        }

 

        if (current.stackSize == 0)

            slot.putStack((ItemStack) null);

        else

            slot.onSlotChanged();

    }

    return previous;

}

 

 

@Override

public boolean canInteractWith(EntityPlayer playerIn) {

return this.te.isUseableByPlayer(playerIn);

}

 

}

 

 

 

guiDrawers:

 

 

package com.runecraft.client.gui;

 

import com.runecraft.container.containerDrawers;

import com.runecraft.tileentities.TileEntityDrawers2;

 

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

import net.minecraft.client.renderer.GlStateManager;

import net.minecraft.inventory.IInventory;

import net.minecraft.util.ResourceLocation;

 

public class guiDrawers extends GuiContainer{

 

private TileEntityDrawers2 te;

private IInventory playerInv;

 

public guiDrawers(IInventory playerInv, TileEntityDrawers2 te) {

super(new containerDrawers(playerInv, te));

 

this.te = te;

this.playerInv = playerInv;

 

this.xSize = 176;

this.ySize = 122;

}

 

@Override

protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {

GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);

this.mc.getTextureManager().bindTexture(new ResourceLocation("rc:textures/GUI/container/Drawers.png"));

this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);

 

}

 

 

 

@Override

protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {

String s = this.te.getDisplayName().getUnformattedText();

this.fontRendererObj.drawString(s, 88 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);

this.fontRendererObj.drawString(this.playerInv.getDisplayName().getUnformattedText(), 8, 30, 4210752);

}

}

 

 

 

 

 

 

Drawer (Block Class)

 

package com.runecraft.blocks;

 

import com.runecraft.Runecraft;

import com.runecraft.handlers.GuiHandler;

import com.runecraft.tileentities.TileEntityDrawers2;

 

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.block.properties.IProperty;

import net.minecraft.block.properties.PropertyDirection;

import net.minecraft.block.state.BlockState;

import net.minecraft.block.state.IBlockState;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.inventory.InventoryHelper;

import net.minecraft.item.ItemStack;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.util.BlockPos;

import net.minecraft.util.EnumFacing;

import net.minecraft.world.IBlockAccess;

import net.minecraft.world.World;

 

public class Drawers extends BlockContainer {

 

public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);

 

public Drawers(String unlocalizedName) {

super(Material.wood);

this.setCreativeTab(Runecraft.Runecraft_Blocks);

this.setUnlocalizedName(unlocalizedName);

this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH);

this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f);

}

 

@Override

public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,

EnumFacing side, float hitX, float hitY, float hitZ) {

if(!worldIn.isRemote){

playerIn.openGui(Runecraft.instance, GuiHandler.DRAWERS, worldIn, pos.getX(), pos.getY(), pos.getZ());

}

return true;

}

 

@Override

protected BlockState createBlockState() {

return new BlockState(this, new IProperty[] { FACING });

}

 

@Override

public int getRenderType() {

return 3;

}

 

@Override

public boolean isFullCube() {

return false;

}

 

@Override

public boolean isOpaqueCube() {

return false;

}

 

@Override

public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) {

return true;

}

 

public IBlockState getStateFromMeta(int meta) {

 

EnumFacing facing = EnumFacing.getFront(meta);

 

if(facing.getAxis() == EnumFacing.Axis.Y) {

facing = EnumFacing.NORTH;

}

 

return this.getDefaultState().withProperty(FACING, facing);

 

}

 

public int getMetaFromState(IBlockState state) {

return ((EnumFacing)state.getValue(FACING)).getIndex();

}

 

@Override

public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ,

int meta, EntityLivingBase placer) {

EnumFacing enumfacing = placer.getHorizontalFacing().getOpposite();

return this.getDefaultState().withProperty(FACING, enumfacing);

}

 

@Override

public TileEntity createNewTileEntity(World worldIn, int meta) {

return new TileEntityDrawers2();

}

 

@Override

public void breakBlock(World world, BlockPos pos, IBlockState blockstate) {

    TileEntityDrawers2 te = (TileEntityDrawers2) world.getTileEntity(pos);

    InventoryHelper.dropInventoryItems(world, pos, te);

    super.breakBlock(world, pos, blockstate);

}

 

 

@Override

public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {

    if (stack.hasDisplayName()) {

        ((TileEntityDrawers2) worldIn.getTileEntity(pos)).setCustomName(stack.getDisplayName());

    }

}

 

 

}

 

 

i hope it is a simply mistake, thanks in forward, (version 1.8)

 

And yes i am going to update to 1.8.9 when this is finished.

 

Link to comment
Share on other sites

It looks like your

Runecraft.instance

is null. Is

"rc"

your modid? Why not [use

Reference.MOD_ID

like everywhere?

 

Also, your modid is way too short, it should be something longer and more meaningful, like

"runecraft"

.

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

 

1.12 -> 1.13 primer by williewillus.

 

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

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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