1
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:
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
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
Create an account or sign in to comment.
12
1
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
Just make a workbench2 = new workbench.... just extend the workbench class
that all pretty much
1
I tried doing this although it appears that the BlockWorkbench class is protected.
1
I hope you realise that reading obfuscated code is really hard to do. At this point I have no idea why
is returning a boolean. I might be able to figure out why, but I don't know what any of those ints or floats are and what they are doing. I am also wondering why you did a useless if statement here:
Could've done this:
And two final things, I'm new to forge modding(so please correct me if I am wrong, and tell me why), but couldn't you just extend the craftingbench class..? Also, this class means absolutely nothing. From what I can tell, it is a block with a texture.
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_)
is returning a boolean. I might be able to figure out why, but I don't know what any of those ints or floats are and what they are doing. I am also wondering why you did a useless if statement here:
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");
}
Could've done this:
if (inverted) {
this.setBlockTextureName("stonebricks:invertedcrafting_brick");
this.setBlockName("crafting_brick_inverted");
} else {
this.setBlockTextureName("stonebricks:crafting_brick");
this.setBlockName("crafting_brick");
}
And two final things, I'm new to forge modding(so please correct me if I am wrong, and tell me why), but couldn't you just extend the craftingbench class..? Also, this class means absolutely nothing. From what I can tell, it is a block with a texture.
1
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.
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
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...
Although, I know that's not what you're looking for...
1
I want the original crafting table to still exist.
1
Yeah...I figured that was the case.
1
Yeah, I'm pretty sure that'd be way easier
1
BUMP!
1
bump
1
Didn't even bother changing the function names?
1
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