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;
}
}
}