use of ValkyrienWarfareControl.Balloon.BalloonProcessor in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PhysicsCalculations method calculateForces.
public void calculateForces() {
double modifiedDrag = Math.pow(drag, physTickSpeed / .05D);
linearMomentum.multiply(modifiedDrag);
angularVelocity.multiply(modifiedDrag);
if (PhysicsSettings.doGravity) {
addForceAtPoint(new Vector(0, 0, 0), ValkyrienWarfareMod.gravity.getProduct(mass * physTickSpeed));
}
addQueuedForces();
Collections.shuffle(activeForcePositions);
Vector blockForce = new Vector();
Vector inBodyWO = new Vector();
Vector crossVector = new Vector();
if (PhysicsSettings.doPhysicsBlocks) {
for (BlockPos pos : activeForcePositions) {
IBlockState state = parent.VKChunkCache.getBlockState(pos);
Block blockAt = state.getBlock();
BigBastardMath.getBodyPosWithOrientation(pos, centerOfMass, parent.coordTransform.lToWRotation, inBodyWO);
BlockForce.basicForces.getForceFromState(state, pos, worldObj, physTickSpeed, parent, blockForce);
if (blockForce != null) {
if (blockAt instanceof IBlockForceProvider) {
Vector otherPosition = ((IBlockForceProvider) blockAt).getBlockForcePosition(worldObj, pos, state, parent.wrapper, physTickSpeed);
if (otherPosition != null) {
BigBastardMath.getBodyPosWithOrientation(otherPosition, centerOfMass, parent.coordTransform.lToWRotation, inBodyWO);
}
}
addForceAtPoint(inBodyWO, blockForce, crossVector);
} else {
}
}
}
if (PhysicsSettings.doBalloons) {
for (BalloonProcessor balloon : parent.balloonManager.balloonProcessors) {
balloon.tickBalloonTemperatures(physTickSpeed, this);
Vector balloonForce = balloon.getBalloonForce(physTickSpeed, this);
Vector balloonCenterInBody = balloon.getForceCenter();
BigBastardMath.getBodyPosWithOrientation(balloonCenterInBody, centerOfMass, parent.coordTransform.lToWRotation, inBodyWO);
addForceAtPoint(inBodyWO, balloonForce, crossVector);
}
}
convertTorqueToVelocity();
}
use of ValkyrienWarfareControl.Balloon.BalloonProcessor in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class BlockBalloonBurner method onBlockPlaced.
@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
PhysicsWrapperEntity wrapperEntity = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(worldIn, pos);
// Balloons can only be made on an active Ship
if (wrapperEntity != null) {
BlockPos balloonStart = pos.up(2);
if (!worldIn.isRemote) {
BalloonProcessor existingProcessor = wrapperEntity.wrapping.balloonManager.getProcessorAbovePos(pos);
if (existingProcessor == null) {
BalloonDetector detector = new BalloonDetector(balloonStart, worldIn, 25000);
int balloonSize = detector.foundSet.size();
if (balloonSize == 0) {
placer.addChatMessage(new TextComponentString("No balloon above"));
} else {
placer.addChatMessage(new TextComponentString("Created a new Balloon"));
BalloonProcessor processor = BalloonProcessor.makeProcessorForDetector(wrapperEntity, detector);
wrapperEntity.wrapping.balloonManager.addBalloonProcessor(processor);
// System.out.println("Balloon Walls Are " + detector.balloonWalls.size());
}
} else {
placer.addChatMessage(new TextComponentString("Hooked onto Exisiting Balloon"));
}
}
}
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer);
}
Aggregations