|
| 1 | +// Made with Blockbench 4.10.3 |
| 2 | +// Exported for Minecraft version 1.17 or later with Mojang mappings |
| 3 | +// Paste this class into your mod and generate all required imports |
| 4 | +package corundum.rubinated_nether.client.render.entity; |
| 5 | + |
| 6 | +import com.mojang.blaze3d.vertex.PoseStack; |
| 7 | +import com.mojang.blaze3d.vertex.VertexConsumer; |
| 8 | + |
| 9 | +import corundum.rubinated_nether.RubinatedNether; |
| 10 | +import net.minecraft.client.model.EntityModel; |
| 11 | +import net.minecraft.client.model.geom.ModelLayerLocation; |
| 12 | +import net.minecraft.client.model.geom.ModelPart; |
| 13 | +import net.minecraft.client.model.geom.PartPose; |
| 14 | +import net.minecraft.client.model.geom.builders.CubeDeformation; |
| 15 | +import net.minecraft.client.model.geom.builders.CubeListBuilder; |
| 16 | +import net.minecraft.client.model.geom.builders.LayerDefinition; |
| 17 | +import net.minecraft.client.model.geom.builders.MeshDefinition; |
| 18 | +import net.minecraft.client.model.geom.builders.PartDefinition; |
| 19 | +import net.minecraft.world.entity.Entity; |
| 20 | + |
| 21 | +public class RubyLensModel<T extends Entity> extends EntityModel<T> { |
| 22 | + // This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor |
| 23 | + public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(RubinatedNether.id("wearable/ruby_lens"), "main"); |
| 24 | + private final ModelPart head; |
| 25 | + |
| 26 | + public RubyLensModel(ModelPart root) { |
| 27 | + this.head = root.getChild("head"); |
| 28 | + } |
| 29 | + |
| 30 | + public static LayerDefinition createBodyLayer() { |
| 31 | + MeshDefinition meshdefinition = new MeshDefinition(); |
| 32 | + PartDefinition partdefinition = meshdefinition.getRoot(); |
| 33 | + |
| 34 | + partdefinition.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.0F)) |
| 35 | + .texOffs(0, 3).addBox(-4.0F, -6.0F, -6.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F)) |
| 36 | + .texOffs(0, 3).addBox(1.0F, -6.0F, -6.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F)) |
| 37 | + .texOffs(24, 4).addBox(-4.0F, -6.0F, -6.0F, 3.0F, 3.0F, 1.0F, new CubeDeformation(0.2F)) |
| 38 | + .texOffs(24, 4).addBox(1.0F, -6.0F, -6.0F, 3.0F, 3.0F, 1.0F, new CubeDeformation(0.2F)), PartPose.offset(0.0F, 24.0F, 0.0F)); |
| 39 | + |
| 40 | + return LayerDefinition.create(meshdefinition, 32, 16); |
| 41 | + } |
| 42 | + |
| 43 | + public void copyHeadData(ModelPart head) { |
| 44 | + this.head.copyFrom(head); |
| 45 | + } |
| 46 | + |
| 47 | + @Override |
| 48 | + public void setupAnim( |
| 49 | + Entity entity, |
| 50 | + float limbSwing, |
| 51 | + float limbSwingAmount, |
| 52 | + float ageInTicks, |
| 53 | + float netHeadYaw, |
| 54 | + float headPitch |
| 55 | + ) {} |
| 56 | + |
| 57 | + @Override |
| 58 | + public void renderToBuffer( |
| 59 | + PoseStack poseStack, |
| 60 | + VertexConsumer buffer, |
| 61 | + int packedLight, |
| 62 | + int packedOverlay, |
| 63 | + int color |
| 64 | + ) { |
| 65 | + head.render( |
| 66 | + poseStack, |
| 67 | + buffer, |
| 68 | + packedLight, |
| 69 | + packedOverlay, |
| 70 | + color |
| 71 | + ); |
| 72 | + } |
| 73 | +} |
0 commit comments