Advertisement
Guest User

Block

a guest
Dec 8th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. package BlocksPers;
  2.  
  3. import fr.shyfe.dcedo.proxy.ClientProxy;
  4. import net.minecraft.block.Block;
  5. import net.minecraft.block.material.Material;
  6. import net.minecraft.entity.EntityLivingBase;
  7. import net.minecraft.item.ItemStack;
  8. import net.minecraft.tileentity.TileEntity;
  9. import net.minecraft.util.MathHelper;
  10. import net.minecraft.world.World;
  11.  
  12. public class flagSpawn extends Block {
  13.  
  14. public flagSpawn(Material material) {
  15. super(material);
  16. }
  17.  
  18. @Override
  19. public TileEntity createTileEntity(World world, int metadata)
  20. {
  21. return new TileEntityFlagSpawn();
  22. }
  23.  
  24. @Override
  25. public boolean hasTileEntity(int metadata)
  26. {
  27. return true;
  28. }
  29.  
  30. public boolean isOpaqueCube()
  31. {
  32. return false;
  33. }
  34.  
  35. public boolean renderAsNormalBlock()
  36. {
  37. return false;
  38. }
  39.  
  40. public int getRenderType()
  41. {
  42. return ClientProxy.tesrRenderId;
  43. }
  44.  
  45. public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
  46. {
  47. if(stack.getItemDamage() == 0)
  48. {
  49. TileEntity tile = world.getTileEntity(x, y, z);
  50. if(tile instanceof TileEntityFlagSpawn)
  51. {
  52. int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
  53. ((TileEntityFlagSpawn)tile).setDirection((byte)direction);
  54. }
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement