mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Added crowns
This commit is contained in:
parent
beddc3aabf
commit
84886cf798
8 changed files with 105 additions and 6 deletions
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
|
||||
public enum Wearable implements TriggerPixelType<Wearable> {
|
||||
NONE (0x00),
|
||||
CROWN (0x16),
|
||||
MUFFIN (0x32),
|
||||
HAT (0x64),
|
||||
ANTLERS (0x96),
|
||||
|
|
|
@ -21,12 +21,7 @@ import com.minelittlepony.client.model.entity.race.PegasusModel;
|
|||
import com.minelittlepony.client.model.entity.race.SeaponyModel;
|
||||
import com.minelittlepony.client.model.entity.race.UnicornModel;
|
||||
import com.minelittlepony.client.model.entity.race.ZebraModel;
|
||||
import com.minelittlepony.client.model.gear.AbstractGear;
|
||||
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.WitchHat;
|
||||
import com.minelittlepony.client.model.gear.*;
|
||||
import com.minelittlepony.client.render.entity.PlayerPonyRenderer;
|
||||
import com.minelittlepony.client.render.entity.PlayerSeaponyRenderer;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
|
@ -71,6 +66,7 @@ public final class ModelType {
|
|||
|
||||
public static final ModelKey<Stetson> STETSON = registerGear("stetson", Wearable.STETSON, Stetson::new);
|
||||
public static final ModelKey<SaddleBags> SADDLEBAGS = registerGear("saddlebags", Wearable.SADDLE_BAGS, SaddleBags::new);
|
||||
public static final ModelKey<Crown> CROWN = registerGear("crown", Wearable.CROWN, Crown::new);
|
||||
public static final ModelKey<Muffin> MUFFIN = registerGear("muffin", Wearable.MUFFIN, Muffin::new);
|
||||
public static final ModelKey<WitchHat> WITCH_HAT = registerGear("witch_hat", Wearable.HAT, WitchHat::new);
|
||||
public static final ModelKey<ChristmasHat> ANTLERS = registerGear("antlers", Wearable.ANTLERS, ChristmasHat::new);
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.minelittlepony.client.model.gear;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.mob.AbstractPiglinEntity;
|
||||
import net.minecraft.entity.mob.ZombifiedPiglinEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
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;
|
||||
|
||||
public class Crown extends AbstractGear implements IStackable {
|
||||
public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/crown.png");
|
||||
|
||||
public Crown(ModelPart tree) {
|
||||
addPart(tree.getChild("crown"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRender(IModel model, Entity entity) {
|
||||
return model.isWearing(Wearable.CROWN)
|
||||
|| ((
|
||||
entity instanceof AbstractPiglinEntity
|
||||
|| entity instanceof PlayerEntity
|
||||
|| entity instanceof ZombifiedPiglinEntity
|
||||
) && entity.hasCustomName() && entity.getCustomName().getString().equalsIgnoreCase("technoblade")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BodyPart getGearLocation() {
|
||||
return BodyPart.HEAD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Entity> Identifier getTexture(T entity, Context<T, ?> context) {
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStackingHeight() {
|
||||
return 0.1F;
|
||||
}
|
||||
}
|
|
@ -40,6 +40,9 @@ public final class MobRenderers {
|
|||
pony.switchRenderer(state, EntityType.PIGLIN, PonyPiglinRenderer::new);
|
||||
pony.switchRenderer(state, EntityType.PIGLIN_BRUTE, PonyPiglinRenderer::new);
|
||||
pony.switchRenderer(state, EntityType.ZOMBIFIED_PIGLIN, PonyPiglinRenderer::new);
|
||||
if (!MineLittlePony.getInstance().getConfig().noFun.get()) {
|
||||
pony.switchRenderer(state, EntityType.PIG, PonyPigRenderer::new);
|
||||
}
|
||||
});
|
||||
public static final MobRenderers SKELETON = register("skeletons", (state, pony) -> {
|
||||
pony.switchRenderer(state, EntityType.SKELETON, SkeleponyRenderer::new);
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.minelittlepony.client.render.entity;
|
||||
|
||||
import net.minecraft.client.model.Dilation;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.render.entity.PigEntityRenderer;
|
||||
import net.minecraft.client.render.entity.feature.*;
|
||||
import net.minecraft.client.render.entity.model.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.passive.PigEntity;
|
||||
import com.minelittlepony.client.model.gear.Crown;
|
||||
|
||||
public class PonyPigRenderer extends PigEntityRenderer {
|
||||
|
||||
public PonyPigRenderer(EntityRendererFactory.Context context) {
|
||||
super(context);
|
||||
addFeature(new CrownFeature(this));
|
||||
}
|
||||
|
||||
private final class CrownFeature extends FeatureRenderer<PigEntity, PigEntityModel<PigEntity>> {
|
||||
private final PigEntityModel<PigEntity> model;
|
||||
|
||||
public CrownFeature(FeatureRendererContext<PigEntity, PigEntityModel<PigEntity>> context) {
|
||||
super(context);
|
||||
model = new PigEntityModel<>(PigEntityModel.getTexturedModelData(new Dilation(0.5F)).createModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, PigEntity entity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch) {
|
||||
if (!entity.hasCustomName() || !entity.getCustomName().getString().equalsIgnoreCase("technoblade")) {
|
||||
return;
|
||||
}
|
||||
|
||||
getContextModel().copyStateTo(model);
|
||||
model.animateModel(entity, limbAngle, limbDistance, tickDelta);
|
||||
model.setAngles(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch);
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(Crown.TEXTURE));
|
||||
model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ public class PonyConfig extends JsonConfig {
|
|||
public final Setting<Sizes> sizeOverride = value("sizeOverride", Sizes.UNSET);
|
||||
|
||||
public final Setting<Boolean> flappyElytras = value("customisation", "flappyElytras", false);
|
||||
public final Setting<Boolean> noFun = value("customisation", "noFun", false);
|
||||
|
||||
public PonyConfig(Path path) {
|
||||
super(path);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"texture": {"w": 64, "h": 32},
|
||||
"data": {
|
||||
"crown": {
|
||||
"cubes": [
|
||||
{ "from": [-4, -6, -6], "size": [ 8, 8, 8], "dilate": 0.5 }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
Loading…
Reference in a new issue