public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; float adj = 0.08F * rand.nextFloat(); // this.motionX += adj * Math.sin(worldObj.getWorldTime()); // this.motionZ += adj * Math.sin(worldObj.getWorldTime()); // this.motionY += adj * Math.cos(worldObj.getWorldTime()); if (particleRed < 255) particleRed += 0.01F; if (particleGreen < 255) particleGreen += 0.01F; if (particleBlue < 255) particleBlue += 0.01F; if (this.particleAge++ >= this.particleMaxAge) { this.setDead(); } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); // this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); int id = this.worldObj.getBlockId( (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ)); // int id2 = this.worldObj.getBlockId((int)Math.floor(posX), (int)Math.floor(posY-1), // (int)Math.floor(posZ)); int meta = 0; if (id == 9 || id == 8) { Double dir = BlockFluid.getFlowDirection( worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), Material.water); if (dir != -1000) { // System.out.println("uhhhh: " + dir); float speed = 0.005F; this.motionX -= Math.sin(dir) * speed; this.motionZ += Math.cos(dir) * speed; } float range = 0.03F; this.motionX += (rand.nextFloat() * range) - (range / 2); // this.motionY += (rand.nextFloat() * range/2) - (range/4); this.motionZ += (rand.nextFloat() * range) - (range / 2); meta = this.worldObj.getBlockMetadata( (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ)); if ((meta & 8) != 0 /* && (id2 == 8 || id2 == 9)*/) { this.motionY -= 0.05000000074505806D * this.particleGravity; } else { // double remain = ((this.boundingBox.minY) - ((int)Math.floor(this.boundingBox.minY))); // System.out.println("remain: " + remain); // if (remain < 0.3D) { // this.handleWaterMovement(); // this.handleWaterMovement(); // if (remain <= 0.5D) { this.motionY += (0.05F * this.particleGravity * 0.2F); /* * (remain / 4);*/ // meta >= 4 && // } // } } } else { // setDead(); this.motionY -= 0.05000000074505806D * this.particleGravity * 1.5F; if (this.onGround) this.setDead(); } if (this.motionY > 0.03F) this.motionY = 0.03F; float var1 = 0.98F; this.motionX *= (double) var1; this.motionY *= (double) var1; this.motionZ *= (double) var1; this.moveEntity(this.motionX, this.motionY, this.motionZ); int meta2 = meta; if (meta2 > 9) meta2 = 9; float height = ((10 - meta2) * 0.1F); // System.out.println("adjusted height: " + height); if ((id == 9 || id == 8) && motionY > 0F && this.posY > ((int) Math.floor(this.posY)) + height) { // System.out.println("meta: " + meta); // this.posY = ((int)Math.floor(this.posY)) + height; // this.setPosition(posX, posY, posZ); this.motionY = -0.05F; } }