mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 22:38:00 +01:00
Bat ponies and changelings can now wear saddlebags, but they use a built in texture for it
This commit is contained in:
parent
f4b26bb5e6
commit
f03c2d709f
7 changed files with 33 additions and 21 deletions
|
@ -6,6 +6,8 @@ import net.minecraft.util.Identifier;
|
||||||
import com.minelittlepony.model.IModel;
|
import com.minelittlepony.model.IModel;
|
||||||
import com.minelittlepony.model.gear.IGear;
|
import com.minelittlepony.model.gear.IGear;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public interface IRenderContext<T extends Entity, M extends IModel> {
|
public interface IRenderContext<T extends Entity, M extends IModel> {
|
||||||
|
|
||||||
IRenderContext<?, ?> NULL = (e, g) -> null;
|
IRenderContext<?, ?> NULL = (e, g) -> null;
|
||||||
|
@ -14,5 +16,10 @@ public interface IRenderContext<T extends Entity, M extends IModel> {
|
||||||
return gear.canRender(model, entity);
|
return gear.canRender(model, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
default IModel getEntityModel() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Identifier getDefaultTexture(T entity, IGear gear);
|
Identifier getDefaultTexture(T entity, IGear gear);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.minelittlepony.client.util.render.plane.PlaneRenderer;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.IModel;
|
import com.minelittlepony.model.IModel;
|
||||||
import com.minelittlepony.model.IPegasus;
|
import com.minelittlepony.model.IPegasus;
|
||||||
|
import com.minelittlepony.pony.meta.Race;
|
||||||
import com.minelittlepony.pony.meta.Wearable;
|
import com.minelittlepony.pony.meta.Wearable;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
|
@ -15,6 +16,8 @@ import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public class SaddleBags extends AbstractGear {
|
public class SaddleBags extends AbstractGear {
|
||||||
|
|
||||||
|
public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/saddlebags.png");
|
||||||
|
|
||||||
private PlaneRenderer leftBag;
|
private PlaneRenderer leftBag;
|
||||||
private PlaneRenderer rightBag;
|
private PlaneRenderer rightBag;
|
||||||
|
|
||||||
|
@ -137,7 +140,9 @@ public class SaddleBags extends AbstractGear {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
public <T extends Entity> Identifier getTexture(T entity, IRenderContext<T, ?> context) {
|
||||||
|
if (context.getEntityModel() != null && context.getEntityModel().getMetadata().getRace().isEquivalentTo(Race.CHANGELING)) {
|
||||||
|
return TEXTURE;
|
||||||
|
}
|
||||||
return context.getDefaultTexture(entity, this);
|
return context.getDefaultTexture(entity, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.entity.LivingEntity;
|
||||||
import com.minelittlepony.client.model.components.BatWings;
|
import com.minelittlepony.client.model.components.BatWings;
|
||||||
import com.minelittlepony.client.model.components.PonyEars;
|
import com.minelittlepony.client.model.components.PonyEars;
|
||||||
import com.minelittlepony.client.util.render.PonyRenderer;
|
import com.minelittlepony.client.util.render.PonyRenderer;
|
||||||
import com.minelittlepony.pony.meta.Wearable;
|
|
||||||
|
|
||||||
public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
||||||
|
|
||||||
|
@ -23,13 +22,4 @@ public class ModelBatpony<T extends LivingEntity> extends ModelPegasus<T> {
|
||||||
ears = new PonyEars(head, true);
|
ears = new PonyEars(head, true);
|
||||||
ears.init(yOffset, stretch);
|
ears.init(yOffset, stretch);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isWearing(Wearable wearable) {
|
|
||||||
if (wearable == Wearable.SADDLE_BAGS) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.isWearing(wearable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import com.minelittlepony.client.model.components.BugWings;
|
import com.minelittlepony.client.model.components.BugWings;
|
||||||
import com.minelittlepony.pony.meta.Wearable;
|
|
||||||
|
|
||||||
public class ModelChangeling<T extends LivingEntity> extends ModelAlicorn<T> {
|
public class ModelChangeling<T extends LivingEntity> extends ModelAlicorn<T> {
|
||||||
|
|
||||||
|
@ -29,13 +28,4 @@ public class ModelChangeling<T extends LivingEntity> extends ModelAlicorn<T> {
|
||||||
}
|
}
|
||||||
return WING_ROT_Z_SNEAK;
|
return WING_ROT_Z_SNEAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isWearing(Wearable wearable) {
|
|
||||||
if (wearable == Wearable.SADDLE_BAGS) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.isWearing(wearable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.minelittlepony.client.render.entities.player;
|
||||||
import com.minelittlepony.client.MineLittlePony;
|
import com.minelittlepony.client.MineLittlePony;
|
||||||
import com.minelittlepony.client.model.ClientPonyModel;
|
import com.minelittlepony.client.model.ClientPonyModel;
|
||||||
import com.minelittlepony.client.model.ModelWrapper;
|
import com.minelittlepony.client.model.ModelWrapper;
|
||||||
|
import com.minelittlepony.client.model.gear.SaddleBags;
|
||||||
import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
|
import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
|
||||||
import com.minelittlepony.client.render.IPonyRender;
|
import com.minelittlepony.client.render.IPonyRender;
|
||||||
import com.minelittlepony.client.render.RenderPony;
|
import com.minelittlepony.client.render.RenderPony;
|
||||||
|
@ -14,7 +15,9 @@ import com.minelittlepony.client.render.layer.LayerPonyArmor;
|
||||||
import com.minelittlepony.client.render.layer.LayerPonyCape;
|
import com.minelittlepony.client.render.layer.LayerPonyCape;
|
||||||
import com.minelittlepony.client.render.layer.LayerPonyCustomHead;
|
import com.minelittlepony.client.render.layer.LayerPonyCustomHead;
|
||||||
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
import com.minelittlepony.client.render.layer.LayerPonyElytra;
|
||||||
|
import com.minelittlepony.model.gear.IGear;
|
||||||
import com.minelittlepony.pony.IPony;
|
import com.minelittlepony.pony.IPony;
|
||||||
|
import com.minelittlepony.pony.meta.Race;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -186,4 +189,14 @@ public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRende
|
||||||
return MineLittlePony.getInstance().getManager().getPony(entity);
|
return MineLittlePony.getInstance().getManager().getPony(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getDefaultTexture(AbstractClientPlayerEntity entity, IGear gear) {
|
||||||
|
if (gear == LayerGear.SADDLE_BAGS) {
|
||||||
|
if (getInternalRenderer().getModel().getMetadata().getRace() == Race.BATPONY) {
|
||||||
|
return SaddleBags.TEXTURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return IPonyRender.super.getDefaultTexture(entity, gear);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,13 @@ public enum Race implements ITriggerPixelMapped<Race> {
|
||||||
return getAlias() != this;
|
return getAlias() != this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if both races resolve to the same value.
|
||||||
|
*/
|
||||||
|
public boolean isEquivalentTo(Race other) {
|
||||||
|
return getAlias() == other.getAlias();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the actual race determined by the given pony level.
|
* Gets the actual race determined by the given pony level.
|
||||||
* PonyLevel.HUMANS would force all races to be humans.
|
* PonyLevel.HUMANS would force all races to be humans.
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Loading…
Reference in a new issue