mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-03-14 23:50:07 +01:00
More work on making Mine Little Pony more moddable
This commit is contained in:
parent
abfab92d78
commit
28d2b805ed
87 changed files with 367 additions and 318 deletions
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
public enum BodyPart {
|
||||
HEAD,
|
11
src/main/java/com/minelittlepony/api/model/ICapitated.java
Normal file
11
src/main/java/com/minelittlepony/api/model/ICapitated.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package com.minelittlepony.api.model;
|
||||
|
||||
/**
|
||||
* Interface for models that have a head.
|
||||
*/
|
||||
public interface ICapitated<T> {
|
||||
/**
|
||||
* Gets the head of this capitated object.
|
||||
*/
|
||||
T getHead();
|
||||
}
|
|
@ -1,17 +1,14 @@
|
|||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
import com.minelittlepony.api.pony.meta.Sizes;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
|
||||
public interface IModel extends ModelWithArms {
|
||||
|
||||
public interface IModel {
|
||||
/**
|
||||
* Applies a transform particular to a certain body part.
|
||||
*/
|
||||
|
@ -25,12 +22,12 @@ public interface IModel extends ModelWithArms {
|
|||
/**
|
||||
* Returns a new pony armour to go with this model. Called on startup by a model wrapper.
|
||||
*/
|
||||
IEquestrianArmour<?> createArmour();
|
||||
IArmour<?> createArmour();
|
||||
|
||||
/**
|
||||
* Gets the transitive properties of this model.
|
||||
*/
|
||||
ModelAttributes<?> getAttributes();
|
||||
ModelAttributes getAttributes();
|
||||
|
||||
/**
|
||||
* Gets the skin metadata associated with this model.
|
||||
|
@ -40,7 +37,7 @@ public interface IModel extends ModelWithArms {
|
|||
/**
|
||||
* Sets the pony metadata object associated with this model.
|
||||
*/
|
||||
void apply(IPonyData meta);
|
||||
void setMetadata(IPonyData meta);
|
||||
|
||||
/**
|
||||
* Returns true if the model is flying.
|
||||
|
@ -61,13 +58,6 @@ public interface IModel extends ModelWithArms {
|
|||
return getMetadata().getRace().hasWings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current model is a child or a child-like foal.
|
||||
*/
|
||||
default boolean isChild() {
|
||||
return getSize() == Sizes.FOAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current leg swing amount.
|
||||
*/
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
|
||||
|
@ -6,5 +6,5 @@ public interface IModelWrapper {
|
|||
/**
|
||||
* Updates metadata values to this wrapper's contained models.
|
||||
*/
|
||||
IModelWrapper apply(IPonyData meta);
|
||||
IModelWrapper applyMetadata(IPonyData meta);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
public interface IPegasus extends IModel {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
import net.minecraft.util.Arm;
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.client.render.EquineRenderManager.Mode;
|
||||
import com.minelittlepony.util.MathUtil;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
@ -13,11 +11,10 @@ import net.minecraft.util.math.Vec3d;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.ROTATE_270;
|
||||
import static com.minelittlepony.model.PonyModelConstants.WING_ROT_Z_SNEAK;
|
||||
|
||||
public class ModelAttributes<T extends LivingEntity> {
|
||||
import static com.minelittlepony.api.model.PonyModelConstants.ROTATE_270;
|
||||
import static com.minelittlepony.api.model.PonyModelConstants.WING_ROT_Z_SNEAK;
|
||||
|
||||
public class ModelAttributes {
|
||||
/**
|
||||
* True if the model is sleeping in a bed.
|
||||
*/
|
||||
|
@ -95,7 +92,7 @@ public class ModelAttributes<T extends LivingEntity> {
|
|||
/**
|
||||
* Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast.
|
||||
*/
|
||||
public void checkRainboom(T entity, float swing, boolean hasWings, float ticks) {
|
||||
public void checkRainboom(LivingEntity entity, float swing, boolean hasWings, float ticks) {
|
||||
Vec3d motion = entity.getVelocity();
|
||||
double zMotion = Math.sqrt(motion.x * motion.x + motion.z * motion.z);
|
||||
|
||||
|
@ -117,7 +114,7 @@ public class ModelAttributes<T extends LivingEntity> {
|
|||
return WING_ROT_Z_SNEAK;
|
||||
}
|
||||
|
||||
public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||
public void updateLivingState(LivingEntity entity, IPony pony, Mode mode) {
|
||||
visualHeight = entity.getHeight() + 0.125F;
|
||||
isSitting = pony.isSitting(entity);
|
||||
isCrouching = !isSitting && mode == Mode.THIRD_PERSON && pony.isCrouching(entity);
|
||||
|
@ -125,10 +122,22 @@ public class ModelAttributes<T extends LivingEntity> {
|
|||
isFlying = mode == Mode.THIRD_PERSON && pony.isFlying(entity);
|
||||
isGliding = entity.isFallFlying();
|
||||
isSwimming = mode == Mode.THIRD_PERSON && pony.isSwimming(entity);
|
||||
isSwimmingRotated = isSwimming && (entity instanceof PlayerEntity || entity instanceof IRotatedSwimmer);
|
||||
isSwimmingRotated = isSwimming && (entity instanceof PlayerEntity || entity instanceof Swimmer);
|
||||
isHorizontal = isSwimming;
|
||||
isRidingInteractive = pony.isRidingInteractive(entity);
|
||||
interpolatorId = entity.getUuid();
|
||||
isLeftHanded = entity.getMainArm() == Arm.LEFT;
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
FIRST_PERSON,
|
||||
THIRD_PERSON,
|
||||
OTHER
|
||||
}
|
||||
|
||||
/**
|
||||
* Special interface to mark entities that rotate horizontally when they swim.
|
||||
*/
|
||||
public interface Swimmer {
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
public interface PonyModelConstants {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model.armour;
|
||||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
/**
|
||||
* The layer used to render a given armour piece.
|
|
@ -0,0 +1,19 @@
|
|||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.util.registry.SimpleRegistry;
|
||||
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
|
||||
public final class ArmourRegistry {
|
||||
private ArmourRegistry() {}
|
||||
static final Registry<IArmour<?>> REGISTRY = new SimpleRegistry<>(RegistryKey.ofRegistry(new Identifier("minelittlepony", "armour")), Lifecycle.stable());
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends IArmourModel> IArmour<T> getArmour(ItemStack stack, IArmour<T> fallback) {
|
||||
return (IArmour<T>)REGISTRY.getOrEmpty(Registry.ITEM.getId(stack.getItem())).orElse(fallback);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model.armour;
|
||||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
public enum ArmourVariant {
|
||||
NORMAL,
|
|
@ -0,0 +1,33 @@
|
|||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import com.minelittlepony.api.model.IModelWrapper;
|
||||
|
||||
public interface IArmour<V extends IArmourModel> extends IModelWrapper {
|
||||
/**
|
||||
* Registers a custom armour for the supplied item.
|
||||
*
|
||||
* Mods can register their own armour here if they wish to override the default handling.
|
||||
*
|
||||
* Only one registration per item allowed.
|
||||
*/
|
||||
public static <T extends IArmourModel> IArmour<T> register(IArmour<T> armour, Item item) {
|
||||
return Registry.register(ArmourRegistry.REGISTRY, Registry.ITEM.getId(item), armour);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the armour model to render for the given layer.
|
||||
*/
|
||||
V getModel(ArmourLayer layer);
|
||||
|
||||
/**
|
||||
* Override this to specify your own textures.
|
||||
*
|
||||
* The default resolver will simply attempt to ponify the vanilla locations.
|
||||
*/
|
||||
default IArmourTextureResolver getTextureResolver(IArmourTextureResolver defaultResolver) {
|
||||
return defaultResolver;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package com.minelittlepony.model.armour;
|
||||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
|
||||
public interface IArmour {
|
||||
public interface IArmourModel {
|
||||
/**
|
||||
* Called to synchronise this armour's angles with that of another.
|
||||
*
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model.armour;
|
||||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
|
@ -7,18 +7,18 @@ import net.minecraft.util.Identifier;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface IArmourTextureResolver<T extends LivingEntity> {
|
||||
public interface IArmourTextureResolver {
|
||||
|
||||
/**
|
||||
* Gets the armour texture to be used for the given entity, armour piece, slot, and render layer.
|
||||
*/
|
||||
Identifier getArmourTexture(T entity, ItemStack itemstack, EquipmentSlot slot, ArmourLayer layer, @Nullable String type);
|
||||
Identifier getTexture(LivingEntity entity, ItemStack itemstack, EquipmentSlot slot, ArmourLayer layer, @Nullable String type);
|
||||
|
||||
/**
|
||||
* Gets the armour variant for the identified texture.
|
||||
* Either normal for pony-style textures, or legacy for other textures.
|
||||
*/
|
||||
default ArmourVariant getArmourVariant(ArmourLayer layer, Identifier resolvedTexture) {
|
||||
default ArmourVariant getVariant(ArmourLayer layer, Identifier resolvedTexture) {
|
||||
return ArmourVariant.NORMAL;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.model.armour;
|
||||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,11 +1,11 @@
|
|||
package com.minelittlepony.model.fabric;
|
||||
package com.minelittlepony.api.model.fabric;
|
||||
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
|
||||
public interface PonyModelPrepareCallback {
|
||||
|
||||
|
@ -15,5 +15,5 @@ public interface PonyModelPrepareCallback {
|
|||
}
|
||||
});
|
||||
|
||||
void onPonyModelPrepared(Entity entity, IModel model, EquineRenderManager.Mode mode);
|
||||
void onPonyModelPrepared(Entity entity, IModel model, ModelAttributes.Mode mode);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.model.gear;
|
||||
package com.minelittlepony.api.model.fabric;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.model.gear;
|
||||
package com.minelittlepony.api.model.gear;
|
||||
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
|
@ -6,11 +6,15 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.render.entity.feature.GearFeature;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Interface for an accessory on a pony's body.
|
||||
|
@ -21,7 +25,7 @@ public interface IGear {
|
|||
* <p>
|
||||
* This would be awesome for creating socks.
|
||||
*/
|
||||
static IGear addModGear(IGear gear) {
|
||||
static Supplier<IGear> register(Supplier<IGear> gear) {
|
||||
GearFeature.addModGear(gear);
|
||||
return gear;
|
||||
}
|
||||
|
@ -46,9 +50,9 @@ public interface IGear {
|
|||
*
|
||||
* If you need to use the player's own skin, use {@link IRenderContext#getDefaultTexture(entity, wearable)}
|
||||
*/
|
||||
<T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context);
|
||||
<T extends Entity> Identifier getTexture(T entity, Context<T, ?> context);
|
||||
|
||||
default <T extends Entity> RenderLayer getLayer(T entity, IRenderContext<T, ?> context) {
|
||||
default <T extends Entity> RenderLayer getLayer(T entity, Context<T, ?> context) {
|
||||
return RenderLayer.getEntityTranslucent(getTexture(entity, context));
|
||||
}
|
||||
|
||||
|
@ -78,4 +82,36 @@ public interface IGear {
|
|||
default void setVisible(boolean visible) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A render context for instance of IGear.
|
||||
*
|
||||
* @param <T> The type of entity being rendered.
|
||||
* @param <M> The type of the entity's primary model.
|
||||
*/
|
||||
public interface Context<T extends Entity, M extends IModel> {
|
||||
/**
|
||||
* The empty context.
|
||||
*/
|
||||
Context<?, ?> NULL = (e, g) -> null;
|
||||
|
||||
/**
|
||||
* Checks whether the given wearable and gear are able to render for this specific entity and its renderer.
|
||||
*/
|
||||
default boolean shouldRender(M model, T entity, Wearable wearable, IGear gear) {
|
||||
return gear.canRender(model, entity);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
default M getEntityModel() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default texture to use for this entity and wearable.
|
||||
*
|
||||
* May be the entity's own texture or a specific texture allocated for that wearable.
|
||||
*/
|
||||
Identifier getDefaultTexture(T entity, Wearable wearable);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.minelittlepony.api.model.gear;
|
||||
|
||||
/**
|
||||
* Interface for any gear that changes its position based on where it is in the hat stack.
|
||||
*/
|
||||
public interface IStackable {
|
||||
/**
|
||||
* The vertical height of this gear when present in a stack.
|
||||
*
|
||||
* Any gear rendered after this one will be shifted to sit on top of it.
|
||||
*/
|
||||
float getStackingHeight();
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.model.fabric;
|
||||
package com.minelittlepony.api.model.gear;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,4 +1,4 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
package com.minelittlepony.model;
|
||||
package com.minelittlepony.api.model;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -7,6 +7,8 @@ import com.minelittlepony.client.MineLittlePony;
|
|||
* Represents the different model sizes that are possible.
|
||||
*
|
||||
* This is the client-side version.
|
||||
*
|
||||
* For spooky things at a distance, use {@link Size} instead.
|
||||
*/
|
||||
public enum Sizes implements ITriggerPixelMapped<Sizes>, Size {
|
||||
TALL (0x534b76, 0.45f, 1.1F, 1.15F),
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package com.minelittlepony.client.hdskins;
|
||||
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.client.IPreviewModel;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.model.entity.race.PlayerModels;
|
||||
import com.minelittlepony.hdskins.client.dummy.DummyPlayer;
|
||||
import com.minelittlepony.hdskins.client.dummy.TextureProxy;
|
||||
import com.minelittlepony.model.IRotatedSwimmer;
|
||||
|
||||
/**
|
||||
* Dummy model used for the skin uploading screen.
|
||||
*/
|
||||
class DummyPony extends DummyPlayer implements IRotatedSwimmer, IPreviewModel {
|
||||
class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Swimmer {
|
||||
|
||||
public DummyPony(TextureProxy textures) {
|
||||
super(textures);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.model.fabric.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.api.pony.meta.Sizes;
|
||||
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
||||
import com.minelittlepony.client.transform.PonyTransformation;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.mson.api.model.MsonPart;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
|
@ -39,7 +39,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
}
|
||||
|
||||
@Override
|
||||
public IEquestrianArmour<?> createArmour() {
|
||||
public IArmour<?> createArmour() {
|
||||
return new ArmourWrapper<>(PonyArmourModel::new);
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
@Override
|
||||
public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
||||
attributes.checkRainboom(entity, swing, canFly(), ticks);
|
||||
PonyModelPrepareCallback.EVENT.invoker().onPonyModelPrepared(entity, this, EquineRenderManager.Mode.OTHER);
|
||||
PonyModelPrepareCallback.EVENT.invoker().onPonyModelPrepared(entity, this, ModelAttributes.Mode.OTHER);
|
||||
|
||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
||||
|
||||
|
|
|
@ -6,14 +6,13 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.util.Arm;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
import com.minelittlepony.model.fabric.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
import com.minelittlepony.api.pony.meta.Sizes;
|
||||
import com.minelittlepony.client.pony.PonyData;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.model.ModelAttributes;
|
||||
import com.minelittlepony.mson.api.model.biped.MsonPlayer;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +27,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
|
|||
/**
|
||||
* The model attributes.
|
||||
*/
|
||||
protected ModelAttributes<T> attributes = new ModelAttributes<>();
|
||||
protected ModelAttributes attributes = new ModelAttributes();
|
||||
|
||||
/**
|
||||
* Associated pony data.
|
||||
|
@ -45,7 +44,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||
public void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode) {
|
||||
child = entity.isBaby();
|
||||
attributes.updateLivingState(entity, pony, mode);
|
||||
PonyModelPrepareCallback.EVENT.invoker().onPonyModelPrepared(entity, this, mode);
|
||||
|
@ -59,7 +58,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
|
|||
}
|
||||
|
||||
@Override
|
||||
public ModelAttributes<?> getAttributes() {
|
||||
public ModelAttributes getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
|
@ -74,7 +73,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
|
|||
}
|
||||
|
||||
@Override
|
||||
public void apply(IPonyData meta) {
|
||||
public void setMetadata(IPonyData meta) {
|
||||
metadata = meta;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.model;
|
|||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.api.model.PonyModelConstants;
|
||||
|
||||
/**
|
||||
* Common interface for all undead enemies.
|
||||
|
|
|
@ -2,22 +2,22 @@ package com.minelittlepony.client.model;
|
|||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Arm;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IUnicorn;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.minelittlepony.model.ModelAttributes;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.model.BoxBuilder.RenderLayerSetter;
|
||||
|
||||
public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>> extends IPonyModel<T> {
|
||||
public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>> extends IPonyModel<T>, ModelWithArms {
|
||||
|
||||
M mixin();
|
||||
|
||||
|
@ -30,7 +30,7 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
|||
}
|
||||
|
||||
@Override
|
||||
default void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||
default void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode) {
|
||||
mixin().updateLivingState(entity, pony, mode);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
|||
}
|
||||
|
||||
@Override
|
||||
default ModelAttributes<?> getAttributes() {
|
||||
default ModelAttributes getAttributes() {
|
||||
return mixin().getAttributes();
|
||||
}
|
||||
|
||||
|
@ -60,13 +60,13 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
|||
}
|
||||
|
||||
@Override
|
||||
default IEquestrianArmour<?> createArmour() {
|
||||
default IArmour<?> createArmour() {
|
||||
return mixin().createArmour();
|
||||
}
|
||||
|
||||
@Override
|
||||
default void apply(IPonyData meta) {
|
||||
mixin().apply(meta);
|
||||
default void setMetadata(IPonyData meta) {
|
||||
mixin().setMetadata(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,7 +91,9 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
|||
|
||||
@Override
|
||||
default void setArmAngle(Arm arm, MatrixStack stack) {
|
||||
mixin().setArmAngle(arm, stack);
|
||||
if (mixin() instanceof ModelWithArms) {
|
||||
((ModelWithArms)mixin()).setArmAngle(arm, stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,19 +4,19 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.client.render.entity.model.BipedEntityModel;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.ICapitated;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.model.PonyModelConstants;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
public interface IPonyModel<T extends LivingEntity> extends PonyModelConstants, IModel, ICapitated<ModelPart>, MsonModel {
|
||||
|
||||
void copyAttributes(BipedEntityModel<T> other);
|
||||
|
||||
void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode);
|
||||
void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode);
|
||||
|
||||
ModelPart getBodyPart(BodyPart part);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.entity.mob.VexEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.model.gear.IGear;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
|
@ -38,7 +39,6 @@ import com.minelittlepony.client.model.gear.Stetson;
|
|||
import com.minelittlepony.client.model.gear.WitchHat;
|
||||
import com.minelittlepony.client.render.entity.PlayerPonyRenderer;
|
||||
import com.minelittlepony.client.render.entity.PlayerSeaponyRenderer;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
import com.minelittlepony.mson.api.Mson;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
|
|
@ -2,11 +2,11 @@ package com.minelittlepony.client.model;
|
|||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.IModelWrapper;
|
||||
import com.minelittlepony.api.model.armour.IArmourModel;
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.IModelWrapper;
|
||||
import com.minelittlepony.model.armour.IArmour;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ public class ModelWrapper<T extends LivingEntity, M extends IModel> implements I
|
|||
|
||||
private final M body;
|
||||
|
||||
private final IEquestrianArmour<?> armor;
|
||||
private final IArmour<?> armor;
|
||||
|
||||
/**
|
||||
* Creates a new model wrapper to contain the given pony.
|
||||
|
@ -25,7 +25,7 @@ public class ModelWrapper<T extends LivingEntity, M extends IModel> implements I
|
|||
public ModelWrapper(ModelKey<?> key) {
|
||||
body = (M)key.createModel();
|
||||
armor = body.createArmour();
|
||||
armor.apply(body.getMetadata());
|
||||
armor.applyMetadata(body.getMetadata());
|
||||
}
|
||||
|
||||
public M getBody() {
|
||||
|
@ -33,17 +33,17 @@ public class ModelWrapper<T extends LivingEntity, M extends IModel> implements I
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the contained armour model.
|
||||
* Returns the contained armour models.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends IArmour> IEquestrianArmour<V> getArmor() {
|
||||
return (IEquestrianArmour<V>)armor;
|
||||
public <V extends IArmourModel> IArmour<V> getArmor() {
|
||||
return (IArmour<V>)armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWrapper<T, M> apply(IPonyData meta) {
|
||||
body.apply(meta);
|
||||
armor.apply(meta);
|
||||
public ModelWrapper<T, M> applyMetadata(IPonyData meta) {
|
||||
body.setMetadata(meta);
|
||||
armor.applyMetadata(meta);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.util.math.Vec3d;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
import static com.minelittlepony.api.model.PonyModelConstants.*;
|
||||
|
||||
/**
|
||||
* Modified from ModelElytra.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.minelittlepony.client.model;
|
||||
|
||||
import com.minelittlepony.api.model.ICapitated;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.client.model.part.PonyEars;
|
||||
import com.minelittlepony.client.model.part.PonySnout;
|
||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||
import com.minelittlepony.client.pony.PonyData;
|
||||
import com.minelittlepony.model.ICapitated;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ package com.minelittlepony.client.model.armour;
|
|||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.api.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
public class ArmourWrapper<T extends LivingEntity> implements IEquestrianArmour<PonyArmourModel<T>> {
|
||||
public class ArmourWrapper<T extends LivingEntity> implements IArmour<PonyArmourModel<T>> {
|
||||
|
||||
private final PonyArmourModel<T> outerLayer;
|
||||
private final PonyArmourModel<T> innerLayer;
|
||||
|
@ -19,14 +19,14 @@ public class ArmourWrapper<T extends LivingEntity> implements IEquestrianArmour<
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArmourWrapper<T> apply(IPonyData meta) {
|
||||
outerLayer.apply(meta);
|
||||
innerLayer.apply(meta);
|
||||
public ArmourWrapper<T> applyMetadata(IPonyData meta) {
|
||||
outerLayer.setMetadata(meta);
|
||||
innerLayer.setMetadata(meta);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PonyArmourModel<T> getArmorForLayer(ArmourLayer layer) {
|
||||
public PonyArmourModel<T> getModel(ArmourLayer layer) {
|
||||
|
||||
if (layer == ArmourLayer.INNER) {
|
||||
return innerLayer;
|
||||
|
|
|
@ -9,9 +9,9 @@ import net.minecraft.resource.ResourceManager;
|
|||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.minelittlepony.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.model.armour.ArmourVariant;
|
||||
import com.minelittlepony.model.armour.IArmourTextureResolver;
|
||||
import com.minelittlepony.api.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.api.model.armour.ArmourVariant;
|
||||
import com.minelittlepony.api.model.armour.IArmourTextureResolver;
|
||||
import com.minelittlepony.util.ResourceUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -21,13 +21,13 @@ import java.nio.file.Paths;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DefaultArmourTextureResolver<T extends LivingEntity> implements IArmourTextureResolver<T> {
|
||||
public class DefaultArmourTextureResolver implements IArmourTextureResolver {
|
||||
|
||||
private final Map<String, Identifier> HUMAN_ARMOUR = new HashMap<>();
|
||||
private final Map<Identifier, Identifier> PONY_ARMOUR = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Identifier getArmourTexture(T entity, ItemStack itemstack, EquipmentSlot slot, ArmourLayer layer, @Nullable String type) {
|
||||
public Identifier getTexture(LivingEntity entity, ItemStack itemstack, EquipmentSlot slot, ArmourLayer layer, @Nullable String type) {
|
||||
type = Strings.nullToEmpty(type);
|
||||
|
||||
ArmorItem item = (ArmorItem) itemstack.getItem();
|
||||
|
@ -109,7 +109,7 @@ public class DefaultArmourTextureResolver<T extends LivingEntity> implements IAr
|
|||
}
|
||||
|
||||
@Override
|
||||
public ArmourVariant getArmourVariant(ArmourLayer layer, Identifier resolvedTexture) {
|
||||
public ArmourVariant getVariant(ArmourLayer layer, Identifier resolvedTexture) {
|
||||
if (resolvedTexture.getPath().endsWith("_pony.png")) {
|
||||
return ArmourVariant.NORMAL;
|
||||
}
|
||||
|
|
|
@ -6,12 +6,12 @@ import net.minecraft.client.render.entity.model.BipedEntityModel;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.armour.ArmourVariant;
|
||||
import com.minelittlepony.api.model.armour.IArmourModel;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.armour.ArmourVariant;
|
||||
import com.minelittlepony.model.armour.IArmour;
|
||||
|
||||
public class PonyArmourModel<T extends LivingEntity> extends AbstractPonyModel<T> implements IArmour {
|
||||
public class PonyArmourModel<T extends LivingEntity> extends AbstractPonyModel<T> implements IArmourModel {
|
||||
|
||||
private ModelPart chestPiece;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.Iterables;
|
||||
import com.minelittlepony.mson.api.model.MsonPart;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.PI;
|
||||
import static com.minelittlepony.api.model.PonyModelConstants.PI;
|
||||
|
||||
public class BreezieModel<T extends LivingEntity> extends BipedEntityModel<T> {
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import net.minecraft.entity.mob.HostileEntity;
|
|||
import net.minecraft.entity.mob.PiglinActivity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
|
||||
public class PiglinPonyModel extends ZomponyModel<HostileEntity> {
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class PiglinPonyModel extends ZomponyModel<HostileEntity> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(HostileEntity entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||
public void updateLivingState(HostileEntity entity, IPony pony, ModelAttributes.Mode mode) {
|
||||
super.updateLivingState(entity, pony, mode);
|
||||
leftArmPose = ArmPose.EMPTY;
|
||||
rightArmPose = entity.getMainHandStack().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
|
||||
|
|
|
@ -10,12 +10,12 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.village.VillagerDataContainer;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.client.model.entity.race.AlicornModel;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.client.render.entity.npc.PonyTextures;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
|
||||
public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> extends AlicornModel<T> implements ModelWithHat {
|
||||
|
@ -40,7 +40,7 @@ public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> e
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||
public void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode) {
|
||||
super.updateLivingState(entity, pony, mode);
|
||||
|
||||
ears.setVisible(pony.getMetadata().getRace() != Race.BATPONY);
|
||||
|
|
|
@ -4,10 +4,10 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.entity.mob.WitchEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.model.entity.race.ZebraModel;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
|
||||
public class WitchPonyModel extends ZebraModel<WitchEntity> {
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class WitchPonyModel extends ZebraModel<WitchEntity> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(WitchEntity entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||
public void updateLivingState(WitchEntity entity, IPony pony, ModelAttributes.Mode mode) {
|
||||
super.updateLivingState(entity, pony, mode);
|
||||
|
||||
if (entity.hasCustomName() && "Filly".equals(entity.getCustomName().getString())) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.IPegasus;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.model.part.PonySnout;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.IPegasus;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
|
@ -34,12 +34,12 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IEquestrianArmour<?> createArmour() {
|
||||
public IArmour<?> createArmour() {
|
||||
return new ArmourWrapper<>(Armour::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||
public void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode) {
|
||||
super.updateLivingState(entity, pony, mode);
|
||||
|
||||
// Seaponies can't sneak, silly
|
||||
|
@ -159,7 +159,7 @@ public class SeaponyModel<T extends LivingEntity> extends UnicornModel<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) {
|
||||
public void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode) {
|
||||
super.updateLivingState(entity, pony, mode);
|
||||
|
||||
// Seaponies can't sneak, silly
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.client.model.entity.race;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IUnicorn;
|
||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.model.MsonPart;
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.client.model.armour.ArmourWrapper;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
|
||||
public class ZebraModel<T extends LivingEntity> extends EarthPonyModel<T> {
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class ZebraModel<T extends LivingEntity> extends EarthPonyModel<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IEquestrianArmour<?> createArmour() {
|
||||
public IArmour<?> createArmour() {
|
||||
return new ArmourWrapper<>(Armour::new);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.client.render.RenderLayer;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
import com.minelittlepony.api.model.gear.IGear;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -7,12 +7,11 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.PonyModelConstants;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.common.util.Color;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.model.gear.IRenderContext;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.UUID;
|
||||
|
@ -76,7 +75,7 @@ public class ChristmasHat extends AbstractGear implements PonyModelConstants {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, Context<T, ?> context) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.gear.IStackable;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.gear.IRenderContext;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
|
||||
public class Muffin extends AbstractGear implements IStackable {
|
||||
|
||||
|
@ -29,12 +28,12 @@ public class Muffin extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, Context<T, ?> context) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStackingOffset() {
|
||||
public float getStackingHeight() {
|
||||
return 0.5F;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.IPegasus;
|
||||
import com.minelittlepony.api.model.PonyModelConstants;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.model.gear.IRenderContext;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -101,7 +100,7 @@ public class SaddleBags extends AbstractGear implements PonyModelConstants {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, Context<T, ?> context) {
|
||||
if (context.getEntityModel() != null && context.getEntityModel().getMetadata().getRace().isEquivalentTo(Race.CHANGELING)) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
|
|
@ -4,11 +4,10 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.gear.IStackable;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.gear.IRenderContext;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
|
||||
public class Stetson extends AbstractGear implements IStackable {
|
||||
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/stetson.png");
|
||||
|
@ -23,7 +22,7 @@ public class Stetson extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, Context<T, ?> context) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
|
@ -33,7 +32,7 @@ public class Stetson extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public float getStackingOffset() {
|
||||
public float getStackingHeight() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,10 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.model.gear.IStackable;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.model.gear.IRenderContext;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
|
||||
public class WitchHat extends AbstractGear implements IStackable {
|
||||
|
||||
|
@ -29,12 +28,12 @@ public class WitchHat extends AbstractGear implements IStackable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||
public <T extends Entity> Identifier getTexture(T entity, Context<T, ?> context) {
|
||||
return WITCH_TEXTURES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStackingOffset() {
|
||||
public float getStackingHeight() {
|
||||
return 0.7F;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.api.model.IPegasus;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.IPegasus;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.model.IPegasus;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
import com.minelittlepony.mson.api.model.PartBuilder;
|
||||
|
|
|
@ -4,9 +4,9 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.pony.meta.Gender;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
import com.minelittlepony.mson.api.model.MsonPart;
|
||||
|
|
|
@ -5,8 +5,8 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.model.part;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.render.VertexConsumerProvider.Immediate;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.client.render.MagicGlow;
|
||||
import com.minelittlepony.common.util.Color;
|
||||
import com.minelittlepony.model.IPart;
|
||||
import com.minelittlepony.mson.api.ModelContext;
|
||||
import com.minelittlepony.mson.api.MsonModel;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
|
@ -60,7 +61,7 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
|||
}
|
||||
|
||||
public void preRenderCallback(T entity, MatrixStack stack, float ticks) {
|
||||
updateModel(entity, Mode.THIRD_PERSON);
|
||||
updateModel(entity, ModelAttributes.Mode.THIRD_PERSON);
|
||||
|
||||
float s = getScaleFactor();
|
||||
stack.scale(s, s, s);
|
||||
|
@ -149,19 +150,19 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
|||
|
||||
public void updateMetadata(Identifier texture) {
|
||||
pony = MineLittlePony.getInstance().getManager().getPony(texture);
|
||||
playerModel.apply(pony.getMetadata());
|
||||
playerModel.applyMetadata(pony.getMetadata());
|
||||
}
|
||||
|
||||
public void updateModel(T entity, Mode mode) {
|
||||
public void updateModel(T entity, ModelAttributes.Mode mode) {
|
||||
pony = renderer.getEntityPony(entity);
|
||||
playerModel.apply(pony.getMetadata());
|
||||
playerModel.applyMetadata(pony.getMetadata());
|
||||
pony.updateForEntity(entity);
|
||||
|
||||
getModel().updateLivingState(entity, pony, mode);
|
||||
}
|
||||
|
||||
public IPony getPony(T entity) {
|
||||
updateModel(entity, Mode.THIRD_PERSON);
|
||||
updateModel(entity, ModelAttributes.Mode.THIRD_PERSON);
|
||||
return pony;
|
||||
}
|
||||
|
||||
|
@ -195,10 +196,4 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
|
|||
|
||||
return y;
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
FIRST_PERSON,
|
||||
THIRD_PERSON,
|
||||
OTHER
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.PonyModelConstants;
|
||||
import com.minelittlepony.api.model.gear.IGear;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.model.gear.IRenderContext;
|
||||
import com.minelittlepony.util.MathUtil;
|
||||
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
|
@ -14,7 +14,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public interface IPonyRenderContext<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants, IRenderContext<T, M> {
|
||||
public interface IPonyRenderContext<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants, IGear.Context<T, M> {
|
||||
|
||||
/**
|
||||
* Gets the wrapped pony model for this renderer.
|
||||
|
@ -39,7 +39,7 @@ public interface IPonyRenderContext<T extends LivingEntity, M extends EntityMode
|
|||
if (!passengerPony.getRace(false).isHuman()) {
|
||||
float yaw = MathUtil.interpolateDegress((float)entity.prevY, (float)entity.getY(), ticks);
|
||||
|
||||
getModelWrapper().apply(entityPony.getMetadata());
|
||||
getModelWrapper().applyMetadata(entityPony.getMetadata());
|
||||
M model = getModelWrapper().getBody();
|
||||
|
||||
model.transform(BodyPart.BACK, stack);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.client.render.entity;
|
||||
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
|
@ -9,7 +10,6 @@ import com.minelittlepony.client.model.ModelWrapper;
|
|||
import com.minelittlepony.client.model.gear.SaddleBags;
|
||||
import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.client.render.EquineRenderManager.Mode;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.client.render.entity.feature.DJPon3Feature;
|
||||
import com.minelittlepony.client.render.entity.feature.PassengerFeature;
|
||||
|
@ -144,7 +144,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
|
|||
}
|
||||
|
||||
protected void renderArm(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, AbstractClientPlayerEntity player, Arm side) {
|
||||
manager.updateModel(player, Mode.FIRST_PERSON);
|
||||
manager.updateModel(player, ModelAttributes.Mode.FIRST_PERSON);
|
||||
|
||||
stack.push();
|
||||
float reflect = side == Arm.LEFT ? 1 : -1;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.client.render.entity;
|
||||
|
||||
import com.minelittlepony.api.model.IUnicorn;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
|
@ -14,7 +15,6 @@ import com.minelittlepony.client.render.entity.feature.GlowingItemFeature;
|
|||
import com.minelittlepony.client.render.entity.feature.ArmourFeature;
|
||||
import com.minelittlepony.client.render.entity.feature.SkullFeature;
|
||||
import com.minelittlepony.client.render.entity.feature.ElytraFeature;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.decoration.ArmorStandEntity;
|
||||
|
||||
import com.minelittlepony.api.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
|
@ -21,7 +22,6 @@ import com.minelittlepony.client.model.entity.PonyArmourStandModel;
|
|||
import com.minelittlepony.client.model.entity.race.EarthPonyModel;
|
||||
import com.minelittlepony.client.pony.PonyData;
|
||||
import com.minelittlepony.client.render.entity.feature.ArmourFeature;
|
||||
import com.minelittlepony.model.armour.ArmourLayer;
|
||||
|
||||
public class PonyStandRenderer extends ArmorStandEntityRenderer {
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class PonyStandRenderer extends ArmorStandEntityRenderer {
|
|||
new ArmorStandArmorEntityModel(context.getPart(EntityModelLayers.ARMOR_STAND_OUTER_ARMOR))
|
||||
);
|
||||
|
||||
pony.apply(new PonyData(Race.EARTH));
|
||||
pony.applyMetadata(new PonyData(Race.EARTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
|
||||
// separate class in case I need it later
|
||||
public abstract class AbstractClothingFeature<T extends LivingEntity, M extends BipedEntityModel<T> & IModel> extends FeatureRenderer<T, M> {
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.api.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.api.model.armour.ArmourRegistry;
|
||||
import com.minelittlepony.api.model.armour.IArmour;
|
||||
import com.minelittlepony.api.model.armour.IArmourModel;
|
||||
import com.minelittlepony.api.model.armour.IArmourTextureResolver;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.common.util.Color;
|
||||
import com.minelittlepony.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.model.armour.IArmour;
|
||||
import com.minelittlepony.model.armour.IArmourTextureResolver;
|
||||
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
|
@ -26,7 +28,7 @@ import net.minecraft.util.Identifier;
|
|||
|
||||
public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
|
||||
|
||||
public static final IArmourTextureResolver<LivingEntity> DEFAULT = new DefaultArmourTextureResolver<>();
|
||||
private static final IArmourTextureResolver DEFAULT = new DefaultArmourTextureResolver();
|
||||
|
||||
public ArmourFeature(IPonyRenderContext<T, M> renderer) {
|
||||
super(renderer);
|
||||
|
@ -44,7 +46,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
|
|||
}
|
||||
}
|
||||
|
||||
public static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmour> void renderArmor(
|
||||
public static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmourModel> void renderArmor(
|
||||
ModelWrapper<T, ? extends IPonyModel<T>> pony, MatrixStack stack,
|
||||
VertexConsumerProvider renderContext, int lightUv, T entity,
|
||||
float limbDistance, float limbAngle,
|
||||
|
@ -55,7 +57,11 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
|
|||
|
||||
if (!itemstack.isEmpty() && itemstack.getItem() instanceof ArmorItem) {
|
||||
|
||||
V model = pony.<V>getArmor().getArmorForLayer(layer);
|
||||
IArmour<V> armour = ArmourRegistry.getArmour(itemstack, pony.<V>getArmor());
|
||||
|
||||
armour.applyMetadata(pony.getBody().getMetadata());
|
||||
|
||||
V model = armour.getModel(layer);
|
||||
|
||||
if (model.prepareToRender(armorSlot, layer)) {
|
||||
pony.getBody().copyAttributes(model);
|
||||
|
@ -75,27 +81,26 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
|
|||
blue = Color.b(color);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
IArmourTextureResolver<T> resolver = model instanceof IArmourTextureResolver ? (IArmourTextureResolver<T>)model : (IArmourTextureResolver<T>)DEFAULT;
|
||||
IArmourTextureResolver resolver = armour.getTextureResolver(DEFAULT);
|
||||
|
||||
boolean glint = itemstack.hasGlint();
|
||||
|
||||
renderArmourPart(stack, renderContext, lightUv, glint, model, red, green, blue, resolver, layer, resolver.getArmourTexture(entity, itemstack, armorSlot, layer, null));
|
||||
renderArmourPart(stack, renderContext, lightUv, glint, model, red, green, blue, resolver, layer, resolver.getTexture(entity, itemstack, armorSlot, layer, null));
|
||||
|
||||
if (item instanceof DyeableArmorItem) {
|
||||
renderArmourPart(stack, renderContext, lightUv, false, model, 1, 1, 1, resolver, layer, resolver.getArmourTexture(entity, itemstack, armorSlot, layer, "overlay"));
|
||||
renderArmourPart(stack, renderContext, lightUv, false, model, 1, 1, 1, resolver, layer, resolver.getTexture(entity, itemstack, armorSlot, layer, "overlay"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmour> void renderArmourPart(
|
||||
private static <T extends LivingEntity, V extends BipedEntityModel<T> & IArmourModel> void renderArmourPart(
|
||||
MatrixStack matrices, VertexConsumerProvider provider,
|
||||
int light, boolean glint, V model, float r, float g, float b, IArmourTextureResolver<T> resolver, ArmourLayer layer, Identifier texture) {
|
||||
int light, boolean glint, V model, float r, float g, float b, IArmourTextureResolver resolver, ArmourLayer layer, Identifier texture) {
|
||||
|
||||
VertexConsumer vertices = ItemRenderer.getArmorGlintConsumer(provider, RenderLayer.getArmorCutoutNoCull(texture), false, glint);
|
||||
|
||||
model.setVariant(resolver.getArmourVariant(layer, texture));
|
||||
model.setVariant(resolver.getVariant(layer, texture));
|
||||
model.render(matrices, vertices, light, OverlayTexture.DEFAULT_UV, r, g, b, 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import static com.minelittlepony.api.model.PonyModelConstants.PI;
|
||||
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
|
@ -16,8 +18,6 @@ import net.minecraft.item.Items;
|
|||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.PI;
|
||||
|
||||
public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>> extends AbstractPonyFeature<AbstractClientPlayerEntity, M> {
|
||||
|
||||
public CapeFeature(IPonyRenderContext<AbstractClientPlayerEntity, M> context) {
|
||||
|
|
|
@ -9,9 +9,9 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.client.model.DJPon3EarsModel;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
public class DJPon3Feature<T extends AbstractClientPlayerEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.model.PonyElytra;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
|
|
|
@ -9,27 +9,27 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.google.common.collect.Streams;
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.gear.IGear;
|
||||
import com.minelittlepony.api.model.gear.IStackable;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GearFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
|
||||
|
||||
private static final List<Entry> MOD_GEARS = new ArrayList<>();
|
||||
private static final List<Supplier<IGear>> MOD_GEARS = new ArrayList<>();
|
||||
|
||||
public static IGear addModGear(IGear gear) {
|
||||
MOD_GEARS.add(new Entry(gear, Wearable.NONE));
|
||||
return gear;
|
||||
public static void addModGear(Supplier<IGear> gear) {
|
||||
MOD_GEARS.add(gear);
|
||||
}
|
||||
|
||||
private final List<Entry> gears;
|
||||
|
@ -37,7 +37,10 @@ public class GearFeature<T extends LivingEntity, M extends EntityModel<T> & IPon
|
|||
public GearFeature(IPonyRenderContext<T, M> renderer) {
|
||||
super(renderer);
|
||||
|
||||
gears = Streams.concat(ModelType.getWearables().map(e -> new Entry(e.getValue().createModel(), e.getKey())), MOD_GEARS.stream()).collect(Collectors.toList());
|
||||
gears = Streams.concat(
|
||||
ModelType.getWearables().map(e -> new Entry(e.getValue().createModel(), e.getKey())),
|
||||
MOD_GEARS.stream().map(e -> new Entry(e.get(), Wearable.NONE))
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +65,7 @@ public class GearFeature<T extends LivingEntity, M extends EntityModel<T> & IPon
|
|||
|
||||
if (gear instanceof IStackable) {
|
||||
renderStackingOffsets.compute(part, (k, v) -> {
|
||||
float offset = ((IStackable)gear).getStackingOffset();
|
||||
float offset = ((IStackable)gear).getStackingHeight();
|
||||
if (v != null) {
|
||||
stack.translate(0, -v, 0);
|
||||
offset += v;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.api.model.IUnicorn;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.client.render.PonyRenderDispatcher;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
@ -106,6 +107,9 @@ public class HeldItemFeature<T extends LivingEntity, M extends EntityModel<T> &
|
|||
* Renders the main arm
|
||||
*/
|
||||
protected void renderArm(Arm arm, MatrixStack stack) {
|
||||
getContextModel().setArmAngle(arm, stack);
|
||||
M model = getContextModel();
|
||||
if (model instanceof ModelWithArms) {
|
||||
((ModelWithArms)model).setArmAngle(arm, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
|
@ -8,11 +8,11 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.village.VillagerDataContainer;
|
||||
import net.minecraft.village.VillagerProfession;
|
||||
|
||||
import com.minelittlepony.api.model.IUnicorn;
|
||||
import com.minelittlepony.api.model.gear.IGear;
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.render.entity.PonyRenderer;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
|
||||
abstract class AbstractNpcRenderer<
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
|
||||
public interface PonyPosture<T extends LivingEntity> {
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.api.model.BodyPart;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
import com.minelittlepony.api.pony.meta.Sizes;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.IModel;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
@ -2,9 +2,10 @@ package com.minelittlepony.client.transform;
|
|||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class PostureElytra implements PonyPosture<LivingEntity> {
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.transform;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
|
||||
public class PostureFalling implements PonyPosture<LivingEntity> {
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.transform;
|
||||
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
import com.minelittlepony.common.util.animation.MotionCompositor;
|
||||
import com.minelittlepony.model.IModel;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.transform;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
|
||||
public class PostureStanding implements PonyPosture<LivingEntity> {
|
||||
@Override
|
||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import com.minelittlepony.model.IModel;
|
||||
import com.minelittlepony.api.model.IModel;
|
||||
|
||||
public class PostureSwimming extends PostureFlight {
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package com.minelittlepony.model;
|
||||
|
||||
public interface ICapitated<ModelRenderer> {
|
||||
/**
|
||||
* Gets the head of this capitated object.
|
||||
*/
|
||||
ModelRenderer getHead();
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package com.minelittlepony.model;
|
||||
|
||||
public interface IRotatedSwimmer {
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.minelittlepony.model.armour;
|
||||
|
||||
import com.minelittlepony.model.IModelWrapper;
|
||||
|
||||
public interface IEquestrianArmour<V extends IArmour> extends IModelWrapper {
|
||||
/**
|
||||
* Gets the armour model to render for the given layer.
|
||||
*/
|
||||
V getArmorForLayer(ArmourLayer layer);
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package com.minelittlepony.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.pony.meta.Wearable;
|
||||
import com.minelittlepony.model.IModel;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A render context for instance of IGear.
|
||||
*
|
||||
* @param <T> The type of entity being rendered.
|
||||
* @param <M> The type of the entity's primary model.
|
||||
*/
|
||||
public interface IRenderContext<T extends Entity, M extends IModel> {
|
||||
/**
|
||||
* The empty context.
|
||||
*/
|
||||
IRenderContext<?, ?> NULL = (e, g) -> null;
|
||||
|
||||
/**
|
||||
* Checks whether the given wearable and gear are able to render for this specific entity and its renderer.
|
||||
*/
|
||||
default boolean shouldRender(M model, T entity, Wearable wearable, IGear gear) {
|
||||
return gear.canRender(model, entity);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
default M getEntityModel() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default texture to use for this entity and wearable.
|
||||
*
|
||||
* May be the entity's own texture or a specific texture allocated for that wearable.
|
||||
*/
|
||||
Identifier getDefaultTexture(T entity, Wearable wearable);
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package com.minelittlepony.model.gear;
|
||||
|
||||
public interface IStackable {
|
||||
float getStackingOffset();
|
||||
}
|
Loading…
Add table
Reference in a new issue