Added jumping and sneaking when previewing a skin

This commit is contained in:
Sollace 2018-07-28 14:02:49 +02:00
parent 65c8220d7a
commit efc5d2932a
3 changed files with 32 additions and 2 deletions

View file

@ -110,6 +110,26 @@ public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSup
} }
swingProgress = swingProgressInt / 8F; swingProgress = swingProgressInt / 8F;
motionY *= 0.98;
if (Math.abs(motionY) < 0.003) {
motionY = 0;
}
if (posY == 0 && isJumping) {
jump();
}
motionY -= 0.08D;
motionY *= 0.9800000190734863D;
posY += motionY;
if (posY < 0) {
posY = 0;
}
onGround = posY == 0;
} }
@Override @Override

View file

@ -11,7 +11,6 @@ import com.minelittlepony.gui.Button;
import com.minelittlepony.gui.GameGui; import com.minelittlepony.gui.GameGui;
import com.minelittlepony.gui.IconicButton; import com.minelittlepony.gui.IconicButton;
import com.minelittlepony.gui.Label; import com.minelittlepony.gui.Label;
import com.minelittlepony.util.math.MathUtil;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
@ -394,6 +393,17 @@ public class GuiSkins extends GameGui {
@Override @Override
protected void drawContents(int mouseX, int mouseY, float partialTick) { protected void drawContents(int mouseX, int mouseY, float partialTick) {
boolean sneak = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
localPlayer.setSneaking(sneak);
remotePlayer.setSneaking(sneak);
boolean jump = Keyboard.isKeyDown(Keyboard.KEY_SPACE);
localPlayer.setJumping(jump);
remotePlayer.setJumping(jump);
float deltaTime = panorama.getDelta(partialTick); float deltaTime = panorama.getDelta(partialTick);
panorama.render(partialTick, zLevel); panorama.render(partialTick, zLevel);

View file

@ -104,7 +104,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
player.leftArmPose = ArmPose.EMPTY; player.leftArmPose = ArmPose.EMPTY;
player.rightArmPose = ArmPose.EMPTY; player.rightArmPose = ArmPose.EMPTY;
double offset = entity.getYOffset() + 0.01; double offset = entity.getYOffset() + entity.posY + 0.01;
pushMatrix(); pushMatrix();
enableBlend(); enableBlend();