Render an item for the gem in the meantime

This commit is contained in:
Sollace 2020-05-03 22:41:38 +02:00
parent aaee3e48cd
commit 9c4568e707
2 changed files with 22 additions and 5 deletions

View file

@ -2,8 +2,6 @@ package com.minelittlepony.unicopia.client.render;
import com.minelittlepony.unicopia.client.render.model.GemEntityModel;
import com.minelittlepony.unicopia.entity.SpellcastEntity;
import com.mojang.blaze3d.platform.GlStateManager;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.minecraft.client.render.Frustum;
import net.minecraft.client.render.VertexConsumerProvider;
@ -58,7 +56,7 @@ public class SpellcastEntityRenderer extends LivingEntityRenderer<SpellcastEntit
@Override
public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, SpellcastEntity entity, float limbAngle, float limbDistance, float tickDelta, float customAngle, float headYaw, float headPitch) {
matrices.push();
int tiers = Math.min(entity.getCurrentLevel(), 5);
for (int i = 0; i <= tiers; i++) {
@ -78,10 +76,11 @@ public class SpellcastEntityRenderer extends LivingEntityRenderer<SpellcastEntit
for (int i = entity.getCurrentLevel(); i > 0; i--) {
matrices.push();
GlStateManager.translatef(0.6F, 0, 0);
matrices.translate(0.6F, 0, 0);
FeatureRenderer.render(model, model, TEXTURE, matrices, vertexConsumers, light, entity, limbAngle, limbDistance, entity.age, headYaw, headPitch, 1, 1, 1, 1);
matrices.pop();
}
matrices.pop();
}
}
}

View file

@ -1,13 +1,18 @@
package com.minelittlepony.unicopia.client.render.model;
import com.minelittlepony.unicopia.entity.SpellcastEntity;
import com.minelittlepony.unicopia.item.UItems;
import com.minelittlepony.util.Color;
import net.minecraft.client.MinecraftClient;
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.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.entity.EntityPose;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
public class GemEntityModel extends EntityModel<SpellcastEntity> {
@ -56,8 +61,21 @@ public class GemEntityModel extends EntityModel<SpellcastEntity> {
green = Color.g(tint);
blue = Color.b(tint);
}
matrices.push();
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(body.yaw));
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(body.pitch));
matrices.translate(body.pivotX, body.pivotY, body.pivotZ);
body.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
MinecraftClient.getInstance().getItemRenderer().renderItem(
new ItemStack(UItems.GEM),
ModelTransformation.Mode.GROUND, light,
overlay,
matrices,
MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers()
);
matrices.pop();
//body.render(matrices, vertexConsumer, light, overlay, red, green, blue, alpha);
}
}