Added jumping and sneaking when previewing a skin

This commit is contained in:
Sollace 2018-07-28 14:02:49 +02:00
parent fe06800823
commit 9dbd80ca8e
4 changed files with 41 additions and 2 deletions

View file

@ -1,5 +1,7 @@
package com.voxelmodpack.hdskins.gui;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameType;
import net.minecraft.world.World;
@ -27,6 +29,11 @@ public class DummyWorld extends World {
return true;
}
@Override
public IBlockState getBlockState(BlockPos pos) {
return Blocks.AIR.getDefaultState();
}
@Override
public float getLightBrightness(BlockPos pos) {
return 1;

View file

@ -109,6 +109,28 @@ public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSup
}
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;
ticksExisted++;
}
@Override

View file

@ -11,7 +11,6 @@ import com.minelittlepony.gui.Button;
import com.minelittlepony.gui.GameGui;
import com.minelittlepony.gui.IconicButton;
import com.minelittlepony.gui.Label;
import com.minelittlepony.util.math.MathUtil;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
@ -394,6 +393,17 @@ public class GuiSkins extends GameGui {
@Override
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);
panorama.render(partialTick, zLevel);

View file

@ -106,7 +106,7 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
double offset = entity.getYOffset() + 0.01;
double offset = entity.getYOffset() + entity.posY + 0.01;
pushMatrix();
enableBlend();