mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-28 23:17:59 +01:00
Fixed guardians not rendering correctly
This commit is contained in:
parent
3fd07b4874
commit
891aa73254
7 changed files with 43 additions and 19 deletions
|
@ -31,7 +31,7 @@ class PonyPreview extends PlayerPreview {
|
||||||
@Override
|
@Override
|
||||||
public Identifier getDefaultSkin(SkinType type, boolean slim) {
|
public Identifier getDefaultSkin(SkinType type, boolean slim) {
|
||||||
if (type == MineLPHDSkins.seaponySkinType) {
|
if (type == MineLPHDSkins.seaponySkinType) {
|
||||||
return DefaultSkinGenerator.generateGreyScale(SeaponyRenderer.TEXTURE, SeaponyRenderer.TEXTURE, getExclusion());
|
return DefaultSkinGenerator.generateGreyScale(SeaponyRenderer.SEAPONY, SeaponyRenderer.SEAPONY, getExclusion());
|
||||||
}
|
}
|
||||||
|
|
||||||
Wearable wearable = MineLPHDSkins.wearableTypes.getOrDefault(type, Wearable.NONE);
|
Wearable wearable = MineLPHDSkins.wearableTypes.getOrDefault(type, Wearable.NONE);
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
package com.minelittlepony.client.mixin;
|
package com.minelittlepony.client.mixin;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityDimensions;
|
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(Entity.class)
|
||||||
public interface IResizeable {
|
public interface IResizeable {
|
||||||
@Accessor("dimensions")
|
@Accessor
|
||||||
EntityDimensions getCurrentSize();
|
void setStandingEyeHeight(float height);
|
||||||
|
|
||||||
@Accessor("dimensions")
|
|
||||||
void setCurrentSize(EntityDimensions size);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package com.minelittlepony.client.model.entity;
|
package com.minelittlepony.client.model.entity;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
import net.minecraft.client.render.entity.model.EntityModel;
|
||||||
import net.minecraft.client.render.entity.model.GuardianEntityModel;
|
import net.minecraft.client.render.entity.model.GuardianEntityModel;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.mob.GuardianEntity;
|
import net.minecraft.entity.mob.GuardianEntity;
|
||||||
import com.minelittlepony.client.model.IPonyMixinModel;
|
import com.minelittlepony.client.model.IPonyMixinModel;
|
||||||
import com.minelittlepony.client.model.entity.race.SeaponyModel;
|
import com.minelittlepony.client.model.entity.race.SeaponyModel;
|
||||||
|
@ -18,4 +21,25 @@ public class GuardianPonyModel extends GuardianEntityModel implements IPonyMixin
|
||||||
public SeaponyModel<GuardianEntity> mixin() {
|
public SeaponyModel<GuardianEntity> mixin() {
|
||||||
return mixin;
|
return mixin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||||
|
mixin().render(matrices, vertices, light, overlay, red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void animateModel(GuardianEntity entity, float limbAngle, float limbDistance, float tickDelta) {
|
||||||
|
mixin().animateModel(entity, limbAngle, limbDistance, tickDelta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void copyStateTo(EntityModel<GuardianEntity> copy) {
|
||||||
|
mixin().copyStateTo(copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAngles(GuardianEntity entity, float limbAngle, float limbSpeed, float animationProgress, float headYaw, float headPitch) {
|
||||||
|
mixin().setVisible(true);
|
||||||
|
mixin().setAngles(entity, limbAngle, limbSpeed, animationProgress, headYaw, headPitch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,27 +11,32 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
import net.minecraft.client.render.entity.GuardianEntityRenderer;
|
import net.minecraft.client.render.entity.GuardianEntityRenderer;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.EntityDimensions;
|
|
||||||
import net.minecraft.entity.mob.ElderGuardianEntity;
|
import net.minecraft.entity.mob.ElderGuardianEntity;
|
||||||
import net.minecraft.entity.mob.GuardianEntity;
|
import net.minecraft.entity.mob.GuardianEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class SeaponyRenderer extends GuardianEntityRenderer {
|
public class SeaponyRenderer extends GuardianEntityRenderer {
|
||||||
public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/entity/seapony.png");
|
public static final Identifier SEAPONY = new Identifier("minelittlepony", "textures/entity/guardian/blueball.png");
|
||||||
|
private static final Identifier SEAPONY_TEXTURES = new Identifier("minelittlepony", "textures/entity/guardian");
|
||||||
|
public static final Identifier ELDER_SEAPONY = new Identifier("minelittlepony", "textures/entity/elder_guardian/blueball.png");
|
||||||
|
private static final Identifier ELDER_SEAPONY_TEXTURES = new Identifier("minelittlepony", "textures/entity/elder_guardian");
|
||||||
|
|
||||||
private final AbstractPonyRenderer<GuardianEntity, GuardianPonyModel> ponyRenderer;
|
private final AbstractPonyRenderer<GuardianEntity, GuardianPonyModel> ponyRenderer;
|
||||||
|
|
||||||
public SeaponyRenderer(EntityRendererFactory.Context context, float scale) {
|
private final float scale;
|
||||||
|
|
||||||
|
public SeaponyRenderer(EntityRendererFactory.Context context, TextureSupplier<GuardianEntity> texture, float scale) {
|
||||||
super(context);
|
super(context);
|
||||||
ponyRenderer = AbstractPonyRenderer.proxy(context, ModelType.GUARDIAN, TextureSupplier.of(TEXTURE), scale, features, m -> model = m);
|
ponyRenderer = AbstractPonyRenderer.proxy(context, ModelType.GUARDIAN, texture, scale, features, m -> model = m);
|
||||||
|
this.scale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SeaponyRenderer guardian(EntityRendererFactory.Context context) {
|
public static SeaponyRenderer guardian(EntityRendererFactory.Context context) {
|
||||||
return new SeaponyRenderer(context, 1);
|
return new SeaponyRenderer(context, TextureSupplier.ofPool(SEAPONY_TEXTURES, TextureSupplier.of(SEAPONY)), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SeaponyRenderer elder(EntityRendererFactory.Context context) {
|
public static SeaponyRenderer elder(EntityRendererFactory.Context context) {
|
||||||
return new SeaponyRenderer(context, 1);
|
return new SeaponyRenderer(context, TextureSupplier.ofPool(ELDER_SEAPONY_TEXTURES, TextureSupplier.of(SEAPONY)), ElderGuardianEntity.SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,14 +52,13 @@ public class SeaponyRenderer extends GuardianEntityRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(GuardianEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) {
|
public void render(GuardianEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) {
|
||||||
IResizeable resize = (IResizeable)entity;
|
ponyRenderer.manager.preRenderCallback(entity, stack, tickDelta);
|
||||||
EntityDimensions origin = resize.getCurrentSize();
|
|
||||||
|
float height = entity.getStandingEyeHeight();
|
||||||
|
|
||||||
// aligns the beam to their horns
|
// aligns the beam to their horns
|
||||||
resize.setCurrentSize(EntityDimensions.changing(origin.width, entity instanceof ElderGuardianEntity ? 6 : 3));
|
((IResizeable)entity).setStandingEyeHeight(2 * scale * ponyRenderer.manager.getScaleFactor());
|
||||||
|
|
||||||
super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv);
|
super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv);
|
||||||
|
((IResizeable)entity).setStandingEyeHeight(height);
|
||||||
resize.setCurrentSize(origin);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.8 KiB |
Loading…
Reference in a new issue