Jump to content

Recommended Posts

Posted

Can anyone help me with making the block face the player on place because all the code I made changed the entire texture to be one when I had it

set to a mulittexture block I think I know whats wrong, but i could use a little help.

Posted

I think the onBlockPlacedBy function of BlockFurnace is a good place to start:

 

222     /**
223     * Called when the block is placed in the world.
224     */
225    public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving)
226    {
227        int var6 = MathHelper.floor_double((double)(par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
228
229        if (var6 == 0)
230        {
231            par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
232        }
233
234        if (var6 == 1)
235        {
236            par1World.setBlockMetadataWithNotify(par2, par3, par4, 5);
237        }
238
239        if (var6 == 2)
240        {
241            par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
242        }
243
244        if (var6 == 3)
245        {
246            par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
247        }
248    }

 

And then the metadata defines which side the block faces, with getBlockTextureFromSide.

 

To provide any more help, I'll have to get home and get to experimenting. So good luck for now. :D

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.