-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tractors, fix scaled wheel rendering, add pineapple
- Loading branch information
1 parent
bdd61b1
commit 36488a9
Showing
21 changed files
with
276 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...a/io/github/foundationgames/automobility/automobile/render/frame/PineappleFrameModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.github.foundationgames.automobility.automobile.render.frame; | ||
|
||
import io.github.foundationgames.automobility.Automobility; | ||
import net.minecraft.client.model.*; | ||
import net.minecraft.client.render.RenderLayer; | ||
import net.minecraft.client.render.VertexConsumer; | ||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.minecraft.client.render.entity.model.EntityModelLayer; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.math.Vec3f; | ||
|
||
public class PineappleFrameModel extends Model { | ||
public static final EntityModelLayer MODEL_LAYER = new EntityModelLayer(Automobility.id("automobile/frame/pineapple"), "main"); | ||
|
||
private final ModelPart main; | ||
private final ModelPart stem; | ||
|
||
public PineappleFrameModel(EntityRendererFactory.Context ctx) { | ||
super(RenderLayer::getEntityCutout); | ||
this.main = ctx.getPart(MODEL_LAYER).getChild("main"); | ||
this.stem = this.main.getChild("stem"); | ||
setRotationAngle(stem, 0.0F, 0.0F, 0.0873F); | ||
} | ||
|
||
private void setRotationAngle(ModelPart bone, float x, float y, float z) { | ||
bone.pitch = x; | ||
bone.yaw = y; | ||
bone.roll = z; | ||
} | ||
|
||
public static TexturedModelData createModelData() { | ||
ModelData modelData = new ModelData(); | ||
ModelPartData root = modelData.getRoot(); | ||
ModelPartData partData = root.addChild("main", ModelPartBuilder.create().uv(0,0).cuboid(-4.0F, -8.0F, -5.0F, 8.0F, 7.0F, 0.0F).uv(0,11).cuboid(-4.5F, -8.0F, -4.5F, 9.0F, 8.0F, 9.0F), ModelTransform.pivot(0.0F,24.0F,0.0F)); | ||
partData.addChild("stem", ModelPartBuilder.create().uv(0,7).cuboid(-10.0F, -10.5F, -3.0F, 1.0F, 3.0F, 1.0F), ModelTransform.pivot(8.5F,0.5F,2.5F)); | ||
return TexturedModelData.of(modelData,64,32); | ||
} | ||
|
||
@Override | ||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { | ||
matrices.push(); | ||
matrices.translate(0, -1.5, 0); | ||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(90)); | ||
matrices.scale(2, 2, 2); | ||
this.main.render(matrices, vertices, light, overlay, red, green, blue, alpha); | ||
matrices.pop(); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...ava/io/github/foundationgames/automobility/automobile/render/frame/TractorFrameModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package io.github.foundationgames.automobility.automobile.render.frame; | ||
|
||
import io.github.foundationgames.automobility.Automobility; | ||
import net.minecraft.client.model.*; | ||
import net.minecraft.client.render.RenderLayer; | ||
import net.minecraft.client.render.VertexConsumer; | ||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.minecraft.client.render.entity.model.EntityModelLayer; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.math.Vec3f; | ||
|
||
public class TractorFrameModel extends Model { | ||
public static final EntityModelLayer MODEL_LAYER = new EntityModelLayer(Automobility.id("automobile/frame/tractor"), "main"); | ||
|
||
private final ModelPart main; | ||
private final ModelPart seat_back; | ||
private final ModelPart pipe_tip; | ||
private final ModelPart dashboard; | ||
|
||
public TractorFrameModel(EntityRendererFactory.Context ctx) { | ||
super(RenderLayer::getEntityCutout); | ||
this.main = ctx.getPart(MODEL_LAYER).getChild("main"); | ||
this.dashboard = this.main.getChild("dashboard"); | ||
this.pipe_tip = this.main.getChild("pipe_tip"); | ||
this.seat_back = this.main.getChild("seat_back"); | ||
setRotationAngle(seat_back, -1.8326F, 0.0F, 0.0F); | ||
setRotationAngle(pipe_tip, -0.1309F, 0.0F, 0.0F); | ||
setRotationAngle(dashboard, 0.5672F, 0.0F, 0.0F); | ||
} | ||
|
||
private void setRotationAngle(ModelPart bone, float x, float y, float z) { | ||
bone.pitch = x; | ||
bone.yaw = y; | ||
bone.roll = z; | ||
} | ||
|
||
public static TexturedModelData createModelData() { | ||
ModelData modelData = new ModelData(); | ||
ModelPartData root = modelData.getRoot(); | ||
ModelPartData partData = root.addChild("main", ModelPartBuilder.create().uv(0,0).cuboid(-4.0F, -13.0F, -19.0F, 8.0F, 9.0F, 15.0F).uv(0,24).cuboid(-7.0F, -8.0F, -4.0F, 14.0F, 7.0F, 12.0F).uv(31,9).cuboid(-1.0F, -17.0F, -16.0F, 2.0F, 4.0F, 2.0F).uv(0,0).cuboid(-1.0F, -4.0F, -16.0F, 2.0F, 5.0F, 2.0F).uv(0,43).cuboid(-3.0F, -9.0F, -3.0F, 6.0F, 1.0F, 7.0F).uv(26,43).cuboid(-5.0F, -8.0F, 8.0F, 10.0F, 6.0F, 4.0F).uv(0,0).cuboid(-1.0F, -9.0F, 5.0F, 1.0F, 1.0F, 1.0F), ModelTransform.pivot(0.0F,24.0F,0.0F)); | ||
partData.addChild("seat_back", ModelPartBuilder.create().uv(0,43).cuboid(-3.0F, -1.0F, -7.0F, 6.0F, 1.0F, 7.0F), ModelTransform.pivot(0.0F,-9.0F,3.0F)); | ||
partData.addChild("pipe_tip", ModelPartBuilder.create().uv(31,0).cuboid(-0.5F, -2.0F, 0.0F, 1.0F, 2.0F, 1.0F), ModelTransform.pivot(0.0F,-17.0F,-15.5F)); | ||
partData.addChild("dashboard", ModelPartBuilder.create().uv(31,0).cuboid(-2.0F, -3.0F, -5.0F, 4.0F, 3.0F, 5.0F), ModelTransform.pivot(0.0F,-13.0F,-4.0F)); | ||
return TexturedModelData.of(modelData,64,64); | ||
} | ||
|
||
@Override | ||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { | ||
matrices.push(); | ||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(90)); | ||
this.main.render(matrices, vertices, light, overlay, red, green, blue, alpha); | ||
matrices.pop(); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
...ava/io/github/foundationgames/automobility/automobile/render/wheel/TractorWheelModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package io.github.foundationgames.automobility.automobile.render.wheel; | ||
|
||
import io.github.foundationgames.automobility.Automobility; | ||
import net.minecraft.client.model.*; | ||
import net.minecraft.client.render.RenderLayer; | ||
import net.minecraft.client.render.VertexConsumer; | ||
import net.minecraft.client.render.entity.EntityRendererFactory; | ||
import net.minecraft.client.render.entity.model.EntityModelLayer; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.util.math.Vec3f; | ||
|
||
public class TractorWheelModel extends Model { | ||
public static final EntityModelLayer MODEL_LAYER = new EntityModelLayer(Automobility.id("automobile/wheel/tractor"), "main"); | ||
|
||
private final ModelPart main; | ||
private final ModelPart tire_8; | ||
private final ModelPart tire_7; | ||
private final ModelPart tire_6; | ||
private final ModelPart tire_5; | ||
private final ModelPart tire_4; | ||
private final ModelPart tire_3; | ||
private final ModelPart tire_2; | ||
|
||
public TractorWheelModel(EntityRendererFactory.Context ctx) { | ||
super(RenderLayer::getEntityCutout); | ||
this.main = ctx.getPart(MODEL_LAYER).getChild("main"); | ||
this.tire_2 = this.main.getChild("tire_2"); | ||
this.tire_3 = this.main.getChild("tire_3"); | ||
this.tire_4 = this.main.getChild("tire_4"); | ||
this.tire_5 = this.main.getChild("tire_5"); | ||
this.tire_6 = this.main.getChild("tire_6"); | ||
this.tire_7 = this.main.getChild("tire_7"); | ||
this.tire_8 = this.main.getChild("tire_8"); | ||
setRotationAngle(tire_8, -0.7854F, 0.0F, 0.0F); | ||
setRotationAngle(tire_7, -1.5708F, 0.0F, 0.0F); | ||
setRotationAngle(tire_6, -2.3562F, 0.0F, 0.0F); | ||
setRotationAngle(tire_5, 3.1416F, 0.0F, 0.0F); | ||
setRotationAngle(tire_4, 2.3562F, 0.0F, 0.0F); | ||
setRotationAngle(tire_3, 1.5708F, 0.0F, 0.0F); | ||
setRotationAngle(tire_2, 0.7854F, 0.0F, 0.0F); | ||
} | ||
|
||
private void setRotationAngle(ModelPart bone, float x, float y, float z) { | ||
bone.pitch = x; | ||
bone.yaw = y; | ||
bone.roll = z; | ||
} | ||
|
||
public static TexturedModelData createModelData() { | ||
ModelData modelData = new ModelData(); | ||
ModelPartData root = modelData.getRoot(); | ||
ModelPartData partData = root.addChild("main", ModelPartBuilder.create().uv(0,0).cuboid(0.0F, -2.0F, -1.5F, 3.0F, 2.0F, 3.0F).uv(0,5).cuboid(0.5F, -6.125F, -2.5F, 2.0F, 5.0F, 5.0F), ModelTransform.pivot(0.0F,24.0F,0.0F)); | ||
partData.addChild("tire_8", ModelPartBuilder.create().uv(0,0).cuboid(0.5F, 1.625F, -1.5F, 3.0F, 2.0F, 3.0F), ModelTransform.pivot(-0.5F,-3.625F,0.0F)); | ||
partData.addChild("tire_7", ModelPartBuilder.create().uv(0,0).cuboid(0.5F, 1.625F, -1.5F, 3.0F, 2.0F, 3.0F), ModelTransform.pivot(-0.5F,-3.625F,0.0F)); | ||
partData.addChild("tire_6", ModelPartBuilder.create().uv(0,0).cuboid(0.5F, 1.625F, -1.5F, 3.0F, 2.0F, 3.0F), ModelTransform.pivot(-0.5F,-3.625F,0.0F)); | ||
partData.addChild("tire_5", ModelPartBuilder.create().uv(0,0).cuboid(0.5F, 1.625F, -1.5F, 3.0F, 2.0F, 3.0F), ModelTransform.pivot(-0.5F,-3.625F,0.0F)); | ||
partData.addChild("tire_4", ModelPartBuilder.create().uv(0,0).cuboid(0.5F, 1.625F, -1.5F, 3.0F, 2.0F, 3.0F), ModelTransform.pivot(-0.5F,-3.625F,0.0F)); | ||
partData.addChild("tire_3", ModelPartBuilder.create().uv(0,0).cuboid(0.5F, 1.625F, -1.5F, 3.0F, 2.0F, 3.0F), ModelTransform.pivot(-0.5F,-3.625F,0.0F)); | ||
partData.addChild("tire_2", ModelPartBuilder.create().uv(0,0).cuboid(0.5F, 1.625F, -1.5F, 3.0F, 2.0F, 3.0F), ModelTransform.pivot(-0.5F,-3.625F,0.0F)); | ||
return TexturedModelData.of(modelData,16,16); | ||
} | ||
|
||
@Override | ||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { | ||
matrices.push(); | ||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(90)); | ||
main.render(matrices, vertices, light, overlay, red, green, blue, alpha); | ||
matrices.pop(); | ||
} | ||
} |
Oops, something went wrong.