Jump to content

Forge and Minecraft 1.3.1


ThunderSmotch

Recommended Posts

package techCraft.common;

import java.util.Random;

import net.minecraft.client.Minecraft;
import net.minecraft.src.*;
import net.minecraftforge.client.MinecraftForgeClient;
import techCraft.client.*;

public class mod_BlockDualWorkbench extends Block {
        
        public mod_BlockDualWorkbench(int id) {
                super(id, Material.iron);
                this.setCreativeTab(CreativeTabs.tabBlock);
                setHardness(2.5F);
                setBlockName("dualworkbench");
        }
        
        
        int Top = ModLoader.addOverride("/terrain.png", "/techCraft/workbenchTop.png");
        int Side1 =	ModLoader.addOverride("/terrain.png", "/techCraft/workbenchSide1.png");		
        int Side2 =	ModLoader.addOverride("/terrain.png", "/techCraft/workbenchSide2.png");
        

                public int idDropped(int metadata, Random random) {
                                return blockID;
                }

                protected int damageDropped(int metadata) {
                                return metadata;
                }

                // If you use metadata to change the texture of the block.
                public int getBlockTextureFromSideAndMetadata(int side, int metadata) {
                                switch (metadata){
                                case 0: {
                                	if(side == 1)
                                	return Top;
                                	if(side == 0)
                                    	return Block.blockSteel.getBlockTextureFromSide(0);
                                	if(side == 2)
                                    	return Side1;
                                	if(side == 3)
                                    	return Side1;
                                	if(side == 4)
                                    	return Side2;
                                	if(side == 5)
                                    	return Side2;
                                	
                                	break;
                                }
                                
                                }
							return Top;

                	

                }
                
                public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
                {
                	 if(par1World.isRemote)
                     {
                         return true;
                     } else
                     {
                    	 Minecraft.getMinecraft().displayGuiScreen(new mod_GuiCrafting(par5EntityPlayer.inventory, par1World, par2, par3, par4));
                         //par5EntityPlayer.openGui(mod_TechCraft.instance, 1, par1World, par2, par3, par4 );
                         
                         return true;
                     }
                		
                }

                

                
                                
}

 

package techCraft.client;

import net.minecraft.src.*;

import org.lwjgl.opengl.GL11;

import techCraft.common.mod_ContainerWorkbench;

public class mod_GuiCrafting extends GuiContainer
{
    public mod_GuiCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
    {
        super(new mod_ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5));
        this.ySize = 219;
    }

    /**
     * Called when the screen is unloaded. Used to disable keyboard repeat events
     */
    public void onGuiClosed()
    {
        super.onGuiClosed();
    }

    /**
     * Draw the foreground layer for the GuiContainer (everythin in front of the items)
     */
    protected void drawGuiContainerForegroundLayer()
    {
        this.fontRenderer.drawString(StatCollector.translateToLocal("container.crafting"), 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("/gui/dual.png");
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.mc.renderEngine.bindTexture(var4);
        int var5 = (this.width - this.xSize) / 2;
        int var6 = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
    }

public static Object buildGUI(InventoryPlayer inventory, World world, int x, int y, int z) {

	return new mod_GuiCrafting(inventory, world, x, y, z);
}


}

 

These are the codes ;s

Link to comment
Share on other sites

Oh you use your own workbench gui, I thought you 'barrowed' the vanilla one...

(I want to make a mod that adds a workbench item instead of a block to the game, but I have no clue on how to trick mc into opening a crafting window without workbench...)

Thanks a lot though, I might end up making an own GUI too.

Please send me all the typo's you found, I'm from Belgium and I'm a little dyslectic and suck @ typing.

width=700 height=100http://dries007.net/banner.png[/img]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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