Jump to content

[solved]Entity onUpdate crash


Jershy

Recommended Posts

      Every time i attemp to spawn my entity in the world it crashes. The crash report,

---- Minecraft Crash Report ----

// I blame Dinnerbone.

 

Time: 1/3/15 12:50 PM

Description: Ticking entity

 

java.lang.NullPointerException: Ticking entity

at src.IVWeather.entity.EntityWeatherAirmass.onUpdate(EntityWeatherAirmass.java:92)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2019)

at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:659)

at net.minecraft.world.World.updateEntity(World.java:1983)

at net.minecraft.world.World.updateEntities(World.java:1836)

at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:500)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:620)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:531)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:111)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:669)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at src.IVWeather.entity.EntityWeatherAirmass.onUpdate(EntityWeatherAirmass.java:92)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2019)

at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:659)

at net.minecraft.world.World.updateEntity(World.java:1983)

 

-- Entity being ticked --

Details:

Entity Type: null (src.IVWeather.entity.EntityWeatherAirmass)

Entity ID: 432

Entity Name: unknown

Entity's Exact location: 463.00, 60.00, 507.00

Entity's Block location: World: (463,60,507), Chunk: (at 15,3,11 in 28,31; contains blocks 448,0,496 to 463,255,511), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

Entity's Momentum: 0.00, 0.00, 0.00

Stacktrace:

at net.minecraft.world.World.updateEntities(World.java:1836)

at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:500)

 

-- Affected level --

Details:

Level name: New World

All players: 1 total; [EntityPlayerMP['Player727'/77, l='New World', x=463.30, y=72.20, z=507.63]]

Chunk stats: ServerChunkCache: 1067 Drop: 0

Level seed: -4909607235419393895

Level generator: ID 00 - default, ver 1. Features enabled: true

Level generator options:

Level spawn location: World: (-156,64,72), Chunk: (at 4,4,8 in -10,4; contains blocks -160,0,64 to -145,255,79), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 10859 game time, 10859 day time

Level dimension: 0

Level storage version: 0x04ABD - Anvil

Level weather: Rain time: 77029 (now: false), thunder time: 95663 (now: false)

Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true

