use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class BlockShipPilotsChair method onBlockActivated.
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote) {
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(worldIn, pos);
if (wrapper != null) {
if (playerIn.getLowestRidingEntity() != wrapper.getLowestRidingEntity()) {
Vector playerPos = new Vector(playerIn);
wrapper.wrapping.coordTransform.fromLocalToGlobal(playerPos);
playerIn.posX = playerPos.X;
playerIn.posY = playerPos.Y;
playerIn.posZ = playerPos.Z;
playerIn.startRiding(wrapper);
Vector localMountPos = getPlayerMountOffset(state, pos);
wrapper.wrapping.fixEntity(playerIn, localMountPos);
wrapper.wrapping.pilotingController.setPilotEntity((EntityPlayerMP) playerIn, false);
wrapper.wrapping.coordTransform.fromGlobalToLocal(playerPos);
playerIn.posX = playerPos.X;
playerIn.posY = playerPos.Y;
playerIn.posZ = playerPos.Z;
return true;
}
}
}
return false;
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class RealMethods method getPositionInShipFromReal.
@Override
public Vector getPositionInShipFromReal(World worldObj, Entity shipEnt, Vector positionInWorld) {
PhysicsWrapperEntity wrapper = (PhysicsWrapperEntity) shipEnt;
Vector inLocal = new Vector(positionInWorld);
wrapper.wrapping.coordTransform.fromLocalToGlobal(inLocal);
return inLocal;
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class RealMethods method getVelocityAtPoint.
// Note, do not call this from World coordinates; first subtract the world coords from the shipEntity xyz and then call!
@Override
public Vector getVelocityAtPoint(Entity shipEnt, Vector inBody, double secondsToApply) {
PhysicsWrapperEntity wrapper = (PhysicsWrapperEntity) shipEnt;
Vector toReturn = wrapper.wrapping.physicsProcessor.getVelocityAtPoint(inBody);
toReturn.multiply(secondsToApply);
return toReturn;
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class CallRunner method onSetBlockState.
public static void onSetBlockState(IBlockState newState, int flags, World world, BlockPos pos) {
IBlockState oldState = world.getBlockState(pos);
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(world, pos);
if (wrapper != null) {
wrapper.wrapping.onSetBlockState(oldState, newState, pos);
}
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class CallRunnerClient method onRenderBlockLayer.
public static int onRenderBlockLayer(RenderGlobal renderer, BlockRenderLayer blockLayerIn, double partialTicks, int pass, Entity entityIn) {
for (PhysicsWrapperEntity wrapper : ValkyrienWarfareMod.physicsManager.getManagerForWorld(renderer.theWorld).physicsEntities) {
GL11.glPushMatrix();
if (wrapper.wrapping.renderer != null && wrapper.wrapping.renderer.shouldRender()) {
wrapper.wrapping.renderer.renderBlockLayer(blockLayerIn, partialTicks, pass);
}
GL11.glPopMatrix();
}
GlStateManager.resetColor();
return renderer.renderBlockLayer(blockLayerIn, partialTicks, pass, entityIn);
}
Aggregations