mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Hook into MineLP to fix rotation whilst flying
This commit is contained in:
parent
163afc9047
commit
63e61826e8
4 changed files with 39 additions and 0 deletions
|
@ -0,0 +1,28 @@
|
|||
package com.minelittlepony.unicopia.client.minelittlepony;
|
||||
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.capabilities.fabric.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
public class Main implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
PonyModelPrepareCallback.EVENT.register(this::onPonyModelPrepared);
|
||||
}
|
||||
|
||||
private void onPonyModelPrepared(Entity entity, IModel model, EquineRenderManager.Mode mode) {
|
||||
if (entity instanceof PlayerEntity) {
|
||||
Pony pony = Pony.of((PlayerEntity)entity);
|
||||
|
||||
model.getAttributes().isSwimming |= pony.getMotion().isFlying();
|
||||
//model.getAttributes().isSwimmingRotated |= pony.getMotion().isFlying();
|
||||
model.getAttributes().isGoingFast |= pony.getMotion().isRainbooming();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,6 +11,8 @@ public interface Motion {
|
|||
|
||||
boolean isGliding();
|
||||
|
||||
boolean isRainbooming();
|
||||
|
||||
float getWingAngle();
|
||||
|
||||
PlayerDimensions getDimensions();
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.minelittlepony.unicopia.FlightType;
|
|||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.USounds;
|
||||
import com.minelittlepony.unicopia.ability.magic.Spell;
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.JoustingSpell;
|
||||
import com.minelittlepony.unicopia.entity.Creature;
|
||||
import com.minelittlepony.unicopia.entity.EntityPhysics;
|
||||
import com.minelittlepony.unicopia.entity.Jumper;
|
||||
|
@ -73,6 +74,11 @@ public class PlayerPhysics extends EntityPhysics<Pony> implements Tickable, Moti
|
|||
return isFlying() && (pony.getMaster().isSneaking() || ((Jumper)pony.getMaster()).isJumping()) && !pony.sneakingChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRainbooming() {
|
||||
return pony.getSpellOrEmpty(JoustingSpell.class).isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWingAngle() {
|
||||
float spreadAmount = -0.5F;
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
],
|
||||
"modmenu": [
|
||||
"com.minelittlepony.unicopia.modmenu.UMenuFactory"
|
||||
],
|
||||
"minelittlepony": [
|
||||
"com.minelittlepony.unicopia.client.minelittlepony.Main"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
|
|
Loading…
Reference in a new issue