Search in sources :

Example 96 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project ClaySoldiersMod by SanAndreasP.

the class EntityClayCam method resetCam.

// @Override
// public void updateCloak()
// {
// }
public static void resetCam() {
    Minecraft game = Minecraft.getMinecraft();
    if (CSMModRegistry.prevPlayer != null) {
        game.gameSettings.hideGUI = true;
        game.gameSettings.thirdPersonView = 0;
        if (CSMModRegistry.prevPlayer.isSneaking()) {
            CSMModRegistry.proxy.cameraReset(game);
        } else if (game.renderViewEntity instanceof EntityPlayerSP && !(game.renderViewEntity instanceof EntityClayCam)) {
            CSMModRegistry.prevPlayer = (EntityPlayerSP) game.renderViewEntity;
            CSMModRegistry.proxy.cameraReset(game);
        }
    }
}
Also used : EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft)

Example 97 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project DynamicSurroundings by OreCruncher.

the class EntityFootprintEffect method intitialize.

@Override
public void intitialize(@Nonnull final IEntityEffectHandlerState state) {
    super.intitialize(state);
    final EntityLivingBase entity = (EntityLivingBase) getState().subject().get();
    this.generator = ClientRegistry.FOOTSTEPS.createGenerator(entity);
    this.lastStyle = ModOptions.player.footprintStyle;
    if (entity instanceof EntityPlayerSP) {
        this.eventRegistered = true;
        MinecraftForge.EVENT_BUS.register(this);
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Example 98 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project Solar by ArekkuusuJerii.

the class Events method renderGhostAngstrom.

@SubscribeEvent
public static void renderGhostAngstrom(RenderWorldLastEvent event) {
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    ItemStack stack = player.getHeldItemMainhand();
    if (stack.isEmpty() || stack.getItem() != ModItems.ANGSTROM) {
        stack = player.getHeldItemOffhand();
    }
    if (!stack.isEmpty() && stack.getItem() == ModItems.ANGSTROM) {
        RayTraceResult result = RayTraceHelper.tracePlayerHighlight(player);
        if (result.typeOfHit != RayTraceResult.Type.BLOCK) {
            Vector3 vec = Vector3.apply(player.posX, player.posY + player.getEyeHeight(), player.posZ).add(new Vector3(player.getLookVec()).multiply(2.5D));
            BlockPos pos = new BlockPos(vec.toVec3d());
            IBlockState replaced = player.world.getBlockState(pos);
            if (player.world.isAirBlock(pos) || replaced.getBlock().isReplaceable(player.world, pos)) {
                RenderHelper.renderGhostBlock(pos, ModBlocks.ANGSTROM.getDefaultState());
            }
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) RayTraceResult(net.minecraft.util.math.RayTraceResult) Vector3(net.katsstuff.mirror.data.Vector3) BlockPos(net.minecraft.util.math.BlockPos) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) ItemStack(net.minecraft.item.ItemStack) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 99 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project EnderIO by SleepyTrousers.

the class EndermanSkullRenderer method getYaw.

float getYaw(TileEndermanSkull te, float partialTicks) {
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    double d = te.getPos().distanceSqToCenter(player.posX, player.posY, player.posZ);
    double speed = d < 3 * 3 ? 2.5 : d < 6 * 6 ? 1.5 : .5;
    float partialYaw = (float) (speed * partialTicks);
    Angle yaw = new Angle(360, te.getYaw());
    if (d < 10 * 10) {
        double d0 = player.posX - (te.getPos().getX() + 0.5F);
        double d1 = player.posZ - (te.getPos().getZ() + 0.5F);
        Angle target = new Angle(360, MathHelper.atan2(d1, d0) * 180.0 / Math.PI + 90);
        Angle diff = new Angle(180, yaw.get() - target.get());
        if (diff.get() > 1 || diff.get() < -1) {
            if (diff.get() > 0) {
                yaw.add(-Math.min(diff.get(), speed));
            } else {
                yaw.add(Math.min(-diff.get(), speed));
                partialYaw = -partialYaw;
            }
        } else {
            partialYaw = 0;
        }
    } else {
        yaw.add(1);
        partialYaw = partialTicks;
    }
    if (te.lastTick != EnderIO.proxy.getTickCount()) {
        te.lastTick = EnderIO.proxy.getTickCount();
        if (te.lookingAt > 0) {
            te.lookingAt--;
        }
        te.setYaw((float) yaw.get());
    }
    float ret = -te.getYaw() + partialYaw;
    if (te.lookingAt > 0) {
        float intensity = Math.min(3, te.lookingAt / 3.0f);
        ret += (((te.lastTick & 1) == 0) ? intensity : -intensity) * (partialTicks * 2);
    }
    return ret;
}
Also used : EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Example 100 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project EnderIO by SleepyTrousers.

the class TravelController method onClientTick.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientTick(@Nonnull TickEvent.ClientTickEvent event) {
    if (event.phase == TickEvent.Phase.END) {
        EntityPlayerSP player = Minecraft.getMinecraft().player;
        if (NullHelper.untrust(player) == null) {
            return;
        }
        if (player.isSpectator()) {
            showTargets = false;
            candidates.clear();
            return;
        }
        onBlockCoord = getActiveTravelBlock(player);
        boolean onBlock = onBlockCoord != null;
        showTargets = onBlock || isTravelItemActiveForSelecting(player);
        if (showTargets) {
            updateSelectedTarget(player);
        } else {
            selectedCoord = null;
        }
        MovementInput input = player.movementInput;
        tempJump = input.jump;
        tempSneak = input.sneak;
        // Handles teleportation if a target is selected
        if ((input.jump && !wasJumping && onBlock && selectedCoord != null && delayTimer == 0) || (input.sneak && !wasSneaking && onBlock && selectedCoord != null && delayTimer == 0 && Config.travelAnchorSneak)) {
            onInput(player);
            delayTimer = timer;
        }
        // If there is no selected coordinate and the input is jump, go up
        if (input.jump && !wasJumping && onBlock && selectedCoord == null && delayTimer == 0) {
            updateVerticalTarget(player, 1);
            onInput(player);
            delayTimer = timer;
        }
        // If there is no selected coordinate and the input is sneak, go down
        if (input.sneak && !wasSneaking && onBlock && selectedCoord == null && delayTimer == 0) {
            updateVerticalTarget(player, -1);
            onInput(player);
            delayTimer = timer;
        }
        if (delayTimer != 0) {
            delayTimer--;
        }
        wasJumping = tempJump;
        wasSneaking = tempSneak;
        candidates.clear();
    }
}
Also used : EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) MovementInput(net.minecraft.util.MovementInput) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)158 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)31 Minecraft (net.minecraft.client.Minecraft)29 ItemStack (net.minecraft.item.ItemStack)29 BlockPos (net.minecraft.util.math.BlockPos)27 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)23 Entity (net.minecraft.entity.Entity)21 EntityPlayer (net.minecraft.entity.player.EntityPlayer)13 TileEntity (net.minecraft.tileentity.TileEntity)13 WorldClient (net.minecraft.client.multiplayer.WorldClient)11 IBlockState (net.minecraft.block.state.IBlockState)10 Tessellator (net.minecraft.client.renderer.Tessellator)10 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)8 ArrayList (java.util.ArrayList)6 Block (net.minecraft.block.Block)6 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)6 Vec3d (net.minecraft.util.math.Vec3d)6 World (net.minecraft.world.World)6 UUID (java.util.UUID)5 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)5