Update MachineModel
This commit is contained in:
parent
3f2c68b85f
commit
ab013975b1
@ -5,25 +5,24 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
|
|||||||
import net.minecraft.client.model.Model;
|
import net.minecraft.client.model.Model;
|
||||||
import net.minecraft.client.model.geom.ModelPart;
|
import net.minecraft.client.model.geom.ModelPart;
|
||||||
import net.minecraft.client.model.geom.PartPose;
|
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;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
|
||||||
public class GiantArrowModel extends Model
|
public class GiantArrowModel extends Model {
|
||||||
{
|
|
||||||
protected final ModelPart cube_r0;
|
protected final ModelPart cube_r0;
|
||||||
protected final ModelPart cube_r1;
|
protected final ModelPart cube_r1;
|
||||||
protected final ModelPart cube_r2;
|
protected final ModelPart cube_r2;
|
||||||
|
|
||||||
public GiantArrowModel(ModelPart p_170945_)
|
public GiantArrowModel(ModelPart p_170945_) {
|
||||||
{
|
|
||||||
super(RenderType::entityTranslucent);
|
super(RenderType::entityTranslucent);
|
||||||
this.cube_r0 = p_170945_;
|
this.cube_r0 = p_170945_;
|
||||||
this.cube_r1 = p_170945_.getChild("cube_r1");
|
this.cube_r1 = p_170945_.getChild("cube_r1");
|
||||||
this.cube_r2 = p_170945_.getChild("cube_r2");
|
this.cube_r2 = p_170945_.getChild("cube_r2");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModelPart createModel()
|
public static ModelPart createModel() {
|
||||||
{
|
|
||||||
MeshDefinition meshdefinition = new MeshDefinition();
|
MeshDefinition meshdefinition = new MeshDefinition();
|
||||||
PartDefinition partdefinition = meshdefinition.getRoot();
|
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_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));
|
||||||
@ -32,14 +31,12 @@ public class GiantArrowModel extends Model
|
|||||||
return meshdefinition.getRoot().bake(64, 64);
|
return meshdefinition.getRoot().bake(64, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupAnim(float p_103811_, float p_103812_, float p_103813_)
|
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.yRot = p_103812_ * ((float)Math.PI / 180F);
|
this.cube_r0.xRot = p_103813_ * ((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_)
|
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_);
|
this.cube_r0.render(p_103815_, p_103816_, p_103817_, p_103818_, p_103819_, p_103820_, p_103821_, p_103822_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
package ru.magistu.siegemachines.client.renderer.model;
|
package ru.magistu.siegemachines.client.renderer.model;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
import ru.magistu.siegemachines.item.MachineItem;
|
import ru.magistu.siegemachines.item.MachineItem;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import software.bernie.geckolib.core.animatable.GeoAnimatable;
|
||||||
import software.bernie.geckolib3.core.IAnimatable;
|
import software.bernie.geckolib.model.GeoModel;
|
||||||
import software.bernie.geckolib3.model.AnimatedGeoModel;
|
|
||||||
|
|
||||||
|
public class MachineItemModel<T extends MachineItem & GeoAnimatable> extends GeoModel<T> {
|
||||||
public class MachineItemModel<T extends MachineItem & IAnimatable> extends AnimatedGeoModel<T>
|
|
||||||
{
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final ResourceLocation animationlocation;
|
public final ResourceLocation animationlocation;
|
||||||
public final ResourceLocation modellocation;
|
public final ResourceLocation modellocation;
|
||||||
public final ResourceLocation texturelocation;
|
public final ResourceLocation texturelocation;
|
||||||
|
|
||||||
public MachineItemModel(String name)
|
public MachineItemModel(String name) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/none.animation.json");
|
this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/none.animation.json");
|
||||||
this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + "_item.geo.json");
|
this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + "_item.geo.json");
|
||||||
@ -23,20 +20,17 @@ public class MachineItemModel<T extends MachineItem & IAnimatable> extends Anima
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getAnimationResource(T entity)
|
public ResourceLocation getAnimationResource(T entity) {
|
||||||
{
|
|
||||||
return this.animationlocation;
|
return this.animationlocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getModelResource(T entity)
|
public ResourceLocation getModelResource(T entity) {
|
||||||
{
|
|
||||||
return this.modellocation;
|
return this.modellocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getTextureResource(T entity)
|
public ResourceLocation getTextureResource(T entity) {
|
||||||
{
|
|
||||||
return this.texturelocation;
|
return this.texturelocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
package ru.magistu.siegemachines.client.renderer.model;
|
package ru.magistu.siegemachines.client.renderer.model;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import ru.magistu.siegemachines.SiegeMachines;
|
import ru.magistu.siegemachines.SiegeMachines;
|
||||||
import ru.magistu.siegemachines.entity.machine.Machine;
|
import ru.magistu.siegemachines.entity.machine.Machine;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import software.bernie.geckolib.core.animatable.GeoAnimatable;
|
||||||
import software.bernie.geckolib3.core.IAnimatable;
|
import software.bernie.geckolib.model.GeoModel;
|
||||||
import software.bernie.geckolib3.model.AnimatedGeoModel;
|
|
||||||
|
|
||||||
|
public class MachineModel<T extends Machine & GeoAnimatable> extends GeoModel<T> {
|
||||||
public class MachineModel<T extends Machine & IAnimatable> extends AnimatedGeoModel<T>
|
|
||||||
{
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final ResourceLocation animationlocation;
|
public final ResourceLocation animationlocation;
|
||||||
public final ResourceLocation modellocation;
|
public final ResourceLocation modellocation;
|
||||||
public final ResourceLocation texturelocation;
|
public final ResourceLocation texturelocation;
|
||||||
|
|
||||||
public MachineModel(String name)
|
public MachineModel(String name) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/" + this.name + ".animation.json");
|
this.animationlocation = new ResourceLocation(SiegeMachines.ID, "animations/" + this.name + ".animation.json");
|
||||||
this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + ".geo.json");
|
this.modellocation = new ResourceLocation(SiegeMachines.ID, "geo/" + this.name + ".geo.json");
|
||||||
@ -23,20 +20,17 @@ public class MachineModel<T extends Machine & IAnimatable> extends AnimatedGeoMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getAnimationResource(T entity)
|
public ResourceLocation getAnimationResource(T entity) {
|
||||||
{
|
|
||||||
return this.animationlocation;
|
return this.animationlocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getModelResource(T entity)
|
public ResourceLocation getModelResource(T entity) {
|
||||||
{
|
|
||||||
return this.modellocation;
|
return this.modellocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getTextureResource(T entity)
|
public ResourceLocation getTextureResource(T entity) {
|
||||||
{
|
|
||||||
return this.texturelocation;
|
return this.texturelocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user