jtrent238

Rideable Mobs [1.7.10] mcreator [1.5.6]

Feb 15th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.83 KB | None | 0 0
  1. //ride
  2.  
  3. public boolean interact(EntityPlayer par1EntityPlayer)
  4.  
  5. {
  6.  
  7. par1EntityPlayer.mountEntity(this);
  8.  
  9. return true;
  10.  
  11. }
  12.  
  13. //wasd Keyboard Moving
  14. public void moveEntityWithHeading(float par1, float par2)
  15.  
  16. {
  17.  
  18. if (this.riddenByEntity != null)
  19.  
  20. {
  21.  
  22. this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
  23.  
  24. this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
  25.  
  26. this.setRotation(this.rotationYaw, this.rotationPitch);
  27.  
  28. this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
  29.  
  30. par1 = ((EntityLivingBase)this.riddenByEntity).moveStrafing * 0.5F;
  31.  
  32. par2 = ((EntityLivingBase)this.riddenByEntity).moveForward;
  33.  
  34.  //Block jump height
  35.  
  36. this.stepHeight = 1.0F;
  37.  
  38. //Moving speed
  39.  
  40. this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F;
  41.  
  42.  
  43.  
  44. if (!this.worldObj.isRemote)
  45.  
  46. {
  47.  
  48. this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
  49.  
  50. super.moveEntityWithHeading(par1, par2);
  51.  
  52. }
  53.  
  54. this.prevLimbSwingAmount = this.limbSwingAmount;
  55.  
  56. double d0 = this.posX - this.prevPosX;
  57.  
  58. double d1 = this.posZ - this.prevPosZ;
  59.  
  60. float f4 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F;
  61.  
  62.  
  63.  
  64. if (f4 > 1.0F)
  65.  
  66. {
  67.  
  68. f4 = 1.0F;
  69.  
  70. }
  71.  
  72.  
  73.  
  74. this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
  75.  
  76. this.limbSwing += this.limbSwingAmount;
  77.  
  78. }
  79.  
  80. else
  81.  
  82. {
  83.  
  84. this.stepHeight = 0.5F;
  85.  
  86. this.jumpMovementFactor = 0.02F;
  87.  
  88. super.moveEntityWithHeading(par1, par2);
  89.  
  90. }
  91. }
  92. public void updateRiderPosition()
  93.  
  94. {
  95.  
  96. super.updateRiderPosition();
  97.  
  98.  
  99.  
  100. if (this.riddenByEntity != null)
  101.  
  102. {
  103.  
  104. //Ride height + 1.0D, - 1.0D...
  105.  
  106. this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + 0.0D + this.riddenByEntity.getYOffset(), this.posZ);
  107.  
  108. }
  109.  
  110. }
  111.  
  112.   public String getEntityName(){
  113.    return "MCreator Entity Name";
  114.   }
  115.  
  116.  }
Advertisement
Add Comment
Please, Sign In to add comment