net.minecraft.client.entity.player.ClientPlayerEntity Java Examples
The following examples show how to use
net.minecraft.client.entity.player.ClientPlayerEntity.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LivingUpdate.java From Better-Sprinting with Mozilla Public License 2.0 | 6 votes |
public static void injectMovementInputUpdate(ClientPlayerEntity player, boolean slowMovement){ hasTriggered = true; isModDisabled = ClientModManager.isModDisabled(); // this.movementInput.func_225607_a_(this.func_228354_I_()); <<< REPLACE if (isModDisabled){ if (currentHandler != null){ currentHandler.resetState(); currentHandler = null; } player.movementInput.func_225607_a_(slowMovement); return; } if (currentHandler == null || currentHandler.getPlayer() != player){ currentHandler = new PlayerLogicHandler(player); } currentHandler.updateMovementInput(slowMovement); }
Example #2
Source File: RenderMiningLaser.java From MiningGadgets with MIT License | 5 votes |
private static void drawBeam(double xOffset, double yOffset, double zOffset, float thickness, Hand hand, double distance, BufferBuilder wr, double v1, double v2, float ticks) { ClientPlayerEntity player = Minecraft.getInstance().player; float startXOffset = -0.25f; float startYOffset = -.115f; float startZOffset = 0.65f + (1 - player.getFovModifier()); float f = (MathHelper.lerp(ticks, player.prevRotationPitch, player.rotationPitch) - MathHelper.lerp(ticks, player.prevRenderArmPitch, player.renderArmPitch)); float f1 = (MathHelper.lerp(ticks, player.prevRotationYaw, player.rotationYaw) - MathHelper.lerp(ticks, player.prevRenderArmYaw, player.renderArmYaw)); startXOffset = startXOffset + (f1 / 1000); startYOffset = startYOffset + (f / 1000); // Support for hand sides remembering to take into account of Skin options if( Minecraft.getInstance().gameSettings.mainHand != HandSide.RIGHT ) hand = hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND; wr.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX); if (hand == Hand.MAIN_HAND) { wr.pos(startXOffset, -thickness + startYOffset, startZOffset).tex(1, (float) v1).endVertex(); wr.pos(xOffset, -thickness + yOffset, distance + zOffset).tex(1, (float) v2).endVertex(); wr.pos(xOffset, thickness + yOffset, distance + zOffset).tex(0, (float) v2).endVertex(); wr.pos(startXOffset, thickness + startYOffset, startZOffset).tex(0, (float) v1).endVertex(); } else { startYOffset = -.120f; wr.pos(-startXOffset, thickness + startYOffset, startZOffset).tex(0, (float) v1).endVertex(); wr.pos(xOffset, thickness + yOffset, distance + zOffset).tex(0, (float) v2).endVertex(); wr.pos(xOffset, -thickness + yOffset, distance + zOffset).tex(1, (float) v2).endVertex(); wr.pos(-startXOffset, -thickness + startYOffset, startZOffset).tex(1, (float) v1).endVertex(); } Tessellator.getInstance().draw(); }
Example #3
Source File: PlayerLogicHandler.java From Better-Sprinting with Mozilla Public License 2.0 | 5 votes |
public PlayerLogicHandler(ClientPlayerEntity player){ this.player = player; this.abilities = player.abilities; this.movementInput = player.movementInput; this.movementController = new MovementController(movementInput); this.sprinting = player.isSprinting() ? DOUBLE_TAPPED_FORWARD : INACTIVE; }
Example #4
Source File: RenderMiningLaser2.java From MiningGadgets with MIT License | 4 votes |
private static void drawBeam(double xOffset, double yOffset, double zOffset, IVertexBuilder builder, Matrix4f positionMatrix, Matrix3f matrixNormalIn, float thickness, Hand hand, double distance, double v1, double v2, float ticks, float r, float g, float b, float alpha) { Vector3f vector3f = new Vector3f(0.0f, 1.0f, 0.0f); vector3f.transform(matrixNormalIn); ClientPlayerEntity player = Minecraft.getInstance().player; // Support for hand sides remembering to take into account of Skin options if( Minecraft.getInstance().gameSettings.mainHand != HandSide.RIGHT ) hand = hand == Hand.MAIN_HAND ? Hand.OFF_HAND : Hand.MAIN_HAND; float startXOffset = -0.25f; float startYOffset = -.115f; float startZOffset = 0.65f + (1 - player.getFovModifier()); if (hand == Hand.OFF_HAND) { startYOffset = -.120f; startXOffset = 0.25f; } float f = (MathHelper.lerp(ticks, player.prevRotationPitch, player.rotationPitch) - MathHelper.lerp(ticks, player.prevRenderArmPitch, player.renderArmPitch)); float f1 = (MathHelper.lerp(ticks, player.prevRotationYaw, player.rotationYaw) - MathHelper.lerp(ticks, player.prevRenderArmYaw, player.renderArmYaw)); startXOffset = startXOffset + (f1 / 100000000); startYOffset = startYOffset + (f / 100000000); Vector4f vec1 = new Vector4f(startXOffset, -thickness + startYOffset, startZOffset, 1.0F); vec1.transform(positionMatrix); Vector4f vec2 = new Vector4f((float) xOffset, -thickness + (float) yOffset, (float) distance + (float) zOffset, 1.0F); vec2.transform(positionMatrix); Vector4f vec3 = new Vector4f((float) xOffset, thickness + (float) yOffset, (float) distance + (float) zOffset, 1.0F); vec3.transform(positionMatrix); Vector4f vec4 = new Vector4f(startXOffset, thickness + startYOffset, startZOffset, 1.0F); vec4.transform(positionMatrix); if (hand == Hand.MAIN_HAND) { builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); //Rendering a 2nd time to allow you to see both sides in multiplayer, shouldn't be necessary with culling disabled but here we are.... builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); } else { builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); //Rendering a 2nd time to allow you to see both sides in multiplayer, shouldn't be necessary with culling disabled but here we are.... builder.addVertex(vec4.getX(), vec4.getY(), vec4.getZ(), r, g, b, alpha, 0, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec3.getX(), vec3.getY(), vec3.getZ(), r, g, b, alpha, 0, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec2.getX(), vec2.getY(), vec2.getZ(), r, g, b, alpha, 1, (float) v2, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); builder.addVertex(vec1.getX(), vec1.getY(), vec1.getZ(), r, g, b, alpha, 1, (float) v1, OverlayTexture.NO_OVERLAY, 15728880, vector3f.getX(), vector3f.getY(), vector3f.getZ()); } }
Example #5
Source File: PlayerLogicHandler.java From Better-Sprinting with Mozilla Public License 2.0 | 4 votes |
public ClientPlayerEntity getPlayer(){ return player; }
Example #6
Source File: ClientInterop.java From BoundingBoxOutlineReloaded with MIT License | 4 votes |
public static void render(float partialTicks, ClientPlayerEntity player) { Player.setPosition(partialTicks, player); ClientRenderer.render(DimensionId.from(player.dimension)); }
Example #7
Source File: Player.java From BoundingBoxOutlineReloaded with MIT License | 4 votes |
public static void setPosition(double partialTicks, ClientPlayerEntity player) { x = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks; y = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks; z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks; dimensionId = DimensionId.from(player.dimension); }