mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed seaponies moving too quickly
This commit is contained in:
parent
873297ca44
commit
d3821f1c7c
2 changed files with 12 additions and 10 deletions
|
@ -591,11 +591,12 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
return Optional.of(speed.multiply(0.5, 1, 0.5));
|
||||
}
|
||||
if (getCompositeRace().includes(Race.SEAPONY)) {
|
||||
float factor = entity.isSwimming() ? 1.132F : 1.232F;
|
||||
float factor = entity.isSwimming() ? 1.132F : 1.0232F;
|
||||
float max = 0.6F;
|
||||
return Optional.of(new Vec3d(
|
||||
speed.x * factor,
|
||||
speed.y * 1.101,
|
||||
speed.z * factor
|
||||
MathHelper.clamp(speed.x * factor, -max, max),
|
||||
speed.y * ((speed.y * getPhysics().getGravitySignum()) > 0 ? 1.2 : 1.101),
|
||||
MathHelper.clamp(speed.z * factor, -max, max)
|
||||
));
|
||||
}
|
||||
return Optional.empty();
|
||||
|
@ -625,16 +626,16 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
|||
return false;
|
||||
}
|
||||
|
||||
public int getImplicitEnchantmentLevel(Enchantment enchantment) {
|
||||
public int getImplicitEnchantmentLevel(Enchantment enchantment, int initial) {
|
||||
|
||||
if ((enchantment == Enchantments.AQUA_AFFINITY
|
||||
|| enchantment == Enchantments.DEPTH_STRIDER
|
||||
|| enchantment == Enchantments.LUCK_OF_THE_SEA
|
||||
|| enchantment == Enchantments.LURE) && getCompositeRace().includes(Race.SEAPONY)) {
|
||||
return 3;
|
||||
return MathHelper.clamp(initial + 3, enchantment.getMinLevel(), enchantment.getMaxLevel());
|
||||
}
|
||||
|
||||
return 0;
|
||||
return initial;
|
||||
}
|
||||
|
||||
public Optional<Float> modifyDamage(DamageSource cause, float amount) {
|
||||
|
|
|
@ -16,9 +16,10 @@ abstract class MixinEnchantmentHelper {
|
|||
@Inject(method = "getEquipmentLevel", at = @At("RETURN"), cancellable = true)
|
||||
private static void getEquipmentLevel(Enchantment enchantment, LivingEntity entity, CallbackInfoReturnable<Integer> info) {
|
||||
Pony.of(entity).ifPresent(pony -> {
|
||||
int implicitLevel = pony.getImplicitEnchantmentLevel(enchantment);
|
||||
if (implicitLevel > 0) {
|
||||
info.setReturnValue(implicitLevel + info.getReturnValue());
|
||||
int initial = info.getReturnValue();
|
||||
int implicitLevel = pony.getImplicitEnchantmentLevel(enchantment, initial);
|
||||
if (implicitLevel != initial) {
|
||||
info.setReturnValue(implicitLevel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue