mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Villagers can now be bats
This commit is contained in:
parent
531f0f8d54
commit
87bdbcb904
28 changed files with 227 additions and 181 deletions
|
@ -2,6 +2,7 @@ package com.minelittlepony.client.model;
|
|||
|
||||
import com.minelittlepony.client.model.armour.ModelPonyArmour;
|
||||
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
||||
import com.minelittlepony.client.model.components.PonyEars;
|
||||
import com.minelittlepony.client.model.components.PonySnout;
|
||||
import com.minelittlepony.client.model.components.PonyTail;
|
||||
import com.minelittlepony.client.transform.PonyTransformation;
|
||||
|
@ -33,6 +34,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
|
||||
protected IPart tail;
|
||||
protected PonySnout snout;
|
||||
protected IPart ears;
|
||||
|
||||
public AbstractPonyModel(boolean arms) {
|
||||
super(0, arms);
|
||||
|
@ -569,8 +571,8 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
}
|
||||
|
||||
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
||||
head.tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch) // right ear
|
||||
.flip().box( 2, -6, 1, 2, 2, 2, stretch); // left ear
|
||||
ears = new PonyEars(head, false);
|
||||
ears.init(yOffset, stretch);
|
||||
}
|
||||
|
||||
protected void initTail(float yOffset, float stretch) {
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
|
||||
/**
|
||||
* Common class for all humanoid (ponioid?) non-player enemies.
|
||||
*
|
||||
* Common interface for all undead enemies.
|
||||
*/
|
||||
public abstract class ModelMobPony<T extends LivingEntity> extends ModelAlicorn<T> {
|
||||
|
||||
public ModelMobPony() {
|
||||
super(false);
|
||||
}
|
||||
public interface IMobModel {
|
||||
|
||||
/**
|
||||
* Rotates the provided arm to the correct orientation for holding an item.
|
||||
|
@ -24,9 +18,9 @@ public abstract class ModelMobPony<T extends LivingEntity> extends ModelAlicorn<
|
|||
* @param swingProgress How far we are through the current swing
|
||||
* @param ticks Render partial ticks
|
||||
*/
|
||||
protected void rotateArmHolding(Cuboid arm, float direction, float swingProgress, float ticks) {
|
||||
float swing = MathHelper.sin(swingProgress * PI);
|
||||
float roll = MathHelper.sin((1 - (1 - swingProgress) * (1 - swingProgress)) * PI);
|
||||
default void rotateArmHolding(Cuboid arm, float direction, float swingProgress, float ticks) {
|
||||
float swing = MathHelper.sin(swingProgress * PonyModelConstants.PI);
|
||||
float roll = MathHelper.sin((1 - (1 - swingProgress) * (1 - swingProgress)) * PonyModelConstants.PI);
|
||||
|
||||
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
|
||||
float sin = MathHelper.sin(ticks * 0.067F) / 10;
|
|
@ -0,0 +1,51 @@
|
|||
package com.minelittlepony.client.model.components;
|
||||
|
||||
import net.minecraft.client.model.Cuboid;
|
||||
import net.minecraft.client.model.Model;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IPart;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class PonyEars implements IPart {
|
||||
|
||||
private final PonyRenderer head;
|
||||
private final boolean bat;
|
||||
|
||||
private PonyRenderer right;
|
||||
private PonyRenderer left;
|
||||
|
||||
public <T extends Model & ICapitated<Cuboid>> PonyEars(PonyRenderer head, boolean bat) {
|
||||
this.head = head;
|
||||
this.bat = bat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
right = head.child().tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch);
|
||||
|
||||
if (bat) {
|
||||
right.tex(0, 3).box(-3.5F, -6.49F, 1.001F, 1, 1, 1, stretch)
|
||||
.tex(0, 5).box(-2.998F, -6.49F, 2.001F, 1, 1, 1, stretch);
|
||||
}
|
||||
|
||||
left = head.child().flip().tex(12, 16).box( 2, -6, 1, 2, 2, 2, stretch);
|
||||
|
||||
if (bat) {
|
||||
left.tex(0, 3).box( 2.5F, -6.49F, 1.001F, 1, 1, 1, stretch)
|
||||
.tex(0, 5).box( 1.998F, -6.49F, 2.001F, 1, 1, 1, stretch);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderPart(float scale, UUID interpolatorId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
right.visible = visible;
|
||||
left.visible = visible;
|
||||
}
|
||||
}
|
|
@ -6,11 +6,12 @@ import net.minecraft.client.model.Model;
|
|||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.pony.meta.Gender;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PonySnout {
|
||||
public class PonySnout implements IPart {
|
||||
|
||||
public boolean isHidden = false;
|
||||
|
||||
|
@ -38,6 +39,7 @@ public class PonySnout {
|
|||
stallion.rotate(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
mare.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.tex(10, 14).south(-2, 2, -5, 4, 2, stretch)
|
||||
|
@ -58,6 +60,10 @@ public class PonySnout {
|
|||
.tex(13, 13) .east( 2, 1, -5, 3, 1, stretch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderPart(float scale, UUID interpolatorId) {
|
||||
}
|
||||
|
||||
public void setGender(Gender gender) {
|
||||
boolean show = !head.hasHeadGear() && !isHidden && MineLittlePony.getInstance().getConfig().snuzzles.get();
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void rotateArmHolding(Cuboid arm, float direction, float swingProgress, float ticks) {
|
||||
public void rotateArmHolding(Cuboid arm, float direction, float swingProgress, float ticks) {
|
||||
arm.pitch = -0.3707964F;
|
||||
arm.pitch += 0.4F + MathHelper.sin(ticks * 0.067F) / 10;
|
||||
}
|
||||
|
|
|
@ -5,9 +5,13 @@ import net.minecraft.entity.mob.IllagerEntity;
|
|||
import net.minecraft.util.Arm;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.ModelMobPony;
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
|
||||
public class ModelIllagerPony<T extends IllagerEntity> extends ModelMobPony<T> {
|
||||
public class ModelIllagerPony<T extends IllagerEntity> extends ModelAlicorn<T> {
|
||||
|
||||
public ModelIllagerPony() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAngles(T illager, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
|
|
|
@ -7,16 +7,17 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Arm;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
import com.minelittlepony.client.model.ModelMobPony;
|
||||
import com.minelittlepony.client.model.IMobModel;
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
|
||||
public class ModelSkeletonPony<T extends HostileEntity> extends ModelMobPony<T> {
|
||||
public class ModelSkeletonPony<T extends HostileEntity> extends ModelAlicorn<T> implements IMobModel {
|
||||
|
||||
public boolean isUnicorn;
|
||||
|
||||
public boolean isWithered;
|
||||
|
||||
public ModelSkeletonPony() {
|
||||
super();
|
||||
super(false);
|
||||
attributes.armWidth = 2;
|
||||
attributes.armDepth = 2;
|
||||
attributes.armRotationX = 3F;
|
||||
|
|
|
@ -7,22 +7,45 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.village.VillagerDataContainer;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
|
||||
import com.minelittlepony.client.model.ModelMobPony;
|
||||
import com.minelittlepony.client.model.components.BatWings;
|
||||
import com.minelittlepony.client.model.components.PonyEars;
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
import com.minelittlepony.client.render.entities.villager.PonyTextures;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.pony.meta.Race;
|
||||
|
||||
public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> extends ModelMobPony<T> implements ModelWithHat {
|
||||
public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> extends ModelAlicorn<T> implements ModelWithHat {
|
||||
|
||||
public PlaneRenderer apron;
|
||||
public PlaneRenderer trinket;
|
||||
private PlaneRenderer apron;
|
||||
private PlaneRenderer trinket;
|
||||
|
||||
private IPart batWings;
|
||||
|
||||
private VillagerProfession profession;
|
||||
public ModelVillagerPony() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
public boolean special;
|
||||
public boolean special2;
|
||||
@Override
|
||||
public IPart getWings() {
|
||||
if (getMetadata().getRace() == Race.BATPONY) {
|
||||
return batWings;
|
||||
}
|
||||
return super.getWings();
|
||||
}
|
||||
|
||||
public boolean hatVisible;
|
||||
@Override
|
||||
protected void initWings(float yOffset, float stretch) {
|
||||
super.initWings(yOffset, stretch);
|
||||
batWings = new BatWings<>(this, yOffset, stretch);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
||||
ears = new PonyEars(head, true);
|
||||
ears.init(yOffset, stretch);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
||||
|
@ -33,45 +56,20 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
|
|||
|
||||
@Override
|
||||
public void animateModel(T entity, float limbSwing, float limbSwingAmount, float partialTickTime) {
|
||||
profession = entity.getVillagerData().getProfession();
|
||||
special = entity.hasCustomName() && "Derpy".equals(entity.getCustomName().getString());
|
||||
special2 = special && entity.getUuid().getLeastSignificantBits() % 20 == 0;
|
||||
attributes.visualHeight = special2 ? 2.3F : 2;
|
||||
boolean special = PonyTextures.isBestPony(entity);
|
||||
|
||||
VillagerProfession profession = entity.getVillagerData().getProfession();
|
||||
|
||||
attributes.visualHeight = PonyTextures.isCrownPony(entity) ? 2.3F : 2;
|
||||
apron.visible = !special && profession == VillagerProfession.BUTCHER;
|
||||
trinket.visible = !special && !apron.visible && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(float scale) {
|
||||
super.renderBody(scale);
|
||||
|
||||
if (!special && profession != VillagerProfession.NONE && profession != VillagerProfession.NITWIT) {
|
||||
if (profession == VillagerProfession.BUTCHER) {
|
||||
apron.render(scale);
|
||||
} else {
|
||||
trinket.render(scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWearing(Wearable wearable) {
|
||||
|
||||
if (wearable == Wearable.SADDLE_BAGS) {
|
||||
return !special && profession != VillagerProfession.NONE && (
|
||||
profession == VillagerProfession.CARTOGRAPHER
|
||||
|| profession == VillagerProfession.FARMER
|
||||
|| profession == VillagerProfession.FISHERMAN
|
||||
|| profession == VillagerProfession.LIBRARIAN
|
||||
|| profession == VillagerProfession.SHEPHERD);
|
||||
}
|
||||
|
||||
if (wearable == Wearable.MUFFIN) {
|
||||
return special2;
|
||||
}
|
||||
if (wearable == Wearable.VILLAGER) {
|
||||
return hatVisible;
|
||||
}
|
||||
|
||||
return super.isWearing(wearable);
|
||||
apron.render(scale);
|
||||
//trinket.render(scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,17 +88,14 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
|
|||
|
||||
@Override
|
||||
public void setHatVisible(boolean visible) {
|
||||
hatVisible = visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
boolean isHeadRolling = false;
|
||||
if (entity instanceof AbstractTraderEntity) {
|
||||
isHeadRolling = ((AbstractTraderEntity)entity).getHeadRollingTimeLeft() > 0;
|
||||
}
|
||||
boolean isHeadRolling = entity instanceof AbstractTraderEntity
|
||||
&& ((AbstractTraderEntity)entity).getHeadRollingTimeLeft() > 0;
|
||||
|
||||
if (isHeadRolling) {
|
||||
float roll = 0.3F * MathHelper.sin(0.45F * ticks);
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
package com.minelittlepony.client.model.entities;
|
||||
|
||||
import com.minelittlepony.client.model.ModelMobPony;
|
||||
import com.minelittlepony.client.model.IMobModel;
|
||||
import com.minelittlepony.client.model.races.ModelAlicorn;
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
|
||||
import net.minecraft.entity.mob.HostileEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class ModelZombiePony<Zombie extends HostileEntity> extends ModelMobPony<Zombie> {
|
||||
public class ModelZombiePony<Zombie extends HostileEntity> extends ModelAlicorn<Zombie> implements IMobModel {
|
||||
|
||||
public boolean isPegasus;
|
||||
|
||||
public ModelZombiePony() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateModel(Zombie entity, float move, float swing, float ticks) {
|
||||
isPegasus = entity.getUuid().getLeastSignificantBits() % 30 == 0;
|
||||
|
|
|
@ -3,9 +3,10 @@ package com.minelittlepony.client.model.entities;
|
|||
import net.minecraft.entity.mob.ZombieVillagerEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.client.model.IMobModel;
|
||||
import com.minelittlepony.client.util.render.AbstractRenderer;
|
||||
|
||||
public class ModelZombieVillagerPony extends ModelVillagerPony<ZombieVillagerEntity> {
|
||||
public class ModelZombieVillagerPony extends ModelVillagerPony<ZombieVillagerEntity> implements IMobModel {
|
||||
|
||||
@Override
|
||||
protected void rotateLegs(float move, float swing, float ticks, ZombieVillagerEntity entity) {
|
||||
|
|
|
@ -82,7 +82,7 @@ public class ChristmasHat extends AbstractGear {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IGearRenderContext<T> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
|
||||
public interface IGearRenderContext<T extends Entity> {
|
||||
|
||||
IGearRenderContext<?> NULL = (e, g) -> null;
|
||||
|
||||
Identifier getDefaultTexture(T entity, IGear gear);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
|
||||
public interface IRenderContext<T extends Entity, M extends IModel> {
|
||||
|
||||
IRenderContext<?, ?> NULL = (e, g) -> null;
|
||||
|
||||
default boolean shouldRender(M model, T entity, IGear gear) {
|
||||
return gear.canRender(model, entity);
|
||||
}
|
||||
|
||||
Identifier getDefaultTexture(T entity, IGear gear);
|
||||
}
|
|
@ -44,7 +44,7 @@ public class Muffin extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IGearRenderContext<T> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class SaddleBags extends AbstractGear {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IGearRenderContext<T> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
return context.getDefaultTexture(entity, this);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class Stetson extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IGearRenderContext<T> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.village.VillagerDataContainer;
|
||||
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class VillagerHat extends AbstractGear {
|
||||
|
||||
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/antlers.png");
|
||||
|
||||
private PonyRenderer hat;
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
hat = new PonyRenderer(this, 30, 47)
|
||||
.around(0, 0, 0)
|
||||
.box(-8, -8, -6, 16, 16, 1, stretch);
|
||||
hat.pitch = -1.5707964F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRender(IModel model, Entity entity) {
|
||||
return model.isWearing(Wearable.VILLAGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BodyPart getGearLocation() {
|
||||
return BodyPart.HEAD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IGearRenderContext<T> context) {
|
||||
if (entity instanceof VillagerDataContainer) {
|
||||
return context.getDefaultTexture(entity, this);
|
||||
}
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderPart(float scale, UUID interpolatorId) {
|
||||
hat.render(scale);
|
||||
}
|
||||
|
||||
}
|
|
@ -50,7 +50,7 @@ public class WitchHat extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IGearRenderContext<T> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
return WITCH_TEXTURES;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
package com.minelittlepony.client.model.races;
|
||||
|
||||
import com.minelittlepony.client.model.components.PegasusWings;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class ModelAlicorn<T extends LivingEntity> extends ModelUnicorn<T> implements IPegasus {
|
||||
|
||||
public PegasusWings<ModelAlicorn<T>> wings;
|
||||
protected IPart wings;
|
||||
|
||||
public ModelAlicorn(boolean smallArms) {
|
||||
super(smallArms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPart getWings() {
|
||||
return wings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
super.init(yOffset, stretch);
|
||||
|
@ -28,7 +34,7 @@ public class ModelAlicorn<T extends LivingEntity> extends ModelUnicorn<T> implem
|
|||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (canFly()) {
|
||||
wings.setRotationAndAngles(attributes.isGoingFast, attributes.interpolatorId, move, swing, 0, ticks);
|
||||
getWings().setRotationAndAngles(attributes.isGoingFast, attributes.interpolatorId, move, swing, 0, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,13 +43,13 @@ public class ModelAlicorn<T extends LivingEntity> extends ModelUnicorn<T> implem
|
|||
super.renderBody(scale);
|
||||
|
||||
if (canFly()) {
|
||||
wings.renderPart(scale, attributes.interpolatorId);
|
||||
getWings().renderPart(scale, attributes.interpolatorId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
wings.setVisible(visible);
|
||||
getWings().setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.client.model.races;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.client.model.components.BatWings;
|
||||
import com.minelittlepony.client.model.components.PonyEars;
|
||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||
import com.minelittlepony.pony.meta.Wearable;
|
||||
|
||||
|
@ -19,15 +20,8 @@ public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
|||
|
||||
@Override
|
||||
protected void initEars(PonyRenderer head, float yOffset, float stretch) {
|
||||
head.child()
|
||||
.tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch) // right ear
|
||||
.tex(0, 3).box(-3.5F, -6.49F, 1.001F, 1, 1, 1, stretch)
|
||||
.tex(0, 5).box(-2.998F, -6.49F, 2.001F, 1, 1, 1, stretch);
|
||||
|
||||
head.child().flip()
|
||||
.tex(12, 16).box( 2, -6, 1, 2, 2, 2, stretch) // left ear
|
||||
.tex(0, 3).box( 2.5F, -6.49F, 1.001F, 1, 1, 1, stretch)
|
||||
.tex(0, 5).box( 1.998F, -6.49F, 2.001F, 1, 1, 1, stretch);
|
||||
ears = new PonyEars(head, true);
|
||||
ears.init(yOffset, stretch);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,18 +1,24 @@
|
|||
package com.minelittlepony.client.model.races;
|
||||
|
||||
import com.minelittlepony.client.model.components.PegasusWings;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> implements IPegasus {
|
||||
|
||||
public PegasusWings<ModelPegasus<T>> wings;
|
||||
protected IPart wings;
|
||||
|
||||
public ModelPegasus(boolean smallArms) {
|
||||
super(smallArms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPart getWings() {
|
||||
return wings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
super.init(yOffset, stretch);
|
||||
|
@ -26,18 +32,18 @@ public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> impl
|
|||
@Override
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
wings.setRotationAndAngles(attributes.isGoingFast, entity.getUuid(), move, swing, 0, ticks);
|
||||
getWings().setRotationAndAngles(attributes.isGoingFast, entity.getUuid(), move, swing, 0, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(float scale) {
|
||||
super.renderBody(scale);
|
||||
wings.renderPart(scale, attributes.interpolatorId);
|
||||
getWings().renderPart(scale, attributes.interpolatorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
wings.setVisible(visible);
|
||||
getWings().setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.render;
|
|||
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.gear.IGearRenderContext;
|
||||
import com.minelittlepony.client.model.gear.IRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
|
@ -13,7 +13,7 @@ import net.minecraft.client.render.entity.model.EntityModel;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public interface IPonyRender<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants, IGearRenderContext<T> {
|
||||
public interface IPonyRender<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants, IRenderContext<T, M> {
|
||||
|
||||
/**
|
||||
* Gets the wrapped pony model for this renderer.
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.client.render.entity.model.ModelWithHat;
|
|||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.village.VillagerDataContainer;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.render.entities.RenderPonyMob;
|
||||
|
@ -30,14 +31,33 @@ public abstract class AbstractVillagerRenderer<
|
|||
addFeature(new ClothingLayer<>(this, entityType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(M model, T entity, IGear gear) {
|
||||
|
||||
boolean special = PonyTextures.isBestPony(entity);
|
||||
|
||||
if (gear == LayerGear.SADDLE_BAGS) {
|
||||
VillagerProfession profession = entity.getVillagerData().getProfession();
|
||||
return !special && profession != VillagerProfession.NONE && (
|
||||
profession == VillagerProfession.CARTOGRAPHER
|
||||
|| profession == VillagerProfession.FARMER
|
||||
|| profession == VillagerProfession.FISHERMAN
|
||||
|| profession == VillagerProfession.LIBRARIAN
|
||||
|| profession == VillagerProfession.SHEPHERD);
|
||||
}
|
||||
|
||||
if (gear == LayerGear.MUFFIN) {
|
||||
return PonyTextures.isCrownPony(entity);
|
||||
}
|
||||
|
||||
return super.shouldRender(model, entity, gear);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getDefaultTexture(T villager, IGear gear) {
|
||||
if (gear == LayerGear.SADDLE_BAGS) {
|
||||
return ClothingLayer.getClothingTexture(villager, entityType);
|
||||
}
|
||||
if (gear == LayerGear.VILLAGER_HAT) {
|
||||
return ClothingLayer.getHatTexture(villager, entityType);
|
||||
}
|
||||
return super.getDefaultTexture(villager, gear);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.util.Optional;
|
|||
/**
|
||||
* Cached pool of villager textures.
|
||||
*/
|
||||
class PonyTextures<T extends LivingEntity & VillagerDataContainer> implements ITextureSupplier<T> {
|
||||
public class PonyTextures<T extends LivingEntity & VillagerDataContainer> implements ITextureSupplier<T> {
|
||||
|
||||
private final ITextureSupplier<String> formatter;
|
||||
|
||||
|
@ -45,14 +45,8 @@ class PonyTextures<T extends LivingEntity & VillagerDataContainer> implements IT
|
|||
|
||||
@Override
|
||||
public Identifier supplyTexture(T entity) {
|
||||
if (entity.hasCustomName()) {
|
||||
String name = entity.getCustomName().getString();
|
||||
if ("Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name))) {
|
||||
if (entity.isBaby()) {
|
||||
return egg2;
|
||||
}
|
||||
return egg;
|
||||
}
|
||||
if (isBestPony(entity)) {
|
||||
return entity.isBaby() ? egg2 : egg;
|
||||
}
|
||||
|
||||
VillagerData t = entity.getVillagerData();
|
||||
|
@ -95,4 +89,16 @@ class PonyTextures<T extends LivingEntity & VillagerDataContainer> implements IT
|
|||
|
||||
return Optional.of(texture);
|
||||
}
|
||||
|
||||
public static boolean isBestPony(LivingEntity entity) {
|
||||
if (!entity.hasCustomName()) {
|
||||
return false;
|
||||
}
|
||||
String name = entity.getCustomName().getString();
|
||||
return "Derpy".equals(name) || (entity.isBaby() && "Dinky".equals(name));
|
||||
}
|
||||
|
||||
public static boolean isCrownPony(LivingEntity entity) {
|
||||
return isBestPony(entity) && entity.getUuid().getLeastSignificantBits() % 20 == 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.minelittlepony.client.model.gear.ChristmasHat;
|
|||
import com.minelittlepony.client.model.gear.Muffin;
|
||||
import com.minelittlepony.client.model.gear.SaddleBags;
|
||||
import com.minelittlepony.client.model.gear.Stetson;
|
||||
import com.minelittlepony.client.model.gear.VillagerHat;
|
||||
import com.minelittlepony.client.model.gear.WitchHat;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
@ -30,15 +29,13 @@ public class LayerGear<T extends LivingEntity, M extends EntityModel<T> & IPonyM
|
|||
public static final IGear MUFFIN = new Muffin();
|
||||
public static final IGear STETSON = new Stetson();
|
||||
public static final IGear ANTLERS = new ChristmasHat();
|
||||
public static final IGear VILLAGER_HAT = new VillagerHat();
|
||||
|
||||
private static List<IGear> gears = Lists.newArrayList(
|
||||
SADDLE_BAGS,
|
||||
WITCH_HAT,
|
||||
MUFFIN,
|
||||
STETSON,
|
||||
ANTLERS,
|
||||
VILLAGER_HAT
|
||||
ANTLERS
|
||||
);
|
||||
|
||||
public LayerGear(IPonyRender<T, M> renderer) {
|
||||
|
@ -57,7 +54,7 @@ public class LayerGear<T extends LivingEntity, M extends EntityModel<T> & IPonyM
|
|||
Map<BodyPart, Float> renderStackingOffsets = new HashMap<>();
|
||||
|
||||
for (IGear gear : gears) {
|
||||
if (gear.canRender(model, entity)) {
|
||||
if (getContext().shouldRender(model, entity, gear)) {
|
||||
GlStateManager.pushMatrix();
|
||||
model.transform(gear.getGearLocation());
|
||||
model.getBodyPart(gear.getGearLocation()).applyTransform(scale);
|
||||
|
|
|
@ -14,6 +14,11 @@ public interface IPegasus extends IModel {
|
|||
return (getAttributes().isSwimming || isFlying() || getAttributes().isCrouching) && !getAttributes().isGliding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the wings of this pegasus/flying creature
|
||||
*/
|
||||
IPart getWings();
|
||||
|
||||
/**
|
||||
* Determines angle used to animate wing flaps whilst flying/swimming.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.model.gear;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.gear.IGearRenderContext;
|
||||
import com.minelittlepony.client.model.gear.IRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.IPart;
|
||||
|
@ -29,7 +29,7 @@ public interface IGear extends IPart {
|
|||
* Gets the texture to use for this wearable.
|
||||
* Return null to use the same as the primary model.
|
||||
*/
|
||||
<T extends Entity> Identifier getTexture(T entity, IGearRenderContext<T> context);
|
||||
<T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context);
|
||||
|
||||
/**
|
||||
* Orients this wearable.
|
||||
|
|
|
@ -11,7 +11,6 @@ public enum Wearable implements ITriggerPixelMapped<Wearable> {
|
|||
HAT (0x64),
|
||||
ANTLERS (0x96),
|
||||
SADDLE_BAGS (0xC8),
|
||||
VILLAGER (0x11),
|
||||
STETSON (0xFA);
|
||||
|
||||
private int triggerValue;
|
||||
|
|
Loading…
Reference in a new issue