Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ride
- public boolean interact(EntityPlayer par1EntityPlayer)
- {
- par1EntityPlayer.mountEntity(this);
- return true;
- }
- //wasd Keyboard Moving
- public void moveEntityWithHeading(float par1, float par2)
- {
- if (this.riddenByEntity != null)
- {
- this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw;
- this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F;
- this.setRotation(this.rotationYaw, this.rotationPitch);
- this.rotationYawHead = this.renderYawOffset = this.rotationYaw;
- par1 = ((EntityLivingBase)this.riddenByEntity).moveStrafing * 0.5F;
- par2 = ((EntityLivingBase)this.riddenByEntity).moveForward;
- //Block jump height
- this.stepHeight = 1.0F;
- //Moving speed
- this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F;
- if (!this.worldObj.isRemote)
- {
- this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
- super.moveEntityWithHeading(par1, par2);
- }
- this.prevLimbSwingAmount = this.limbSwingAmount;
- double d0 = this.posX - this.prevPosX;
- double d1 = this.posZ - this.prevPosZ;
- float f4 = MathHelper.sqrt_double(d0 * d0 + d1 * d1) * 4.0F;
- if (f4 > 1.0F)
- {
- f4 = 1.0F;
- }
- this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F;
- this.limbSwing += this.limbSwingAmount;
- }
- else
- {
- this.stepHeight = 0.5F;
- this.jumpMovementFactor = 0.02F;
- super.moveEntityWithHeading(par1, par2);
- }
- }
- public void updateRiderPosition()
- {
- super.updateRiderPosition();
- if (this.riddenByEntity != null)
- {
- //Ride height + 1.0D, - 1.0D...
- this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + 0.0D + this.riddenByEntity.getYOffset(), this.posZ);
- }
- }
- public String getEntityName(){
- return "MCreator Entity Name";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment