Advertisement
logancberrypie

Part of Elf client

Aug 12th, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. package net.minecraft.entity.player;
  2.  
  3. import net.minecraft.nbt.NBTTagCompound;
  4.  
  5. public class PlayerCapabilities
  6. {
  7. /** Disables player damage. */
  8. public boolean disableDamage;
  9.  
  10. /** Sets/indicates whether the player is flying. */
  11. public boolean isFlying;
  12.  
  13. /** whether or not to allow the player to fly when they double jump. */
  14. public boolean allowFlying;
  15.  
  16. /**
  17. * Used to determine if creative mode is enabled, and therefore if items should be depleted on usage
  18. */
  19. public boolean isCreativeMode;
  20.  
  21. /** Indicates whether the player is allowed to modify the surroundings */
  22. public boolean allowEdit = true;
  23. private float flySpeed = 0.05F;
  24. private float walkSpeed = 0.1F;
  25. private static final String __OBFID = "CL_00001708";
  26.  
  27. public void writeCapabilitiesToNBT(NBTTagCompound p_75091_1_)
  28. {
  29. NBTTagCompound var2 = new NBTTagCompound();
  30. var2.setBoolean("invulnerable", this.disableDamage);
  31. var2.setBoolean("flying", this.isFlying);
  32. var2.setBoolean("mayfly", this.allowFlying);
  33. var2.setBoolean("instabuild", this.isCreativeMode);
  34. var2.setBoolean("mayBuild", this.allowEdit);
  35. var2.setFloat("flySpeed", this.flySpeed);
  36. var2.setFloat("walkSpeed", this.walkSpeed);
  37. p_75091_1_.setTag("abilities", var2);
  38. }
  39.  
  40. public void readCapabilitiesFromNBT(NBTTagCompound p_75095_1_)
  41. {
  42. if (p_75095_1_.hasKey("abilities", 10))
  43. {
  44. NBTTagCompound var2 = p_75095_1_.getCompoundTag("abilities");
  45. this.disableDamage = var2.getBoolean("invulnerable");
  46. this.isFlying = var2.getBoolean("flying");
  47. this.allowFlying = var2.getBoolean("mayfly");
  48. this.isCreativeMode = var2.getBoolean("instabuild");
  49.  
  50. if (var2.hasKey("flySpeed", 99))
  51. {
  52. this.flySpeed = var2.getFloat("flySpeed");
  53. this.walkSpeed = var2.getFloat("walkSpeed");
  54. }
  55.  
  56. if (var2.hasKey("mayBuild", 1))
  57. {
  58. this.allowEdit = var2.getBoolean("mayBuild");
  59. }
  60. }
  61. }
  62.  
  63. public float getFlySpeed()
  64. {
  65. return this.flySpeed;
  66. }
  67.  
  68. public void setFlySpeed(float p_75092_1_)
  69. {
  70. this.flySpeed = p_75092_1_;
  71. }
  72.  
  73. public float getWalkSpeed()
  74. {
  75. return this.walkSpeed;
  76. }
  77.  
  78. public void setPlayerWalkSpeed(float p_82877_1_)
  79. {
  80. this.walkSpeed = p_82877_1_;
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement