use of arekkuusu.solar.common.entity.EntityLumen in project Solar by ArekkuusuJerii.
the class TilePholarizer method spit.
private void spit() {
EnumFacing facing = getFacingLazy();
BlockPos pos = getPos().offset(facing);
IBlockState state = world.getBlockState(pos);
facing = facing.getOpposite();
TileEntity tile;
if (state.getBlock().hasTileEntity(state) && (tile = world.getTileEntity(pos)).hasCapability(ModCapability.LUMEN_CAPABILITY, facing)) {
ILumen wrapper = tile.getCapability(ModCapability.LUMEN_CAPABILITY, facing);
if (wrapper.get() > 0) {
EntityLumen lumen = EntityLumen.spawn(world, new Vector3.WrappedVec3i(getPos()).asImmutable().add(0.5D), wrapper.drain(64));
Quat x = Quat.fromAxisAngle(Vector3.Forward(), (world.rand.nextFloat() * 2F - 1F) * 25F);
Quat z = Quat.fromAxisAngle(Vector3.Right(), (world.rand.nextFloat() * 2F - 1F) * 25F);
Vector3 vec = new Vector3.WrappedVec3i(getFacingLazy().getOpposite().getDirectionVec()).asImmutable().rotate(x.multiply(z)).multiply(0.1D);
lumen.motionX = vec.x();
lumen.motionY = vec.y();
lumen.motionZ = vec.z();
}
}
}
Aggregations