public static void onTextureStitchedPost(TextureMap map) { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map)); FluidRegistry.WATER.setIcons( BlockFluid.func_94424_b("water_still"), BlockFluid.func_94424_b("water_flow")); FluidRegistry.LAVA.setIcons( BlockFluid.func_94424_b("lava_still"), BlockFluid.func_94424_b("lava_flow")); }
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; } }
/** Called to update the entity's position/logic. */ @Override public void onUpdate() { this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; if (this.materialType == GCMarsBlocks.bacterialSludge) { this.particleRed = 0.1F; this.particleGreen = 0.1F; this.particleBlue = 0.1F; } else { this.particleRed = 1.0F; this.particleGreen = 16.0F / (40 - this.bobTimer + 16); this.particleBlue = 4.0F / (40 - this.bobTimer + 8); } this.motionY -= this.particleGravity; if (this.bobTimer-- > 0) { this.motionX *= 0.02D; this.motionY *= 0.02D; this.motionZ *= 0.02D; this.setParticleTextureIndex(113); } else { this.setParticleTextureIndex(112); } this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; if (this.particleMaxAge-- <= 0) { this.setDead(); } if (this.onGround) { if (this.materialType == Material.water) { this.setDead(); this.worldObj.spawnParticle("splash", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } else { this.setParticleTextureIndex(114); } this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; } final Material var1 = this.worldObj.getBlockMaterial( MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); if (var1.isLiquid() || var1.isSolid()) { final double var2 = MathHelper.floor_double(this.posY) + 1 - BlockFluid.getFluidHeightPercent( this.worldObj.getBlockMetadata( MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))); if (this.posY < var2) { this.setDead(); } } }