Jump to content

[1.6.2][SOLVED] Custom crafting table problems


bdkuhman

Recommended Posts

My custom crafting table GUI is opening, but immediately closing:

BlockDeconstructionTable:

 

package deconstruction.common;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockDeconstructionTable extends Block{
         @SideOnly(Side.CLIENT)
            private Icon workbenchIconTop;
            @SideOnly(Side.CLIENT)
            private Icon workbenchIconFront;


           
public BlockDeconstructionTable(int par1){
         super(par1, Material.wood);

   
         this.setCreativeTab(CreativeTabs.tabDecorations);
}
@SideOnly(Side.CLIENT)

/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getIcon(int par1, int par2)
{
    return par1 == 1 ? this.workbenchIconTop : (par1 == 0 ? Block.planks.getBlockTextureFromSide(par1) : (par1 != 2 && par1 != 4 ? this.blockIcon : this.workbenchIconFront));
}

@SideOnly(Side.CLIENT)

/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
@Override
public void registerIcons(IconRegister par1IconRegister)
{
    this.blockIcon = par1IconRegister.registerIcon("deconstruction:Decon_Side");
    this.workbenchIconTop = par1IconRegister.registerIcon("deconstruction:Decon_Top");
    this.workbenchIconFront = this.blockIcon;
}

public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer player, int var6, float var7, float var8, float var9){
        if (!player.isSneaking()){
                player.openGui(mod_Deconstruction.instance, 1, par1World, x, y, z);
                return true;
        }else{
                return false;
        }
}
}

 

 

Gui Handler:

 

package deconstruction.common;


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

import deconstruction.deconTable.ContainerDeconstructionTable;
import deconstruction.deconTable.GuiDeconstruction;

public class GuiHandler implements IGuiHandler
{

@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{

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


switch(id)
{

case 1: return id == 1 && world.getBlockId(x, y, z) == mod_Deconstruction.deconstructionTable.blockID ? new ContainerDeconstructionTable(player.inventory, world, x, y, z) : null;
//case 2: return id == 2 && world.getBlockId(x, y, z) == mod_Deconstruction.alchemyStation.blockID ? new ContainerAlchemy(player.inventory, (TileEntityStationAlchemy)tile_entity) : null;
}
return null;
}

@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{

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

switch(id)
{

case 1: return id == 1 && world.getBlockId(x, y, z) == mod_Deconstruction.deconstructionTable.blockID ? new GuiDeconstruction(player.inventory, world, x, y, z) : null;
//case 2: return id == 2 && world.getBlockId(x, y, z) == mod_Deconstruction.alchemyStation.blockID ? new ContainerAlchemy(player.inventory, (TileEntityStationAlchemy)tile_entity): null;
}

return null;

}
}

 

mod_Deconstruction:

 

package deconstruction.common;

import net.minecraft.block.Block;
import net.minecraft.block.BlockStone;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemReed;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
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 cpw.mods.fml.common.registry.LanguageRegistry;
//import deconstruction.alchemy.BlockAlchemy;
//import deconstruction.alchemy.TileEntityStationAlchemy;
import deconstruction.deconTable.DeconstructionManager;

