Помогите Настройка езды на Entity 1.12.2

Статус
Закрыто для дальнейших ответов.

JackWinston

Активный участник
Баллы
61
Имя в Minecraft
JackWinston
Помогите пожалуйста, сделал что-то типо Гравицикла, ставлю его и спавниться стенд невидимый с блоком на голове, на него можно садиться и прыгать тоже, но нельзя управлять клавишами WASD... =(
Что мне делать, я все методы перепробывал и все равно не фурычит, помогите пожалуйста!


@Override
public EnumInteractionResult a(EntityHuman player, Vec3D vec3d, EnumHand hand) {
if (passengers.isEmpty() && player.getVehicle() == player) {
player.startRiding(this);
return EnumInteractionResult.SUCCESS;
}
return EnumInteractionResult.FAIL;
}

@Override
public void a(float strafe, float vertical, float forward) {
Entity passenger = passengers.size() > 0 ? passengers.get(0) : null;
if (passenger instanceof EntityPlayer) {
EntityPlayer castedPassenger = (EntityPlayer) passenger;

/* Location update */
this.lastYaw = this.yaw = passenger.yaw;
this.pitch = passenger.pitch * 0.5F;
this.setYawPitch(this.yaw, this.pitch);
this.aP = this.aL = this.yaw;
strafe = castedPassenger.be * 0.5F;
forward = castedPassenger.bg;
if (forward <= 0.0F) {
forward *= 0.25F;
}

if (this.onGround && isJumping(castedPassenger)) {
this.motY = 0.5D;
}

this.P = 1.0F;
this.aR = this.cy() * 0.1F;

this.k(currentSpeed);
super.a(strafe, vertical, forward);

this.aF = this.aG;
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
if (f4 > 1.0F) {
f4 = 1.0F;
}

this.aG += (f4 - this.aG) * 0.4F;
this.aH += this.aG;
} else {
this.currentSpeed = 0F;
this.P = 0.5F;
this.aR = 0.02F;
super.a(strafe, vertical, forward);
}
}

public void setDurability(double value) {
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(value);
this.setHealth((float) value);
}

private static Field isJumping;

private boolean isJumping(Entity entity) {
try {
if (isJumping == null) {
isJumping = EntityLiving.class.getDeclaredField("bd");
}
isJumping.setAccessible(true);
return isJumping.getBoolean(entity);
} catch (NoSuchFieldException | IllegalAccessException ex) {
ex.printStackTrace();
return false;
}
}

}
 
Статус
Закрыто для дальнейших ответов.
Назад
Верх