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.

bowerbank

Members
  • Joined

  • Last visited

Everything posted by bowerbank

  1. Thank you so much
  2. Hi, how can I get the coordinates of the player's spawn point? I want to do this in the onLivingHurt event. This is what I have now: @SubscribeEvent public static void onLivingHurt(LivingHurtEvent event){ if(event.getEntity() instanceof Player player){ player.getCapability(PlayerZonesProvider.PLAYER_ZONES).ifPresent(zones->{ if(event.getSource()!=player.damageSources().fall()){ double distanceFromSpawn=Math.sqrt(Math.pow(player.getX(),2)+Math.pow(player.getZ(),2));//i want to replace this with the true respawn position BlockPos spawnPosition=((ServerPlayer) player).getRespawnPosition();//this always ends up being null //if(spawnPosition != null) player.sendSystemMessage(Component.literal(Integer.toString(spawnPosition.getX()))); int currentZone=zones.getCurrentZone(distanceFromSpawn); player.hurt(player.damageSources().fall(),event.getAmount()*(currentZone+1)); } }); } } However, it always crashes immediately because spawnPosition is null: Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.core.BlockPos.getX()" because "spawnPosition" is null What am I doing wrong?
  3. that worked, thank you so much
  4. In 1.19 I could use player.hurt(DamageSource.FALL, someFloat) to give the player fall damage. but now in 1.20 it says "cannot resolve symbol 'FALL'". Is there still an easy way to deal fall damage, or damage of any specific type? sorry if this is a dumb question i have never had to update to a new version of minecraft before

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.