use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class BalloonBurnerTileEntity method getBlockForcePosition.
public Vector getBlockForcePosition(World world, BlockPos pos, IBlockState state, Entity shipEntity, double secondsToApply) {
if (balloon == null) {
PhysicsWrapperEntity wrapper = (PhysicsWrapperEntity) shipEntity;
balloon = wrapper.wrapping.balloonManager.getProcessorAbovePos(pos);
}
if (balloon != null) {
return balloon.currentBalloonCenter;
}
return null;
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ValkyrienWarfareWorldEventListener method onEntityAdded.
@Override
public void onEntityAdded(Entity entityIn) {
int oldChunkX = MathHelper.floor_double(entityIn.posX / 16.0D);
int oldChunkZ = MathHelper.floor_double(entityIn.posZ / 16.0D);
BlockPos posAt = new BlockPos(entityIn);
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(worldObj, posAt);
if (!(entityIn instanceof EntityFallingBlock) && wrapper != null && wrapper.wrapping.coordTransform != null) {
if (entityIn instanceof EntityMountingWeaponBase || entityIn instanceof EntityArmorStand || entityIn instanceof EntityPig || entityIn instanceof EntityBoat) {
// entity.startRiding(wrapper);
wrapper.wrapping.fixEntity(entityIn, new Vector(entityIn));
wrapper.wrapping.queueEntityForMounting(entityIn);
}
RotationMatrices.applyTransform(wrapper.wrapping.coordTransform.lToWTransform, wrapper.wrapping.coordTransform.lToWRotation, entityIn);
int newChunkX = MathHelper.floor_double(entityIn.posX / 16.0D);
int newChunkZ = MathHelper.floor_double(entityIn.posZ / 16.0D);
worldObj.getChunkFromChunkCoords(oldChunkX, oldChunkZ).removeEntity(entityIn);
worldObj.getChunkFromChunkCoords(newChunkX, newChunkZ).addEntity(entityIn);
}
if (entityIn instanceof PhysicsWrapperEntity) {
ValkyrienWarfareMod.physicsManager.onShipLoad((PhysicsWrapperEntity) entityIn);
}
if (entityIn.getEntityWorld().isRemote) {
PhysicsWrapperEntity shipFixOnto = ValkyrienWarfareMod.physicsManager.getManagerForWorld(entityIn.worldObj).getShipFixedOnto(entityIn, true);
if (shipFixOnto != null) {
// System.out.println("Ye");
entityIn.startRiding(shipFixOnto, true);
}
}
}
use of ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class PhysWrapperPositionHandler method onMessage.
@Override
public IMessage onMessage(final PhysWrapperPositionMessage message, MessageContext ctx) {
if (Minecraft.getMinecraft().thePlayer == null) {
return null;
}
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
Entity ent = Minecraft.getMinecraft().theWorld.getEntityByID(message.entityID);
if (ent != null && ent instanceof PhysicsWrapperEntity) {
PhysicsWrapperEntity wrapper = (PhysicsWrapperEntity) ent;
wrapper.wrapping.coordTransform.stack.pushMessage(message);
// wrapper.wrapping.centerCoord = message.centerOfMass;
//
// wrapper.posX = message.posX;
// wrapper.posY = message.posY;
// wrapper.posZ = message.posZ;
//
// wrapper.pitch = message.pitch;
// wrapper.yaw = message.yaw;
// wrapper.roll = message.roll;
//
// wrapper.wrapping.coordTransform.updateAllTransforms();
}
}
});
return null;
}
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