Mo' Bends compatibility
This commit is contained in:
@ -10,6 +10,7 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
/*
|
||||
* This class handles calls to draw the PlayerDummy object (except not really.)
|
||||
@ -25,6 +26,8 @@ import net.minecraft.util.ResourceLocation;
|
||||
*/
|
||||
public class RenderPlayerDummy extends Render<EntityPlayerDummy>
|
||||
{
|
||||
// Объявляем lastLeftClickTime как поле класса
|
||||
private long lastLeftClickTime = 0; // В миллисекундах
|
||||
// Constructor
|
||||
public RenderPlayerDummy(RenderManager renderManager)
|
||||
{
|
||||
@ -109,6 +112,8 @@ public class RenderPlayerDummy extends Render<EntityPlayerDummy>
|
||||
*/
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
// Note: thirdPersonView can be: 0 = First Person, 1 = Third Person Rear, 2 = Third Person
|
||||
// If the player is NOT in first person, do nothing
|
||||
if (Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) return;
|
||||
@ -146,6 +151,39 @@ public class RenderPlayerDummy extends Render<EntityPlayerDummy>
|
||||
boolean isRealArmsEnabled = RFP2.state.isRealArmsEnabled(player);
|
||||
boolean isHeadRotationEnabled = RFP2.state.isHeadRotationEnabled(player);
|
||||
|
||||
playerModelOffset += -0.2f*(1-player.rotationPitch/90);
|
||||
|
||||
// Check if the player is sprinting
|
||||
if (player.isSprinting()) {
|
||||
// Increase playerModelOffset by 0.2 when sprinting
|
||||
playerModelOffset += 0.2f;
|
||||
}
|
||||
|
||||
// Check if the player is falling
|
||||
if (!player.onGround && player.motionY < -0.5f) { // Если игрок не на земле и движется вниз
|
||||
playerModelOffset += 0.4f; // Increase offset when falling
|
||||
}
|
||||
|
||||
// Check if the player is holding down the Shift key
|
||||
if (Minecraft.getMinecraft().gameSettings.keyBindSneak.isKeyDown()) {
|
||||
// Increase playerModelOffset by 0.2
|
||||
playerModelOffset += 0.75f;
|
||||
}
|
||||
|
||||
// Проверяем, была ли нажата ЛКМ
|
||||
if (Mouse.isButtonDown(0)) {
|
||||
lastLeftClickTime = System.currentTimeMillis(); // Сохраняем время нажатия
|
||||
}
|
||||
|
||||
// Проверяем, прошло ли 1 секунду с момента нажатия ЛКМ
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (lastLeftClickTime != 0 && (currentTime - lastLeftClickTime >= 400)) { // 1000 миллисекунд = 1 секунда
|
||||
playerModelOffset += 0.5f; // Увеличиваем смещение
|
||||
if (currentTime - lastLeftClickTime >= 2100 ) { // 1000 миллисекунд = 1 секунда
|
||||
lastLeftClickTime = 0;
|
||||
playerModelOffset -= 0.5f; }// Увеличиваем смещение
|
||||
}
|
||||
|
||||
/*
|
||||
* Adjust Player Model:
|
||||
* Strip unwanted items and layers from the player model to avoid obstructing the camera
|
||||
|
||||
Reference in New Issue
Block a user