Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, I have been messing around with mobs and I have a mob that stands and walks on two legs when f3 (the head rotation yaw parameter) is greater than or equal to zero or when f4 (the rotation pitch parameter) is also greater than or equal to 0. It makes the mob wander around on all fours most of the time and on occasion it will walk on two legs. There is a quirk however, it will randomly stand up and sit down rapidly here n there. To accomplish this I use the .addChild method and have constructed my model so that the head is stationary and gets translated downward by the appropriate amount when the rest of the model is rotated 90 degrees to obtain the walking on all fours animation but the rest of the time it walks on two legs.

 

 

[my setRotationAngles code]

public void setRotationAngles(float rotationTime, float legRotationAmplitude, float noIdeaWhatThisDoesOrIsUsedFor, float rotationYaw, float rotationPitch, float scale, Entity entity)
  {
    super.setRotationAngles(rotationTime, legRotationAmplitude, noIdeaWhatThisDoesOrIsUsedFor, rotationYaw, rotationPitch, scale, entity);
    
      
    //Head Animation
  HeadMain.rotateAngleX = (float) (rotationPitch / 57.29578F);
  HeadMain.rotateAngleY = (float) (rotationYaw / 57.29578F);
  
      
      RotationSet legL = new RotationSet(Arrays.asList(LegLMain));
  RotationSet legR = new RotationSet(Arrays.asList(LegRMain));
  RotationSet ArmL = new RotationSet(Arrays.asList(ArmLMain));
  RotationSet ArmR = new RotationSet(Arrays.asList(ArmRMain));
  RotationSet Tail = new RotationSet(Arrays.asList(TailMain));

  float RotateArmLX = MathHelper.cos(rotationTime * 0.6662F + (float)Math.PI) * legRotationAmplitude;
  float RotateArmLY = MathHelper.cos(rotationTime * 0.6662F + (float)Math.PI) * legRotationAmplitude;
  float RotateArmLZ = MathHelper.cos(rotationTime * 0.6662F + (float)Math.PI) * legRotationAmplitude;
  
  float RotateArmRX = MathHelper.cos(rotationTime * 0.6662F) * legRotationAmplitude;
  float RotateArmRY = MathHelper.cos(rotationTime * 0.6662F) * legRotationAmplitude;
  float RotateArmRZ = MathHelper.cos(rotationTime * 0.6662F) * legRotationAmplitude;
  
  float RotatelegLX = MathHelper.cos(rotationTime * 0.6662F) * legRotationAmplitude;
  float RotatelegLY = MathHelper.cos(rotationTime * 0.6662F) * legRotationAmplitude;
  float RotatelegLZ = MathHelper.cos(rotationTime * 0.6662F) * legRotationAmplitude;
  
  float RotatelegRX = MathHelper.cos(rotationTime * 0.6662F + (float)Math.PI) * legRotationAmplitude;
  float RotatelegRY = MathHelper.cos(rotationTime * 0.6662F + (float)Math.PI) * legRotationAmplitude;
  float RotatelegRZ = MathHelper.cos(rotationTime * 0.6662F + (float)Math.PI) * legRotationAmplitude;
  
  float RotateTailX = MathHelper.cos(rotationTime * 0.32F + (float)Math.PI) * legRotationAmplitude *2;
  float RotateTailY = MathHelper.cos(rotationTime * 0.32F + (float)Math.PI) * legRotationAmplitude *2;
  float RotateTailZ = (float) (MathHelper.sin(rotationTime * 0.32F + (float)Math.PI) * legRotationAmplitude *2.2);
  
  	legL.doRotation(RotatelegLX, 0, 0);
	//legL.doRotation(0, RotatelegLY, 0);
	//legL.doRotation(0, 0, RotatelegLZ);

	 legR.doRotation(RotatelegRX, 0, 0);
   // legR.doRotation(0, RotatelegRY, 0);
	//legR.doRotation(0, 0, RotatelegRZ);

	// ArmL.doRotation(RotateArmLX, 0,0 );
	// ArmL.doRotation(0,RotateArmLY, 0);
	ArmL.doRotation(0, 0, RotateArmLZ);

	// ArmR.doRotation(RotateArmRX, 0,0 );
	// ArmR.doRotation(0,RotateArmRY, 0);
	ArmR.doRotation(0, 0, RotateArmRZ);

	// Tail.doRotation(RotateTailX, 0,0 );
	// Tail.doRotation(0,RotateTailY, 0);
	Tail.doRotation(0, 0, RotateTailZ);


	if (rotationYaw >= 0F || rotationPitch >= 0) {
		// running on all fours
		ModifiedModelRenderer renderMob = this.MobModel;
		renderMob.rotateAngleX = ((float) (renderMob.rotateAngleZ + (float) (90 * Math.PI / 180)));

		ModifiedModelRenderer renderArmL = this.ArmLMain;
		renderArmL.rotateAngleX = ((float) (renderArmL.rotateAngleX - (60 * Math.PI / 180)));
		renderArmL.rotateAngleY = ((float) (renderArmL.rotateAngleY - (30 * Math.PI / 180)));

		ModifiedModelRenderer renderArmR = this.ArmRMain;
		renderArmR.rotateAngleX = ((float) (renderArmR.rotateAngleX - (60 * Math.PI / 180)));
		renderArmR.rotateAngleY = ((float) (renderArmR.rotateAngleY - (-30* Math.PI / 180)));

		ModifiedModelRenderer renderLegL = this.LegLMain;
		renderLegL.rotateAngleX = ((float) (renderLegL.rotateAngleX - (60 * Math.PI / 180)));

		ModifiedModelRenderer renderLegR = this.LegRMain;
		renderLegR.rotateAngleX = ((float) (renderLegR.rotateAngleX - (60 * Math.PI / 180)));

		ModifiedModelRenderer renderTail = this.TailMain;
		renderTail.rotateAngleX = ((float) (renderTail.rotateAngleX - (90 * Math.PI / 180)));

	}

	else {

		// walking on Two Legs
		ModifiedModelRenderer renderMob = this.MobModel;
		renderMob.rotateAngleX = ((float) (renderMob.rotateAngleZ));

		ModifiedModelRenderer renderArmL = this.ArmLMain;
		renderArmL.rotateAngleX = ((float) (renderArmL.rotateAngleX));
		renderArmL.rotateAngleY = ((float) (renderArmL.rotateAngleY));

		ModifiedModelRenderer renderArmR = this.ArmRMain;
		renderArmR.rotateAngleX = ((float) (renderArmR.rotateAngleX));
		renderArmR.rotateAngleY = ((float) (renderArmR.rotateAngleY));

		ModifiedModelRenderer renderLegL = this.LegLMain;
		renderLegL.rotateAngleX = ((float) (renderLegL.rotateAngleX));

		ModifiedModelRenderer renderLegR = this.LegRMain;
		renderLegR.rotateAngleX = ((float) (renderLegR.rotateAngleX));

	}


	if (rotationYaw >=0.0F) //spins the ears like a helicopter dick I want to implement a twitch here
        {
    // ModifiedModelRenderer renderEarR = this.EarR;
  //   renderEarR.rotateAngleZ = ((float)(renderEarR.rotateAngleZ - (0.25D * MathHelper.cos(rotationYaw / 8.0F) + 0.5D)));
       
       	        }
         else
       {
     //   ModifiedModelRenderer renderEarL = this.EarL; 
     //   renderEarL.rotateAngleZ = ((float)(renderEarL.rotateAngleZ + (0.5D * MathHelper.sin(rotationYaw / 8.0F) + 0.5D)));
        }
       
      }

 

 

 

I was wondering two things,

 

1) how are the parameters f3 and f4 actually being called/created in minecraft (I am having trouble understanding how animations can be called or how these parameters are created) All I understand is that they are related to the pitch and yaw of the models head. where the head can be animated using

 

 //Head Animation
  HeadMain.rotateAngleX = (float) (rotationPitch / 57.29578F);
  HeadMain.rotateAngleY = (float) (rotationYaw / 57.29578F);

as such I see that they are angles but how are they being called when the entity moves

 

2) how would I increase the wander frequency of a mob (ie get it to wander around more often and for longer distances)

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.