Load the elytra model

This commit is contained in:
Sollace 2019-11-27 14:09:53 +02:00
parent 7258f523cc
commit f4d1b0ab69
3 changed files with 14 additions and 5 deletions

View file

@ -51,6 +51,8 @@ public final class ModelType {
public static final ModelKey<ModelEnderStallion> ENDERMAN = register("enderman", ModelEnderStallion::new); public static final ModelKey<ModelEnderStallion> ENDERMAN = register("enderman", ModelEnderStallion::new);
public static final ModelKey<ModelBreezie<VexEntity>> BREEZIE = register("breezie", ModelBreezie::new); public static final ModelKey<ModelBreezie<VexEntity>> BREEZIE = register("breezie", ModelBreezie::new);
public static final ModelKey<PonyElytra<?>> ELYTRA = register("elytra", PonyElytra::new);
public static final ModelKey<ModelPonyArmour<?>> ARMOUR_INNER = register("armour_inner", ModelPonyArmour::new); public static final ModelKey<ModelPonyArmour<?>> ARMOUR_INNER = register("armour_inner", ModelPonyArmour::new);
public static final ModelKey<ModelPonyArmour<?>> ARMOUR_OUTER = register("armour_outer", ModelPonyArmour::new); public static final ModelKey<ModelPonyArmour<?>> ARMOUR_OUTER = register("armour_outer", ModelPonyArmour::new);

View file

@ -7,19 +7,27 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.mson.api.MsonModel;
import static com.minelittlepony.model.PonyModelConstants.*; import static com.minelittlepony.model.PonyModelConstants.*;
/** /**
* Modified from ModelElytra. * Modified from ModelElytra.
*/ */
public class PonyElytra<T extends LivingEntity> extends AnimalModel<T> { public class PonyElytra<T extends LivingEntity> extends AnimalModel<T> implements MsonModel {
public boolean isSneaking; public boolean isSneaking;
private ModelPart rightWing; private ModelPart rightWing;
private ModelPart leftWing; private ModelPart leftWing;
@Override
public void init(ModelContext context) {
rightWing = context.findByName("right_wing");
leftWing = context.findByName("left_wing");
}
@Override @Override
protected Iterable<ModelPart> getHeadParts() { protected Iterable<ModelPart> getHeadParts() {
return ImmutableList.of(); return ImmutableList.of();

View file

@ -1,10 +1,10 @@
package com.minelittlepony.client.render.entity.feature; package com.minelittlepony.client.render.entity.feature;
import com.minelittlepony.client.model.IPonyModel; import com.minelittlepony.client.model.IPonyModel;
import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.PonyElytra; import com.minelittlepony.client.model.PonyElytra;
import com.minelittlepony.client.render.IPonyRender; import com.minelittlepony.client.render.IPonyRender;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.mojang.blaze3d.platform.GlStateManager;
import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.OverlayTexture;
@ -24,7 +24,8 @@ public class LayerPonyElytra<T extends LivingEntity, M extends EntityModel<T> &
private static final Identifier TEXTURE_ELYTRA = new Identifier("textures/entity/elytra.png"); private static final Identifier TEXTURE_ELYTRA = new Identifier("textures/entity/elytra.png");
private final PonyElytra<T> modelElytra = new PonyElytra<>(); @SuppressWarnings("unchecked")
private final PonyElytra<T> modelElytra = (PonyElytra<T>)ModelType.ELYTRA.createModel();
public LayerPonyElytra(IPonyRender<T, M> rp) { public LayerPonyElytra(IPonyRender<T, M> rp) {
super(rp); super(rp);
@ -35,8 +36,6 @@ public class LayerPonyElytra<T extends LivingEntity, M extends EntityModel<T> &
ItemStack itemstack = entity.getEquippedStack(EquipmentSlot.CHEST); ItemStack itemstack = entity.getEquippedStack(EquipmentSlot.CHEST);
if (itemstack.getItem() == Items.ELYTRA) { if (itemstack.getItem() == Items.ELYTRA) {
GlStateManager.color4f(1, 1, 1, 1);
stack.push(); stack.push();
preRenderCallback(stack); preRenderCallback(stack);