@Mod(modid="deconstruction", name="The Deconstruction Mod", version="1.2.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class mod_Deconstruction {
public static Block deconstructionTable;



public static void RegisterBlocks(){
	GameRegistry.registerBlock(deconstructionTable, "deconstructionTable");
}

public static void RegisterNames(){
	LanguageRegistry.addName(deconstructionTable, "Deconstruction Table");
	}

public static void RegisterRecipes(){

	GameRegistry.addRecipe(new ItemStack(deconstructionTable, 1), "BDB", "ACA", "AAA", 'A', Block.planks, 'B', Item.ingotIron, 'C', Block.workbench, 'D', Item.diamond);
	DeconstructionManager.getInstance().addRecipe(new ItemStack(deconstructionTable, 1), new Object[]{"BDB", "ACA", "AAA", 'A', Block.planks, 'B', Item.ingotIron, 'C', Block.workbench, 'D', Item.diamond});
        

}




// The instance of your mod that Forge uses.
@Instance("deconstruction")
public static mod_Deconstruction instance;

private GuiHandler guiHandler = new GuiHandler();
// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="deconstruction.client.ClientProxy", serverSide="deconstruction.common.CommonProxy")
public static CommonProxy proxy;

@PreInit
public void preInit(FMLPreInitializationEvent event) {

}

@Init
public void load(FMLInitializationEvent event) {

	//alchemyStation = new BlockAlchemy(601).setHardness(2.5F).setStepSound(Block.soundStoneFootstep);
	deconstructionTable = new BlockDeconstructionTable(600).setHardness(2.5F).setStepSound(Block.soundWoodFootstep);
	//GameRegistry.registerTileEntity(TileEntityStationAlchemy.class, "tileEntityStationAlchemy");
	//itemAlchemyStation =(new ItemReed(650, alchemyStation)).setUnlocalizedName("brewingStand").setCreativeTab(CreativeTabs.tabBrewing);
	RegisterBlocks();
	RegisterNames();
	RegisterRecipes();


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

}


@PostInit
public void postInit(FMLPostInitializationEvent event) {
	// Stub Method
}
}




 

 

ContainerDeconstructionTable:

 

package deconstruction.deconTable;

import java.util.Random;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import cpw.mods.fml.client.FMLClientHandler;
import deconstruction.common.mod_Deconstruction;


public class ContainerDeconstructionTable extends Container{

public ContainerDeconstructionTable(InventoryPlayer par1InventoryPlayer,
		World par2World, int par3, int par4, int par5) {
	// TODO Auto-generated constructor stub
}

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

 

Common and Client proxies:

 

package deconstruction.common;

public class CommonProxy{
public void registerRenderers(){

}
}

 

 

package deconstruction.client;

import deconstruction.common.CommonProxy;

public class ClientProxy extends CommonProxy{
@Override
public void registerRenderers(){

}
}

 

EDIT:

GuiDeconstruction:

 

package deconstruction.deconTable;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

import org.lwjgl.opengl.GL11;

public class GuiDeconstruction extends GuiContainer{

