Jump to content

Recommended Posts

Posted

I'm trying to create custom signs but i have 2 problems:

1)-The sign that is on the ground has no stick attached

2)-The sign doesn't show the texture i say

 

I know i have to register the sign like this:

GameRegistry.registerBlock(wood_sign_wall= new CustomSign(TileEntitySign.class, false, Blocks.cobblestone,0).setBlockName("wood_sign_wall"), "wood_sign_wall" );
	GameRegistry.registerBlock(wood_sign_standing= new CustomSign(TileEntitySign.class, true, Blocks.cobblestone,0).setBlockName("wood_sign_standing"), "wood_sign_standing" );

And also an itemsign like this:

GameRegistry.registerItem(wood_item_sign = new CustomItemSign().setUnlocalizedName("wood_item_sign").setTextureName(tem.modid+":"+"flux"), "wood_item_sign");

The texture i give here for the item is just for testing purpose and i think it doesn't even matter.

now for the classes i have this

 

CustomSign (block):

 

public class CustomSign extends BlockSign{

private Block plank;
private int meta;
protected CustomSign(Class signclass, boolean bool, Block block, int meta) {
	super(signclass, bool);
	this.plank=block;
	this.meta=meta;

}

@Override
@SideOnly(Side.CLIENT)
    public IIcon getIcon(int side, int meta)
    {
	return this.plank.getIcon(side, this.meta);
    }

    @Override
    public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
    {
        return Items.sign;
    }

    
    
@Override
@SideOnly(Side.CLIENT)
    public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_)
    {
        return Items.sign;
    }

@Override
    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister reg) {

}
}

 

 

and the itemclass:

 

public class CustomItemSign  extends ItemSign{

public CustomItemSign()
    {
        this.maxStackSize = 16;
        this.setCreativeTab(CreativeTabs.tabDecorations);
    }

    /**
     * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
     * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
     */
@Override
    public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float pointX, float pointY, float pointZ)
    {
        if (side == 0)
        {
            return false;
        }
        else if (!world.getBlock(x, y, z).getMaterial().isSolid())
        {
            return false;
        }
        else
        {
            if (side == 1)
            {
                ++y;
            }

            if (side == 2)
            {
                --z;
            }

            if (side == 3)
            {
                ++z;
            }

            if (side == 4)
            {
                --x;
            }

            if (side == 5)
            {
                ++x;
            }

            if (!player.canPlayerEdit(x, y, z, side, stack))
            {
                return false;
            }
            else if (!TemBlocks.wood_sign_standing.canPlaceBlockAt(world, x, y, z))
            {
                return false;
            }
            else if (world.isRemote)
            {
                return true;
            }
            else
            {
                if (side == 1)
                {
                    int i1 = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
                    world.setBlock(x, y, z, TemBlocks.wood_sign_standing, i1, 3);
                }
                else
                {
                	world.setBlock(x, y, z, TemBlocks.wood_sign_wall, side, 3);
                }

                --stack.stackSize;
                TileEntitySign tileentitysign = (TileEntitySign)world.getTileEntity(x, y, z);

                if (tileentitysign != null)
                {
                	player.func_146100_a(tileentitysign);
                }

                return true;
            }
        }
    }

}

 

The function of the sign  is working good.

It just doesn't render well and /or is misplaced on the ground here a picture

 

0fztwmy

 

Posted

Go through and deobfuscate that back to readable variable names. It'll be a lot easier for use to help you figure out what's wrong.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Go through and deobfuscate that back to readable variable names. It'll be a lot easier for use to help you figure out what's wrong.

 

i updated the code, but i do not know what func_146100_a is, but i think it doesn't matter.

 

I don't think does gives you a better view, why the pole isn't rendering and why my own texture isn't rendering, but you asked for readable variables, so here they are!

Posted

I suspect that you're using Vanilla's renderer for this and it does a "if block is X { render standing } else { render wall }" type check.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well, i was using no renderer. I didn't knew i had to. How should i know?  :P Thank you for pointing me in that direction.

I have created my signrendering class now, but i do not know how i register it?

Can you help me with that?

 

EDIT:

Ok i found how to register the render and it works,but....yeah there is a "but" again.

 

My sign still has not the custom texture and now my sign is acting strange.

If i place the sign i'll get the gui where i can type my text on the sign, but it appears the sign on the gui screen turns around his axis equal as the player's angle.

 

Customs signs are harder as i thought....

Posted

Post code and picture.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.