Skip to content

Instantly share code, notes, and snippets.

@fadookie
Last active June 15, 2020 03:57
Show Gist options
  • Save fadookie/a89d8230164e4a332eb8d5253ec181f1 to your computer and use it in GitHub Desktop.
Save fadookie/a89d8230164e4a332eb8d5253ec181f1 to your computer and use it in GitHub Desktop.
Blockbench to fabric export
package com.eliotlash.stormlight;
// Made with Blockbench 3.5.4
// Exported for Minecraft version 1.15
// Paste this class into your mod and generate all required imports
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.math.MatrixStack;
public class spren1 extends EntityModel<CubeEntity> {
private final ModelPart bone;
private final ModelPart bone2;
private final ModelPart bone3;
private final ModelPart bone4;
public spren1() {
textureWidth = 16;
textureHeight = 16;
bone = new ModelPart(this);
bone.setPivot(0.0F, 24.0F, 0.0F);
bone.setTextureOffset(0, 0).addCuboid(-1.0F, -1.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone.setTextureOffset(0, 0).addCuboid(-2.0F, -2.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone.setTextureOffset(0, 0).addCuboid(-3.0F, -3.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone.setTextureOffset(0, 0).addCuboid(-4.0F, -4.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone2 = new ModelPart(this);
bone2.setPivot(0.0F, 24.0F, 1.0F);
setRotationAngle(bone2, 0.0F, 3.1416F, 0.0F);
bone2.setTextureOffset(0, 0).addCuboid(-1.0F, -1.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone2.setTextureOffset(0, 0).addCuboid(-2.0F, -2.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone2.setTextureOffset(0, 0).addCuboid(-3.0F, -3.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone2.setTextureOffset(0, 0).addCuboid(-4.0F, -4.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone3 = new ModelPart(this);
bone3.setPivot(0.0F, 24.0F, 1.0F);
setRotationAngle(bone3, 0.0F, 3.1416F, -3.1416F);
bone3.setTextureOffset(0, 0).addCuboid(-1.0F, -1.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone3.setTextureOffset(0, 0).addCuboid(-2.0F, -2.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone3.setTextureOffset(0, 0).addCuboid(-3.0F, -3.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone3.setTextureOffset(0, 0).addCuboid(-4.0F, -4.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone4 = new ModelPart(this);
bone4.setPivot(0.0F, 24.0F, 1.0F);
setRotationAngle(bone4, 0.0F, 3.1416F, 1.5708F);
bone4.setTextureOffset(0, 0).addCuboid(-1.0F, -1.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone4.setTextureOffset(0, 0).addCuboid(-2.0F, -2.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone4.setTextureOffset(0, 0).addCuboid(-3.0F, -3.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
bone4.setTextureOffset(0, 0).addCuboid(-4.0F, -4.0F, 0.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
}
@Override
public void setAngles(CubeEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){
//previously the render function, render code was moved to a method below
}
@Override
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
bone.render(matrixStack, buffer, packedLight, packedOverlay);
bone2.render(matrixStack, buffer, packedLight, packedOverlay);
bone3.render(matrixStack, buffer, packedLight, packedOverlay);
bone4.render(matrixStack, buffer, packedLight, packedOverlay);
}
public void setRotationAngle(ModelPart modelRenderer, float x, float y, float z) {
modelRenderer.pivotX = x;
modelRenderer.pivotY = y;
modelRenderer.pivotZ = z;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment