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);
}
}
}
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);
}
}
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());
}
}
}
}
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;
}
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();
}
}
Aggregations