From ab013975b1980f0569175bfd0376208a063ee2a9 Mon Sep 17 00:00:00 2001 From: Vecoo Date: Tue, 4 Mar 2025 22:08:11 +1100 Subject: [PATCH] Update MachineModel --- .../renderer/model/GiantArrowModel.java | 57 +++++++++---------- .../renderer/model/MachineItemModel.java | 54 ++++++++---------- .../client/renderer/model/MachineModel.java | 54 ++++++++---------- 3 files changed, 75 insertions(+), 90 deletions(-) diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/model/GiantArrowModel.java b/src/main/java/ru/magistu/siegemachines/client/renderer/model/GiantArrowModel.java index 036c5a7..5521ece 100644 --- a/src/main/java/ru/magistu/siegemachines/client/renderer/model/GiantArrowModel.java +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/model/GiantArrowModel.java @@ -5,41 +5,38 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.model.Model; import net.minecraft.client.model.geom.ModelPart; import net.minecraft.client.model.geom.PartPose; -import net.minecraft.client.model.geom.builders.*; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.minecraft.client.renderer.RenderType; -public class GiantArrowModel extends Model -{ - protected final ModelPart cube_r0; - protected final ModelPart cube_r1; - protected final ModelPart cube_r2; +public class GiantArrowModel extends Model { + protected final ModelPart cube_r0; + protected final ModelPart cube_r1; + protected final ModelPart cube_r2; - public GiantArrowModel(ModelPart p_170945_) - { - super(RenderType::entityTranslucent); - this.cube_r0 = p_170945_; - this.cube_r1 = p_170945_.getChild("cube_r1"); - this.cube_r2 = p_170945_.getChild("cube_r2"); - } + public GiantArrowModel(ModelPart p_170945_) { + super(RenderType::entityTranslucent); + this.cube_r0 = p_170945_; + this.cube_r1 = p_170945_.getChild("cube_r1"); + this.cube_r2 = p_170945_.getChild("cube_r2"); + } - public static ModelPart createModel() - { - MeshDefinition meshdefinition = new MeshDefinition(); - PartDefinition partdefinition = meshdefinition.getRoot(); - partdefinition.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(15, 0).addBox(-2.0F, 0.0F, -10.0F, 4.0F, 0.0F, 4.0F).texOffs(-34, 0).addBox(-2.5F, 0.0F, -7.0F, 5.0F, 0.0F, 34.0F), PartPose.rotation(0.0F, 0.0F, -0.7854F)); - partdefinition.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(7, 0).addBox(-2.0F, 0.0F, -10.0F, 4.0F, 0.0F, 4.0F).texOffs(-34, 0).addBox(-2.5F, 0.0F, -7.0F, 5.0F, 0.0F, 34.0F), PartPose.rotation(0.0F, 0.0F, 0.7854F)); + public static ModelPart createModel() { + MeshDefinition meshdefinition = new MeshDefinition(); + PartDefinition partdefinition = meshdefinition.getRoot(); + partdefinition.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(15, 0).addBox(-2.0F, 0.0F, -10.0F, 4.0F, 0.0F, 4.0F).texOffs(-34, 0).addBox(-2.5F, 0.0F, -7.0F, 5.0F, 0.0F, 34.0F), PartPose.rotation(0.0F, 0.0F, -0.7854F)); + partdefinition.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(7, 0).addBox(-2.0F, 0.0F, -10.0F, 4.0F, 0.0F, 4.0F).texOffs(-34, 0).addBox(-2.5F, 0.0F, -7.0F, 5.0F, 0.0F, 34.0F), PartPose.rotation(0.0F, 0.0F, 0.7854F)); - return meshdefinition.getRoot().bake(64, 64); - } + return meshdefinition.getRoot().bake(64, 64); + } - public void setupAnim(float p_103811_, float p_103812_, float p_103813_) - { - this.cube_r0.yRot = p_103812_ * ((float)Math.PI / 180F); - this.cube_r0.xRot = p_103813_ * ((float)Math.PI / 180F); - } + public void setupAnim(float p_103811_, float p_103812_, float p_103813_) { + this.cube_r0.yRot = p_103812_ * ((float) Math.PI / 180F); + this.cube_r0.xRot = p_103813_ * ((float) Math.PI / 180F); + } - public void renderToBuffer(PoseStack p_103815_, VertexConsumer p_103816_, int p_103817_, int p_103818_, float p_103819_, float p_103820_, float p_103821_, float p_103822_) - { - this.cube_r0.render(p_103815_, p_103816_, p_103817_, p_103818_, p_103819_, p_103820_, p_103821_, p_103822_); - } + public void renderToBuffer(PoseStack p_103815_, VertexConsumer p_103816_, int p_103817_, int p_103818_, float p_103819_, float p_103820_, float p_103821_, float p_103822_) { + this.cube_r0.render(p_103815_, p_103816_, p_103817_, p_103818_, p_103819_, p_103820_, p_103821_, p_103822_); + } } diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineItemModel.java b/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineItemModel.java index 55fac2c..bcc6ea0 100644 --- a/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineItemModel.java +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineItemModel.java @@ -1,42 +1,36 @@ package ru.magistu.siegemachines.client.renderer.model; +import net.minecraft.resources.ResourceLocation; import ru.magistu.siegemachines.SiegeMachines; import ru.magistu.siegemachines.item.MachineItem; -import net.minecraft.resources.ResourceLocation; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.model.AnimatedGeoModel; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.model.GeoModel; - -public class MachineItemModel extends AnimatedGeoModel -{ +public class MachineItemModel extends GeoModel { public final String name; - public final ResourceLocation animationlocation; - public final ResourceLocation modellocation; - public final ResourceLocation texturelocation; + public final ResourceLocation animationlocation; + public final ResourceLocation modellocation; + public final ResourceLocation texturelocation; - public MachineItemModel(String name) - { - this.name = name; - this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/none.animation.json"); - this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + "_item.geo.json"); - this.texturelocation = new ResourceLocation(SiegeMachines.ID, "textures/entity/" + this.name + ".png"); - } + public MachineItemModel(String name) { + this.name = name; + this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/none.animation.json"); + this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + "_item.geo.json"); + this.texturelocation = new ResourceLocation(SiegeMachines.ID, "textures/entity/" + this.name + ".png"); + } @Override - public ResourceLocation getAnimationResource(T entity) - { - return this.animationlocation; - } + public ResourceLocation getAnimationResource(T entity) { + return this.animationlocation; + } - @Override - public ResourceLocation getModelResource(T entity) - { - return this.modellocation; - } + @Override + public ResourceLocation getModelResource(T entity) { + return this.modellocation; + } - @Override - public ResourceLocation getTextureResource(T entity) - { - return this.texturelocation; - } + @Override + public ResourceLocation getTextureResource(T entity) { + return this.texturelocation; + } } diff --git a/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineModel.java b/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineModel.java index 6464eeb..f81b286 100644 --- a/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineModel.java +++ b/src/main/java/ru/magistu/siegemachines/client/renderer/model/MachineModel.java @@ -1,42 +1,36 @@ package ru.magistu.siegemachines.client.renderer.model; +import net.minecraft.resources.ResourceLocation; import ru.magistu.siegemachines.SiegeMachines; import ru.magistu.siegemachines.entity.machine.Machine; -import net.minecraft.resources.ResourceLocation; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.model.AnimatedGeoModel; +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.model.GeoModel; - -public class MachineModel extends AnimatedGeoModel -{ +public class MachineModel extends GeoModel { public final String name; - public final ResourceLocation animationlocation; - public final ResourceLocation modellocation; - public final ResourceLocation texturelocation; + public final ResourceLocation animationlocation; + public final ResourceLocation modellocation; + public final ResourceLocation texturelocation; - public MachineModel(String name) - { - this.name = name; - this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/" + this.name + ".animation.json"); - this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + ".geo.json"); - this.texturelocation = new ResourceLocation(SiegeMachines.ID, "textures/entity/" + this.name + ".png"); - } + public MachineModel(String name) { + this.name = name; + this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/" + this.name + ".animation.json"); + this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + ".geo.json"); + this.texturelocation = new ResourceLocation(SiegeMachines.ID, "textures/entity/" + this.name + ".png"); + } @Override - public ResourceLocation getAnimationResource(T entity) - { - return this.animationlocation; - } + public ResourceLocation getAnimationResource(T entity) { + return this.animationlocation; + } - @Override - public ResourceLocation getModelResource(T entity) - { - return this.modellocation; - } + @Override + public ResourceLocation getModelResource(T entity) { + return this.modellocation; + } - @Override - public ResourceLocation getTextureResource(T entity) - { - return this.texturelocation; - } + @Override + public ResourceLocation getTextureResource(T entity) { + return this.texturelocation; + } }