Advertisement
Guest User

Untitled

a guest
Dec 27th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. @Override
  2. public int getMetaFromState(IBlockState state) {
  3. if (((Boolean) state.getValue(hasTop)).booleanValue()) {
  4. return 1;
  5. } else if (((Boolean) state.getValue(hasTop)).booleanValue() && ((Boolean) state.getValue(isShort)).booleanValue()) {
  6. return 3;
  7. } else if (((Boolean) state.getValue(isShort)).booleanValue()) {
  8. return 2;
  9. }
  10. return 0;
  11. }
  12.  
  13. @Override
  14. public IBlockState getStateFromMeta(int meta) {
  15. if (meta == 1) {
  16. return this.getDefaultState().withProperty(hasTop, true).withProperty(isShort, false);
  17. } else if (meta == 2) {
  18. return this.getDefaultState().withProperty(isShort, true).withProperty(hasTop, false);
  19. } else if (meta == 0) {
  20. return this.getDefaultState().withProperty(hasTop, true).withProperty(isShort, true);
  21. } else {
  22. return this.getDefaultState().withProperty(hasTop, false).withProperty(isShort, false);
  23. }
  24. }
  25. @Override
  26. public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityplayer, EnumFacing side, float hitX, float hitY, float hitZ) {
  27. if (world.isRemote) {
  28. Item equipped = entityplayer.getCurrentEquippedItem() != null ? entityplayer.getCurrentEquippedItem().getItem() : null;
  29. System.out.print("Clicked");
  30. if (Block.getBlockFromItem(equipped) != null && Block.getBlockFromItem(equipped) instanceof StageBlockTop) {
  31. if (((Boolean) state.getValue(hasTop)).booleanValue()) {
  32. System.out.print("Has a Top");
  33. return false;
  34. } else {
  35. System.out.print("No Top");
  36. world.setBlockState(pos, state.withProperty(hasTop, true));
  37. world.markBlockForUpdate(pos);
  38. entityplayer.getCurrentEquippedItem().stackSize--;
  39. return true;
  40. }
  41.  
  42. }
  43.  
  44. if (equipped instanceof ItemHammer) {
  45. System.out.print("Hammer");
  46. TileEntity tile = world.getTileEntity(pos);
  47. if (entityplayer.isSneaking()) {
  48.  
  49. } else {
  50. }
  51. }
  52.  
  53. return true;
  54. } else {
  55. return false;
  56. }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement