the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 55 lines 1.4 kB view raw
1#include "stdafx.h" 2#include "WaterDropParticle.h" 3#include "..\Minecraft.World\JavaMath.h" 4#include "..\Minecraft.World\net.minecraft.world.level.h" 5#include "..\Minecraft.World\net.minecraft.world.level.material.h" 6#include "..\Minecraft.World\net.minecraft.world.level.tile.h" 7 8WaterDropParticle::WaterDropParticle(Level *level, double x, double y, double z) : Particle(level, x, y, z, 0, 0, 0) 9{ 10 xd *= 0.3f; 11 yd = (float) Math::random() * 0.2f + 0.1f; 12 zd *= 0.3f; 13 14 rCol = 1.0f; 15 gCol = 1.0f; 16 bCol = 1.0f; 17 setMiscTex(16+3+random->nextInt(4)); 18 this->setSize(0.01f, 0.01f); 19 gravity = 0.06f; 20 21 noPhysics = true; // 4J - optimisation - do we really need collision on these? its really slow... 22 lifetime = (int) (8 / (Math::random() * 0.8 + 0.2)); 23} 24 25void WaterDropParticle::tick() 26{ 27 xo = x; 28 yo = y; 29 zo = z; 30 31 yd -= gravity; 32 move(xd, yd, zd); 33 xd *= 0.98f; 34 yd *= 0.98f; 35 zd *= 0.98f; 36 37 if (lifetime-- <= 0) remove(); 38 39 if (onGround) 40 { 41 if (Math::random() < 0.5) remove(); 42 xd *= 0.7f; 43 zd *= 0.7f; 44 } 45 46 Material *m = level->getMaterial(Mth::floor(x), Mth::floor(y), Mth::floor(z)); 47 if (m->isLiquid() || m->isSolid()) 48 { 49 double y0 = Mth::floor(y) + 1 - LiquidTile::getHeight(level->getData(Mth::floor(x), Mth::floor(y), Mth::floor(z))); 50 if (y < y0) 51 { 52 remove(); 53 } 54 } 55}