Update MachineModel
This commit is contained in:
parent
3f2c68b85f
commit
ab013975b1
@ -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_);
|
||||
}
|
||||
}
|
||||
|
@ -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<T extends MachineItem & IAnimatable> extends AnimatedGeoModel<T>
|
||||
{
|
||||
public class MachineItemModel<T extends MachineItem & GeoAnimatable> extends GeoModel<T> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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<T extends Machine & IAnimatable> extends AnimatedGeoModel<T>
|
||||
{
|
||||
public class MachineModel<T extends Machine & GeoAnimatable> extends GeoModel<T> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user