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.

OhMyOhmit

Members
  • Joined

  • Last visited

  1. Hello everyone! I've got two questions. First question is about getting event when player left clicks on block in adventure mode. I am using this code to attack mobs through grass. Everything works fine, except when I am in adventure mode - code in PlayerInteractEvent.LeftClickBlock never runs in gamemode 2. Is there any other possible ways to make the code run even by another satisfying way? The second question is about arm swing animation. I am using this code @SubscribeEvent public void onAttackEntity(AttackEntityEvent event) { event.setCanceled(true); } to prevent entity from being damaged and it works fine, but I also need to cancel arm's animation in it. Any chances? This looks weird and I really need to get rid of it. Thanks.
  2. Hello everyone. I am trying to make player look at entity. Everything works fine, but I want to make camera move smoother. Now it just "stands" at one point and whenever I try to move camera, it's coming back to a point in very ugly way. Here's my code: public static void lookAt(EntityPlayer player) { EntityLiving ent = getFocusEntity(); double endX = ent.posX; double endY = ent.posY - ent.getEyeHeight() + (ent.height - 1); double endZ = ent.posZ; double deltaX = endX - player.posX; double deltaY = endY - player.posY; double deltaZ = endZ - player.posZ; double hypotenuse = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ); float rotationYaw = (float) Math.toDegrees(Math.atan2(deltaX, deltaZ)); float rotationPitch = (float) Math.toDegrees(Math.atan2(deltaY, hypotenuse)); player.rotationYaw = -rotationYaw; player.prevRotationYaw = -rotationYaw; player.rotationPitch = -rotationPitch; player.prevRotationPitch = -rotationPitch; //player.capabilities.setPlayerWalkSpeed(0.05F); } I've found a smooth camera's code (one that turns on with F8), but don't know what to do with it. if (this.mc.gameSettings.smoothCamera) { float f = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; float f1 = f * f * f * 8.0F; this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * f1); this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * f1); this.smoothCamPartialTicks = 0.0F; this.smoothCamYaw = 0.0F; this.smoothCamPitch = 0.0F; } else { this.smoothCamFilterX = 0.0F; this.smoothCamFilterY = 0.0F; this.mouseFilterXAxis.reset(); this.mouseFilterYAxis.reset(); } if (this.mc.gameSettings.smoothCamera) { this.smoothCamYaw += f2; this.smoothCamPitch += f3; float f4 = partialTicks - this.smoothCamPartialTicks; this.smoothCamPartialTicks = partialTicks; f2 = this.smoothCamFilterX * f4; f3 = this.smoothCamFilterY * f4; this.mc.thePlayer.setAngles(f2, f3 * (float)i); } else { this.smoothCamYaw = 0.0F; this.smoothCamPitch = 0.0F; this.mc.thePlayer.setAngles(f2, f3 * (float)i); }

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.