/** Called to update the entity's position/logic. */ public void onUpdate() { if (!this.worldObj.isRemote && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL && this.getSlimeSize() > 0) { this.isDead = true; } this.squishFactor += (this.squishAmount - this.squishFactor) * 0.5F; this.prevSquishFactor = this.squishFactor; boolean flag = this.onGround; super.onUpdate(); int i; if (this.onGround && !flag) { i = this.getSlimeSize(); for (int j = 0; j < i * 8; ++j) { float f = this.rand.nextFloat() * (float) Math.PI * 2.0F; float f1 = this.rand.nextFloat() * 0.5F + 0.5F; float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1; float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1; this.worldObj.spawnParticle( this.getSlimeParticle(), this.posX + (double) f2, this.boundingBox.minY, this.posZ + (double) f3, 0.0D, 0.0D, 0.0D); } if (this.makesSoundOnLand()) { this.playSound( this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F); } this.squishAmount = -0.5F; } else if (!this.onGround && flag) { this.squishAmount = 1.0F; } this.alterSquishAmount(); if (this.worldObj.isRemote) { i = this.getSlimeSize(); this.setSize(0.6F * (float) i, 0.6F * (float) i); } }
/** Called to update the entity's position/logic. */ public void onUpdate() { if (!this.worldObj.isClient && this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL && this.getSlimeSize() > 0) { this.isDead = true; } this.squishFactor += (this.squishAmount - this.squishFactor) * 0.5F; this.prevSquishFactor = this.squishFactor; boolean var1 = this.onGround; super.onUpdate(); int var2; if (this.onGround && !var1) { var2 = this.getSlimeSize(); for (int var3 = 0; var3 < var2 * 8; ++var3) { float var4 = this.rand.nextFloat() * (float) Math.PI * 2.0F; float var5 = this.rand.nextFloat() * 0.5F + 0.5F; float var6 = MathHelper.sin(var4) * (float) var2 * 0.5F * var5; float var7 = MathHelper.cos(var4) * (float) var2 * 0.5F * var5; this.worldObj.spawnParticle( this.getSlimeParticle(), this.posX + (double) var6, this.boundingBox.minY, this.posZ + (double) var7, 0.0D, 0.0D, 0.0D); } if (this.makesSoundOnLand()) { this.playSound( this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F); } this.squishAmount = -0.5F; } else if (!this.onGround && var1) { this.squishAmount = 1.0F; } this.alterSquishAmount(); if (this.worldObj.isClient) { var2 = this.getSlimeSize(); this.setSize(0.6F * (float) var2, 0.6F * (float) var2); } }
@Override public void onUpdate() { super.onUpdate(); if (ReikaMathLibrary.approxr(velocity.inclination, targetTheta, 2)) { targetTheta = rand.nextInt(360); } else { if (targetTheta > velocity.inclination) velocity.inclination++; else velocity.inclination--; } if (ReikaMathLibrary.approxr(velocity.rotation, targetPhi, 2)) { targetPhi = rand.nextInt(360); } else { if (targetPhi > velocity.rotation) velocity.rotation++; else velocity.rotation--; } if (ReikaMathLibrary.approxr(velocity.rotation, targetPhi, 0.05)) { targetVelocity = ReikaRandomHelper.getRandomPlusMinus(0.1, 0.1); } else { if (targetVelocity > velocity.magnitude) velocity.magnitude += 0.01D; else velocity.magnitude -= 0.01D; } velocityChanged = true; // ReikaJavaLibrary.pConsole(velocity.inclination+"/"+targetTheta+"; // "+velocity.rotation+"/"+targetPhi, Side.SERVER); double[] v = velocity.getCartesian(); motionX = v[0]; motionY = v[1]; motionZ = v[2]; if (targetColor != null) { colorTransitionFraction += 0.1F; if (colorTransitionFraction >= 1) { color = targetColor; targetColor = null; colorTransitionFraction = 0; } } dataWatcher.updateObject(30, this.calcRenderColor()); if (worldObj.isRemote) { this.lifeParticles(); } fallDistance = 0; }