mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Rotate ponies wings to match when the player flaps their wings
This commit is contained in:
parent
fd65f1b9e1
commit
f0e43cdbe7
5 changed files with 21 additions and 8 deletions
|
@ -18,5 +18,5 @@ org.gradle.daemon=false
|
|||
|
||||
# Dependencies
|
||||
modmenu_version=1.14.+
|
||||
minelp_version=4.2.1-1.16.5
|
||||
minelp_version=4.2.2-1.16.5-1.16-SNAPSHOT
|
||||
kirin_version=1.7.1-1.16.2-SNAPSHOT
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.minelittlepony.unicopia.Race;
|
|||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.client.gui.SettingsScreen;
|
||||
import com.minelittlepony.unicopia.client.gui.UHud;
|
||||
import com.minelittlepony.unicopia.client.minelittlepony.MineLPConnector;
|
||||
import com.minelittlepony.unicopia.entity.player.PlayerCamera;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
|
|
|
@ -19,7 +19,7 @@ import com.minelittlepony.unicopia.Config;
|
|||
import com.minelittlepony.unicopia.Race;
|
||||
import com.minelittlepony.unicopia.Unicopia;
|
||||
import com.minelittlepony.unicopia.WorldTribeManager;
|
||||
import com.minelittlepony.unicopia.client.MineLPConnector;
|
||||
import com.minelittlepony.unicopia.client.minelittlepony.MineLPConnector;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
|
|
@ -3,26 +3,38 @@ 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.Unicopia;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class Main implements ClientModInitializer {
|
||||
|
||||
private boolean hookErroring;
|
||||
|
||||
@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);
|
||||
if (hookErroring) return;
|
||||
try {
|
||||
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();
|
||||
if (pony.getMotion().isFlying()) {
|
||||
model.getAttributes().wingAngle = MathHelper.clamp(pony.getMotion().getWingAngle() / 3 - (float)Math.PI * 0.7F, -3, 0);
|
||||
model.getAttributes().isHorizontal = true;
|
||||
}
|
||||
model.getAttributes().isGoingFast |= pony.getMotion().isRainbooming();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
Unicopia.LOGGER.error("Exception occured in MineLP hook:onPonyModelPrepared", t);
|
||||
hookErroring = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.unicopia.client;
|
||||
package com.minelittlepony.unicopia.client.minelittlepony;
|
||||
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.unicopia.Race;
|
Loading…
Reference in a new issue