mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +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));
|
return Optional.of(speed.multiply(0.5, 1, 0.5));
|
||||||
}
|
}
|
||||||
if (getCompositeRace().includes(Race.SEAPONY)) {
|
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(
|
return Optional.of(new Vec3d(
|
||||||
speed.x * factor,
|
MathHelper.clamp(speed.x * factor, -max, max),
|
||||||
speed.y * 1.101,
|
speed.y * ((speed.y * getPhysics().getGravitySignum()) > 0 ? 1.2 : 1.101),
|
||||||
speed.z * factor
|
MathHelper.clamp(speed.z * factor, -max, max)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
@ -625,16 +626,16 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getImplicitEnchantmentLevel(Enchantment enchantment) {
|
public int getImplicitEnchantmentLevel(Enchantment enchantment, int initial) {
|
||||||
|
|
||||||
if ((enchantment == Enchantments.AQUA_AFFINITY
|
if ((enchantment == Enchantments.AQUA_AFFINITY
|
||||||
|| enchantment == Enchantments.DEPTH_STRIDER
|
|| enchantment == Enchantments.DEPTH_STRIDER
|
||||||
|| enchantment == Enchantments.LUCK_OF_THE_SEA
|
|| enchantment == Enchantments.LUCK_OF_THE_SEA
|
||||||
|| enchantment == Enchantments.LURE) && getCompositeRace().includes(Race.SEAPONY)) {
|
|| 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) {
|
public Optional<Float> modifyDamage(DamageSource cause, float amount) {
|
||||||
|
|
|
@ -16,9 +16,10 @@ abstract class MixinEnchantmentHelper {
|
||||||
@Inject(method = "getEquipmentLevel", at = @At("RETURN"), cancellable = true)
|
@Inject(method = "getEquipmentLevel", at = @At("RETURN"), cancellable = true)
|
||||||
private static void getEquipmentLevel(Enchantment enchantment, LivingEntity entity, CallbackInfoReturnable<Integer> info) {
|
private static void getEquipmentLevel(Enchantment enchantment, LivingEntity entity, CallbackInfoReturnable<Integer> info) {
|
||||||
Pony.of(entity).ifPresent(pony -> {
|
Pony.of(entity).ifPresent(pony -> {
|
||||||
int implicitLevel = pony.getImplicitEnchantmentLevel(enchantment);
|
int initial = info.getReturnValue();
|
||||||
if (implicitLevel > 0) {
|
int implicitLevel = pony.getImplicitEnchantmentLevel(enchantment, initial);
|
||||||
info.setReturnValue(implicitLevel + info.getReturnValue());
|
if (implicitLevel != initial) {
|
||||||
|
info.setReturnValue(implicitLevel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue