Convert the gear to mson

This commit is contained in:
Sollace 2019-11-25 16:09:58 +02:00
parent 3b38ec908c
commit 45577a76d0
6 changed files with 36 additions and 1 deletions

View file

@ -7,12 +7,13 @@ import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import com.minelittlepony.model.gear.IGear;
import com.minelittlepony.mson.api.MsonModel;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public abstract class AbstractGear extends Model implements IGear {
public abstract class AbstractGear extends Model implements IGear, MsonModel {
private final List<ModelPart> parts = new ArrayList<>();

View file

@ -9,6 +9,7 @@ import net.minecraft.util.math.MathHelper;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.IModel;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.pony.meta.Wearable;
import com.minelittlepony.util.math.Color;
@ -38,6 +39,12 @@ public class ChristmasHat extends AbstractGear {
private int tint;
@Override
public void init(ModelContext context) {
left = context.findByName("left");
right = context.findByName("right");
}
@Override
public boolean canRender(IModel model, Entity entity) {
return isChristmasDay() || model.isWearing(Wearable.ANTLERS);

View file

@ -6,12 +6,18 @@ import net.minecraft.util.Identifier;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.IModel;
import com.minelittlepony.model.gear.IStackable;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.pony.meta.Wearable;
public class Muffin extends AbstractGear implements IStackable {
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/muffin.png");
@Override
public void init(ModelContext context) {
accept(context.findByName("crown"));
}
@Override
public boolean canRender(IModel model, Entity entity) {
return model.isWearing(Wearable.MUFFIN);

View file

@ -4,6 +4,7 @@ import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.IModel;
import com.minelittlepony.model.IPegasus;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.pony.meta.Race;
import com.minelittlepony.pony.meta.Wearable;
@ -32,6 +33,13 @@ public class SaddleBags extends AbstractGear {
private IModel model;
@Override
public void init(ModelContext context) {
strap = context.findByName("strap");
leftBag = context.findByName("left_bag");
rightBag = context.findByName("right_bag");
}
@Deprecated
public void init(float yOffset, float stretch) {
leftBag = new Part(this, 56, 19);

View file

@ -6,11 +6,17 @@ import net.minecraft.util.Identifier;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.IModel;
import com.minelittlepony.model.gear.IStackable;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.pony.meta.Wearable;
public class Stetson extends AbstractGear implements IStackable {
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/stetson.png");
@Override
public void init(ModelContext context) {
accept(context.findByName("rim"));
}
@Override
public BodyPart getGearLocation() {
return BodyPart.HEAD;

View file

@ -8,6 +8,7 @@ import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.IModel;
import com.minelittlepony.model.gear.IStackable;
import com.minelittlepony.mson.api.ModelContext;
import com.minelittlepony.pony.meta.Wearable;
public class WitchHat extends AbstractGear implements IStackable {
@ -16,6 +17,12 @@ public class WitchHat extends AbstractGear implements IStackable {
private ModelPart witchHat;
@Override
public void init(ModelContext context) {
witchHat = context.findByName("witch_hat");
}
@Deprecated
public void init(float yOffset, float stretch) {
accept(witchHat = new Part(this).size(64, 128));