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.

thisisatest

Members
  • Joined

  • Last visited

Everything posted by thisisatest

  1. Thank for you for your response; I followed your advice. On execution, however, the while loop produced, for a few seconds before crashing, a 1.57GB file filled with lines stating the player's initial assigned velocity (2.0). To fix this, I think I would like to have this velocity measurement run every 5 ticks or so. I've read about Forge's TickEvent - I frankly don't know how to use it though. Here is my code: public void onLanded(World worldIn, Entity entityIn) { if (entityIn.isSneaking()) { super.onLanded(worldIn, entityIn); } else if (entityIn.motionY < 0.0D) { entityIn.motionY = 2; entityIn.motionX = 0; try{ File file = new File("data_log.txt"); if(!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file); PrintWriter pw = new PrintWriter(fw); double start = worldIn.getTotalWorldTime(); while(entityIn.collidedVertically != true) { if(worldIn != null && (worldIn.getWorldTime() - start) % 5 == 0) { pw.println(entityIn.motionY); } } pw.close(); } catch(IOException e) {e.printStackTrace();} if (!(entityIn instanceof EntityLivingBase)) { entityIn.motionY *= 0.0D; } } }
  2. I've made a player "springboard" that launches them into the air. I want to log the player's velocity every 5 ticks and log it all neatly in a text file after which you could plug the data in Logger Pro and graph it. I am having trouble doing this and as a novice programmer have this mess below: public void onLanded(World worldIn, Entity entityIn) { if (entityIn.isSneaking()) { super.onLanded(worldIn, entityIn); } else if (entityIn.motionY < 0.0D) { entityIn.motionY = 2; entityIn.motionX = 0; try{ File file = new File("data_log.txt"); if(!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file); PrintWriter pw = new PrintWriter(fw); pw.println(entityIn.motionY); //World world = Minecraft.getMinecraft().world; //double start = world.getTotalWorldTime(); //while(entityIn.motionY != 0) { //if(world != null && (world.getWorldTime() - start) % 5 == 0) { pw.println(entityIn.motionY); //} //} pw.close(); } catch(IOException e) {e.printStackTrace();} if (!(entityIn instanceof EntityLivingBase)) { entityIn.motionY *= 0.0D; }}} ~The commented sections cause a crash~

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.