Stacktrace:

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:620)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:531)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:111)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:669)

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.7.0_72, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 917281944 bytes (874 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 3138 (175728 bytes; 0 MB) allocated, 2911 (163016 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95

FML: MCP v9.03 FML v7.2.165.1063 Minecraft Forge 10.12.1.1063 4 mods loaded, 4 mods active

mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.2.165.1063} [Forge Mod Lo

leads me to the line 92 of my entity class, where I create a biome gen base that is from the world method getBiomeGenFromCoords. I have tried all that i could to attempt to fix this crash.

 

Entity class

package src.IVWeather.entity;

 

import java.util.List;

 

import src.IVWeather.biome.BiomeTemperature;

import src.IVWeather.block.BlockFlyingBlock;

import IVWeather.iv.biome.WindDirection;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.entity.Entity;

import net.minecraft.entity.effect.EntityWeatherEffect;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.util.AxisAlignedBB;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;

import net.minecraft.world.biome.BiomeDecorator;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraft.world.chunk.Chunk;

 

public class EntityWeatherAirmass extends WeatherEntity{

 

public World worldObj;

public float temperature;

public float maxGramsOfWaterHoldable;

public float currentGramsOfWaterInAir;

BiomeTemperature BiomeTemp;

public float evaporationrate;

public float dewpoint;

int time;

double droplesize;

boolean rainProcess;

double yboundingBoxERatePerTick;

public boolean eventFlag;

List precipitationCunkList;

public BiomeTemperature bt;

public EntityWeatherAirmass(World thisworld) {

super(thisworld);

}

 

public EntityWeatherAirmass(World arg0, float par1, Chunk chunk, double ddY, float setx, float setz) {

super(arg0);

this.setSize(setx, setz);

this.temperature = par1;

this.currentGramsOfWaterInAir =  evaporationrate;

this.maxGramsOfWaterHoldable = .1580888888888888f * (temperature * 50);

this.humidity = (this.currentGramsOfWaterInAir * 100) / this.maxGramsOfWaterHoldable;

    this.WARM = false;

  this.COOL = false;

  this.COLD = false;

  this.HOT = false;

  int time = 0;

  droplesize = 0;

 

  this.posX = chunk.xPosition;

  this.posZ = chunk.zPosition;

  this.posY = ddY;

}

 

 

 

 

 

public void getDensity(BiomeTemperature BiomeTemp, EntityWeatherAirmass par3, EntityWeatherAirmass par4)

{

 

if(par3.temperature > par4.temperature) {

par3.WARM = true;

}else{

par3.COLD = true;

}

 

 

}

 

public float gethumidity() {

return humidity;

}

 

public boolean canBeCollidedWith() {

return false;

 

}

 

 

boolean flerg;

private List collidingBoundingWeather;

 

public void onUpdate() {

// below is line 92

BiomeGenBase Biom = worldObj.getBiomeGenForCoords((int)Math.floor(this.posX), (int)Math.floor(this.posZ));

 

double prevPosY = this.posY;

double cbiomeTemp = bt.getBiomeTemp(worldObj, Biom);

 

this.collidingBoundingWeather.clear();

 

  int i = MathHelper.floor_double(this.boundingBox.minX);

  int j = MathHelper.floor_double(this.boundingBox.maxX + 1.0D);

  int k = MathHelper.floor_double(this.boundingBox.minY);

  int l = MathHelper.floor_double(this.boundingBox.maxY + 1.0D);

  int i1 = MathHelper.floor_double(this.boundingBox.minZ);

  int j1 = MathHelper.floor_double(this.boundingBox.maxZ + 1.0D);

  double d0 = 0.25D;

 

  for(int q = i; q < j; q++) {

  for(int w = k; k < l; k++) {

  for(int f = i1; f < j1; f++) {

 

  Block block = worldObj.getBlock(q, w, f);

 

  List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(d0, d0, d0));

 

  for (int j2 = 0; j2 < list.size(); j2++)

  {

    Entity entity = ((Entity)list.get(j2));

   

    if(entity instanceof EntityWeatherAirmass){

   

    this.collidingBoundingWeather.add(entity);

    }

double prevY = this.posY;

double prevMY= this.boundingBox.maxY;

 

for(int u =0; u < list.size(); u++) {

 

EntityWeatherAirmass e = (EntityWeatherAirmass) list.get(u);

 

e.WARM = false;

e.COLD = false;

e.HOT = false;

this.COLD = false;

this.HOT = false;

this.WARM = false;

 

if(e.temperature < this.temperature){

 

e.COLD = true;

this.WARM = true;

 

}else if(e.temperature > this.temperature){

 

e.WARM = true;

this.COLD = true;

 

}else if(e.temperature > this.temperature && e.humidity < this.humidity) {

 

e.HOT = true;

this.COLD = true;

 

}

 

boolean eAirMassTSupport = false;

boolean thisAirMassTSupport = false;

 

double distance = 0;

double distance2 = 0;

distance = Math.abs(this.temperature - cbiomeTemp);

distance2 = Math.abs(e.temperature - cbiomeTemp);

 

if(distance < distance2) {

eAirMassTSupport = true;

}

else

{

thisAirMassTSupport = true;

}

 

if(this.WARM) {

if(thisAirMassTSupport){

this.boundingBox.expand(0, this.temperature - cbiomeTemp, 0);

}

else

{

this.motionY = ((this.temperature - e.temperature) / 4);

}

}

 

if(this.COLD) {

if(this.getCollidingBlockWithWE(this, this.boundingBox).size() < 150 && this.boundingBox.minX <= 55) {

this.motionY = -((this.temperature - e.temperature) / 4);

}

}

if(this.HOT)  {

this.motionY = ((this.temperature - e.temperature) / 3);

if(e.humidity - this.humidity > this.humidity + (this.humidity / 6)) {

flerg = true;

}

}

 

if(flerg == true) {

this.humidity = this.humidity + (float) .001;

}

if(list.size() == 0) {

if(this.temperature > cbiomeTemp) {

this.WARM = true;

}else{

this.COLD = true;

}

this.boundingBox.expand(15, 0, 15);

if(this.boundingBox.maxY < 3000) {

this.boundingBox.expand(0, 15, 0);

if(this.WARM && this.boundingBox.maxY > (Biom.temperature - (this.boundingBox.maxY / 700))) {

 

}

}

}

if(bt.timeSinceLastRain > 0) {

this.evaporationrate = (float) (BiomeTemp.getBiomeTemp(worldObj, Biom)) * (bt.timeSinceLastRain /12000);

}else{

this.evaporationrate = (float) (BiomeTemp.getBiomeTemp(worldObj, Biom));

}

this.currentGramsOfWaterInAir = maxGramsOfWaterHoldable / evaporationrate;

this.maxGramsOfWaterHoldable = .1580888888888888f * (temperature * 50);

this.humidity = (this.currentGramsOfWaterInAir * 100) / this.maxGramsOfWaterHoldable;

  dewpoint = bt.getDewPoint(humidity, this.temperature);

 

  yboundingBoxERatePerTick = prevMY - prevY;

 

  if(this.temperature <= dewpoint) {

  this.rainProcess = true;

  if(droplesize <= 0) {

  droplesize = .0000000001;

  }

droplesize =  droplesize  * time;

 

  int gravity = 18000;

 

  if(droplesize > (gravity + (this.yboundingBoxERatePerTick ) * 2.8)) {

  double maxx = this.boundingBox.maxX;

  double minx = this.boundingBox.minX;

  double maxz = this.boundingBox.maxZ;

  double minz = this.boundingBox.minZ;

 

  for(int o = (int) minx; o < maxx; o++) {

  for(int p = (int) minz; p < maxz; p++) {

 

  Chunk C = worldObj.getChunkFromBlockCoords(o, p);

 

  this.precipitationCunkList.clear();

 

  this.precipitationCunkList.add©;

 

  }

  }

  }

  }

 

  double velocity = (this.motionX + this.motionY + this.motionZ )/3;

 

  if(velocity > block.getBlockHardness(worldObj, q, w, f)) {

 

  float hard1 = block.getBlockHardness(worldObj, q, w, f);

  block = new BlockFlyingBlock(block.getMaterial(), block, hard1);

     

    }

  if(this.humidity < e.humidity) {

  this.humidity = this.humidity + ((e.humidity - this.humidity)/50);

  }else if(this.humidity < bt.getBiomeTemp(worldObj, Biom)) {

  this.humidity = this.humidity + ((e.humidity - bt.getBiomeTemp(worldObj, Biom))/50);

  }

}

  }

  }

  }

}

    }

 

 

 

protected void entityInit() {

 

 

 

}

 

public List collidingAirmasses(EntityWeatherAirmass ewa) {

List list = this.collidingBoundingWeather;

list.clear();

  int i = MathHelper.floor_double(this.boundingBox.minX);

  int j = MathHelper.floor_double(this.boundingBox.maxX + 1.0D);

  int k = MathHelper.floor_double(this.boundingBox.minY);

  int l = MathHelper.floor_double(this.boundingBox.maxY + 1.0D);

  int i1 = MathHelper.floor_double(this.boundingBox.minZ);

  int j1 = MathHelper.floor_double(this.boundingBox.maxZ + 1.0D);

  double d0 = 0.25D;

 

  for(int q = i; q < j; q++) {

  for(int w = k; k < l; k++) {

  for(int f = i1; f < j1; f++) {

 

  Block block = worldObj.getBlock(q, w, f);

 

  List list2 = worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(d0, d0, d0));

 

  for (int j2 = 0; j2 < list2.size(); j2++)

  {

    Entity entity = ((Entity)list2.get(j2));

   

    if(entity instanceof EntityWeatherAirmass){

   

    list.add(entity);

    }

  }

}

  }

  }

  return list;

}

 

@Override

protected void readEntityFromNBT(NBTTagCompound arg0) {

// TODO Auto-generated method stub

 

}

 

@Override

protected void writeEntityToNBT(NBTTagCompound arg0) {

// TODO Auto-generated method stub

 

}

 

}

 

 

 

 

 

Thank You, and feel free to be critical.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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