Jump to content

tile entity block not working


Mystic4pheonix

Recommended Posts

You're not calling this method anywhere. The tile wasn't even registered, also you should probably update forge since that GameRegistry#registerTileEntity method was deprecated... you should use the one with ResourceLocation parameter instead of string... or just make the string be like this "modid:tilename"

Link to comment
Share on other sites

[00:46:31] [main/FATAL]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_171]
    at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_171]
    at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1176) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.NullPointerException
    at team.mystic4phoenix.witchery.client.gui.GuiWitchOven.<init>(GuiWitchOven.java:23) ~[GuiWitchOven.class:?]
    at team.mystic4phoenix.witchery.client.gui.GuiHandler.getClientGuiElement(GuiHandler.java:48) ~[GuiHandler.class:?]
    at net.minecraftforge.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:279) ~[NetworkRegistry.class:?]
    at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:111) ~[FMLNetworkHandler.class:?]
    at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2809) ~[EntityPlayer.class:?]
    at net.minecraftforge.fml.common.network.internal.OpenGuiHandler.process(OpenGuiHandler.java:50) ~[OpenGuiHandler.class:?]
    at net.minecraftforge.fml.common.network.internal.OpenGuiHandler.lambda$channelRead0$0(OpenGuiHandler.java:43) ~[OpenGuiHandler.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_171]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_171]
    at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
    ... 15 more

this is one of the errors that keep pop up

Link to comment
Share on other sites

I would need more info you mean register them as a single you do it in your preInit

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

Of course, you would need a GUIHandler

package com.mrf.infinityweapons.util.handlers;

import com.mrf.infinityweapons.container.Container_Lava_Compressor;
import com.mrf.infinityweapons.gui.GUI_Lava_Compressor;
import com.mrf.infinityweapons.tileentitys.TileEntity_Lava_Compressor;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler {

    public static final int GUINAMEHERE = 0;
    
    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
        if (ID == GUINAMEHERE) {
            return new CONTAINERCLASSHERE(player.inventory, (YourTileEntityHere) 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 == GUINAMEHERE) {
            return new GUICLASSHERE(player.inventory, (YourTileEntityHere) world.getTileEntity(new BlockPos(x, y, z)));
        }
        return null;
    }
    
}

Just fill in the blanks 

Hope this helped!

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.