        public GuiDeconstruction(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) {
                super(new ContainerDeconstructionTable(par1InventoryPlayer, par2World, par3, par4, par5));
                // TODO Auto-generated constructor stub
        }
        /**
     * Draw the foreground layer for the GuiContainer (everything in front of the items)
     */
        protected void drawGuiContainerForegroundLayer(int par1, int par2)
        {
                this.fontRenderer.drawString("Deconstruction", 28, 6, 4210752);
        this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
        }

/**
     * Draw the background layer for the GuiContainer (everything behind the items)
     */
        protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
        {
                //int var4 = this.mc.renderEngine.getTexture("/mods/deconstruction/textures/gui/deconstruction.png");
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                //this.mc.renderEngine.bindTexture("/mods/deconstruction/textures/gui/deconstruction.png");
                this.mc.renderEngine.func_110577_a(new ResourceLocation("/mods/deconstruction/textures/gui/deconstruction.png"));
                int var5 = (this.width - this.xSize) / 2;
        int var6 = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
        }

        
}

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Compare this list (client-side-only mods) with your mods: https://www.dropbox.com/scl/fi/yeldxfv8ed60e4uflc2fi/Client-Side-Only-Modlist.xlsx?rlkey=8376c5bk7b33je2tad4p3ybrg&st=qf6osvit&dl=0  
    • Crashlog: https://paste.ee/p/WrGYD I'm thinking the problem might be a client side mod but ive already checked the mod list like 5 times and still cant find the problem
    • I'm unable to join my local forge servers. When running my forge servers of seemingly any version (tested 1.18 to 1.21.1) I get an error message [Forge Version Check/WARN] [ne.mi.fm.VersionChecker/]: Failed to process update information The server continues to start up and run, however I'm unable to join. Looking for solutions? Full error message: (note last "thead warning" error seems to be unrelated and only happened once for 1.20.1) Forge version check warning has happened for every version. [09:52:31] [Forge Version Check/WARN] [ne.mi.fm.VersionChecker/]: Failed to process update information java.net.http.HttpConnectTimeoutException: HTTP connect timed out         at jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:950) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:133) ~[java.net.http:?] {}         at net.minecraftforge.fml.VersionChecker$1.openUrlString(VersionChecker.java:142) ~[fmlcore-1.20.1-47.3.10.jar%23102!/:?] {}         at net.minecraftforge.fml.VersionChecker$1.process(VersionChecker.java:180) ~[fmlcore-1.20.1-47.3.10.jar%23102!/:?] {}         at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}         at net.minecraftforge.fml.VersionChecker$1.run(VersionChecker.java:117) ~[fmlcore-1.20.1-47.3.10.jar%23102!/:?] {} Caused by: java.net.http.HttpConnectTimeoutException: HTTP connect timed out         at jdk.internal.net.http.ResponseTimerEvent.handle(ResponseTimerEvent.java:68) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(HttpClientImpl.java:1788) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1385) ~[java.net.http:?] {} Caused by: java.net.ConnectException: HTTP connect timed out         at jdk.internal.net.http.ResponseTimerEvent.handle(ResponseTimerEvent.java:69) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(HttpClientImpl.java:1788) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1385) ~[java.net.http:?] {} [09:52:31] [Yggdrasil Key Fetcher/ERROR] [mojang/YggdrasilServicesKeyInfo]: Failed to request yggdrasil public key com.mojang.authlib.exceptions.AuthenticationUnavailableException: Cannot contact authentication server         at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:119) ~[authlib-4.0.43.jar%2375!/:?] {}         at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:91) ~[authlib-4.0.43.jar%2375!/:?] {}         at com.mojang.authlib.yggdrasil.YggdrasilServicesKeyInfo.fetch(YggdrasilServicesKeyInfo.java:94) ~[authlib-4.0.43.jar%2375!/:?] {}         at com.mojang.authlib.yggdrasil.YggdrasilServicesKeyInfo.lambda$get$1(YggdrasilServicesKeyInfo.java:81) ~[authlib-4.0.43.jar%2375!/:?] {}         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?] {}         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) ~[?:?] {}         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?] {}         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?] {}         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?] {}         at java.lang.Thread.run(Thread.java:1575) ~[?:?] {} Caused by: java.net.SocketTimeoutException: Connect timed out         at sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546) ~[?:?] {}         at sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:592) ~[?:?] {}         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?] {}         at java.net.Socket.connect(Socket.java:760) ~[?:?] {}         at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:304) ~[?:?] {}         at sun.net.NetworkClient.doConnect(NetworkClient.java:178) ~[?:?] {}         at sun.net.www.http.HttpClient.openServer(HttpClient.java:531) ~[?:?] {}         at sun.net.www.http.HttpClient.openServer(HttpClient.java:636) ~[?:?] {}         at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) ~[?:?] {}         at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:377) ~[?:?] {}         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:193) ~[?:?] {}         at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1273) ~[?:?] {}         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1114) ~[?:?] {}         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:179) ~[?:?] {}         at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1676) ~[?:?] {}         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1600) ~[?:?] {}         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223) ~[?:?] {}         at com.mojang.authlib.HttpAuthenticationService.performGetRequest(HttpAuthenticationService.java:140) ~[authlib-4.0.43.jar%2375!/:?] {}         at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:96) ~[authlib-4.0.43.jar%2375!/:?] {}         ... 9 more [09:52:31] [Server thread/WARN] [minecraft/MinecraftServer]: Can't keep up! Is the server overloaded? Running 5985ms or 119 ticks behind
    • Remove the mod tempad from the mods-folder
    • Hi, deleting the config folder did not appear to work, what mod are you referring to I could try to delete to fix the problem?
  • Topics

×
×
  • Create New...

Important Information

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