Search in sources :

Example 36 with PhysicsWrapperEntity

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;
}
Also used : PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)

Example 37 with PhysicsWrapperEntity

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);
        }
    }
}
Also used : EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) EntityPig(net.minecraft.entity.passive.EntityPig) EntityBoat(net.minecraft.entity.item.EntityBoat) BlockPos(net.minecraft.util.math.BlockPos) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) Vector(ValkyrienWarfareBase.API.Vector) EntityMountingWeaponBase(ValkyrienWarfareCombat.Entity.EntityMountingWeaponBase)

Example 38 with PhysicsWrapperEntity

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;
}
Also used : Entity(net.minecraft.entity.Entity) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) IThreadListener(net.minecraft.util.IThreadListener)

Example 39 with PhysicsWrapperEntity

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);
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)

Example 40 with PhysicsWrapperEntity

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);
}
Also used : PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)

Aggregations

PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)69 BlockPos (net.minecraft.util.math.BlockPos)29 Vector (ValkyrienWarfareBase.API.Vector)28 EntityPlayer (net.minecraft.entity.player.EntityPlayer)10 IBlockState (net.minecraft.block.state.IBlockState)9 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)9 TextComponentString (net.minecraft.util.text.TextComponentString)9 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)8 Vec3d (net.minecraft.util.math.Vec3d)7 WorldPhysObjectManager (ValkyrienWarfareBase.PhysicsManagement.WorldPhysObjectManager)6 Block (net.minecraft.block.Block)6 Entity (net.minecraft.entity.Entity)6 TileEntity (net.minecraft.tileentity.TileEntity)6 IThreadListener (net.minecraft.util.IThreadListener)5 World (net.minecraft.world.World)5 Quaternion (ValkyrienWarfareBase.Math.Quaternion)4 ArrayList (java.util.ArrayList)4 RayTraceResult (net.minecraft.util.math.RayTraceResult)4 EntityPolygon (ValkyrienWarfareBase.Collision.EntityPolygon)3 Polygon (ValkyrienWarfareBase.Collision.Polygon)3