Jump to content

toni714

Members
  • Posts

    1
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

toni714's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello, your problem is that the set default direction function works based on the surrounding blocks, not on you i had the same problem i left the on block added function out completely and added a function (in the block class) and call it in the on block placed by function like so: onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase, ItemStack p_149689_6_){ byte b0 = 3; b0=rotateBlock(b0, entity);//call my function world.setBlockMetadataWithNotify(i, j, k, b0, 2); } and here is the function: public byte rotateBlock(byte b0, EntityLivingBase entity){ if((entity.rotationYaw>=135&&entity.rotationYaw<=181)||(entity.rotationYaw<=-135&&entity.rotationYaw>=-181)){ //if entity is faceing north b0 = 3; }else if(entity.rotationYaw>-135&&entity.rotationYaw<-45){ //if entity is faceing east b0 = 4; }else if(entity.rotationYaw>=-45&&entity.rotationYaw<=45){ //if entity is faceing south b0 = 2; }else if(entity.rotationYaw>45&&entity.rotationYaw<135){ //if entity is faceing west b0 = 5; //sometimes rotationYaw gets over 180 or under -180 //for example 185 equals the rotation at -175 //so im fixing that by subtracting 360 if it is over 180 or under -180 }else if(entity.rotationYaw>=181){ entity.rotationYaw=entity.rotationYaw-360; b0=rotateBlock(b0, entity); }else if(entity.rotationYaw<=-181){ entity.rotationYaw=entity.rotationYaw+360; b0=rotateBlock(b0, entity); } return b0; } i hope that helps you
×
×
  • Create New...

Important Information

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