1

[Help] Exact copy of a crafting table...

Unlocked 8/31/14 5:21 pm
758
9/3/2014 8:00 pm
Hi. I want to make a crafting table/workbench/whatever that acts EXACTLY the same as the vanilla one, but I want to retexture my version. The following is my code:

package com.unlocked.stone_bricks.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockWorkbench;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;

public class CraftingBrick extends Block
{

private static final String __OBFID = "CL_00000221";

public CraftingBrick(boolean inverted)
{
super(Material.rock);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setHardness(1.5f);
this.setResistance(10f);
if (inverted){
this.setBlockName("crafting_brick_inverted");
}
else{
this.setBlockName("crafting_brick");
}

if (inverted){
this.setBlockTextureName("stonebricks:invertedcrafting_brick");
}
else{
this.setBlockTextureName("stonebricks:crafting_brick");
}
}


/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{

if (!p_149727_1_.isRemote)
{
return true;
}
else
{
p_149727_5_.displayGUIWorkbench(p_149727_2_, p_149727_3_, p_149727_4_);
return true;
}
}
}


It works... kind of. The GUI opens and I can craft with it but the item selection is messed up I can never tell what I'm selecting when I click. If anyone could help, it would be appreciated.

~Unlocked
Posted by
Unlocked
Level 30 : Artisan Dragon
10

  Have something to say?

JoinSign in

12

dunem666
09/03/2014 7:14 am
Level 44 : Master Network
You dont need to copy the workbench code at all...

Just make a workbench2 = new workbench.... just extend the workbench class

that all pretty much
1
Unlocked
09/03/2014 8:00 pm
Level 30 : Artisan Dragon
I tried doing this although it appears that the BlockWorkbench class is protected.
1
anonpmc844841
09/03/2014 4:09 am
Level 13 : Journeyman Miner
[deleted]
1
EsvDefcon
09/03/2014 1:49 am
Level 62 : High Grandmaster Programmer
Firstly, you are using obfuscated code, and you haven't even bothered renaming all of the functions, etc. Make your code more legibly.

Secondly, you might as well make a new crafting bench, there's absolutely no point (from what you've posted) in making a duplicate vanilla crafting bench.

That aside, clean up your code, and then post it again. It will be much easier to see what's wrong with it.
1
Zitzabis
09/03/2014 12:05 am
Level 76 : Legendary Programmer Gent
What about...a resource pack. That allows you to use a crafting table normally but with a different texture.
Although, I know that's not what you're looking for...
1
Unlocked
09/03/2014 12:28 am
Level 30 : Artisan Dragon
I want the original crafting table to still exist.
1
Zitzabis
09/03/2014 12:31 am
Level 76 : Legendary Programmer Gent
Yeah...I figured that was the case.
1
funny bunny
09/03/2014 12:14 am
Level 31 : Artisan Dragonborn
Yeah, I'm pretty sure that'd be way easier
1
Unlocked
09/03/2014 12:02 am
Level 30 : Artisan Dragon
BUMP!
1
Unlocked
09/01/2014 11:05 am
Level 30 : Artisan Dragon
bump
1
TheXFactor117
08/31/2014 5:26 pm
Level 60 : High Grandmaster Programmer
Didn't even bother changing the function names?
1
Unlocked
08/31/2014 5:32 pm
Level 30 : Artisan Dragon
Everything there is referencing vanilla functions so that I wouldn't have to do all of the work of getting a custom GUI to work
1

Welcome