use of net.minecraft.entity.passive.LlamaEntity in project BleachHack by BleachDrinker420.
the class EntityControl method onTick.
@BleachSubscribe
public void onTick(EventTick event) {
if (mc.player.getVehicle() == null)
return;
Entity e = mc.player.getVehicle();
double speed = getSetting(0).asToggle().getChild(0).asSlider().getValue();
double forward = mc.player.forwardSpeed;
double strafe = mc.player.sidewaysSpeed;
float yaw = mc.player.getYaw();
e.setYaw(yaw);
if (e instanceof LlamaEntity) {
((LlamaEntity) e).headYaw = mc.player.headYaw;
}
if (getSetting(5).asToggle().getState() && forward == 0 && strafe == 0) {
e.setVelocity(new Vec3d(0, e.getVelocity().y, 0));
}
if (getSetting(0).asToggle().getState()) {
if (forward != 0.0D) {
if (strafe > 0.0D) {
yaw += (forward > 0.0D ? -45 : 45);
} else if (strafe < 0.0D) {
yaw += (forward > 0.0D ? 45 : -45);
}
if (forward > 0.0D) {
forward = 1.0D;
} else if (forward < 0.0D) {
forward = -1.0D;
}
strafe = 0.0D;
}
e.setVelocity(forward * speed * Math.cos(Math.toRadians(yaw + 90.0F)) + strafe * speed * Math.sin(Math.toRadians(yaw + 90.0F)), e.getVelocity().y, forward * speed * Math.sin(Math.toRadians(yaw + 90.0F)) - strafe * speed * Math.cos(Math.toRadians(yaw + 90.0F)));
}
if (getSetting(1).asToggle().getState()) {
if (mc.options.keyJump.isPressed()) {
e.setVelocity(e.getVelocity().x, getSetting(1).asToggle().getChild(0).asSlider().getValue(), e.getVelocity().z);
} else {
e.setVelocity(e.getVelocity().x, -getSetting(1).asToggle().getChild(1).asSlider().getValue(), e.getVelocity().z);
}
}
if (getSetting(3).asToggle().getState()) {
BlockPos p = new BlockPos(e.getPos());
if (!mc.world.getBlockState(p.down()).getMaterial().isReplaceable() && e.fallDistance > 0.01) {
e.setVelocity(e.getVelocity().x, -1, e.getVelocity().z);
}
}
if (getSetting(4).asToggle().getState()) {
Vec3d vel = e.getVelocity().multiply(2);
if (WorldUtils.doesBoxCollide(e.getBoundingBox().offset(vel.x, 0, vel.z))) {
for (int i = 2; i < 10; i++) {
if (!WorldUtils.doesBoxCollide(e.getBoundingBox().offset(vel.x / i, 0, vel.z / i))) {
e.setVelocity(vel.x / i / 2, vel.y, vel.z / i / 2);
break;
}
}
}
}
}
Aggregations