Skip to content

Commit

Permalink
Model changes 1.20.2 (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeryn99 authored Dec 11, 2024
1 parent 6d4ff7b commit 4498590
Show file tree
Hide file tree
Showing 72 changed files with 1,196 additions and 70,906 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
- Enhancement: Speed up downwards descent for Gravity Shaft
- Enhancement: Improved UI for Gravity Shaft
- Enhancement: Colored various texts on Key item
- Enhancement: Alarm now sounds when Fuel is below 5% and the TARDIS is not fueling+
- Enhancement: Bulkhead doors now have some variants, changed via the Pattern Manipulator
- Enhancement: Alarm now sounds when Fuel is below 5% and the TARDIS is not fueling

#### Additions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
public class JsonToAnimationDefinition {

public static ModelPart findPart(HierarchicalModel hierarchicalModel, String string) {
System.out.println(string + " " + hierarchicalModel.getClass());
return hierarchicalModel.root().getAllParts().filter((modelPart) -> modelPart.hasChild(string)).findFirst().map((modelPart) -> modelPart.getChild(string)).get();
}

Expand Down
153 changes: 75 additions & 78 deletions common/src/main/java/whocraft/tardis_refined/client/ModelRegistry.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,10 @@ public class BulkHeadDoorModel extends HierarchicalModel {

public BulkHeadDoorModel(ModelPart root) {
this.root = root.getChild("root");
this.right = this.root.getChild("right");
this.left = this.root.getChild("left");
this.right = this.root.getChild("right_door");
this.left = this.root.getChild("left_door");
}

public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();

PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 16.0F));

PartDefinition right = root.addOrReplaceChild("right", CubeListBuilder.create().texOffs(64, 54).addBox(0.0F, -48.0F, -19.0F, 24.0F, 48.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(0, 56).addBox(0.0F, -48.0F, -20.0F, 24.0F, 48.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));

PartDefinition left = root.addOrReplaceChild("left", CubeListBuilder.create().texOffs(64, 0).addBox(-24.0F, -48.0F, -19.0F, 24.0F, 48.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(0, 0).addBox(-24.0F, -48.0F, -20.0F, 24.0F, 48.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));

return LayerDefinition.create(meshdefinition, 128, 128);
}


@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
root.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,29 @@
import whocraft.tardis_refined.compat.ModCompatChecker;
import whocraft.tardis_refined.compat.portals.ImmersivePortalsClient;

public class LeftRightInteriorDoorModel extends ShellDoorModel {
public class DualInteriorDoorModel extends ShellDoorModel {

private final ModelPart root;
public final ModelPart leftDoor;
public final ModelPart rightDoor;
private final ModelPart portal;
private final ModelPart frame;
private final float openAmount;
private final boolean openLeft, openRight;

public LeftRightInteriorDoorModel(ModelPart root, float openAmount) {
public DualInteriorDoorModel(ModelPart root, float openAmount) {
this(root, openAmount, true, true);
}

public DualInteriorDoorModel(ModelPart root, float openAmount, boolean openLeft, boolean openRight) {
this.root = root;
this.leftDoor = JsonToAnimationDefinition.findPart(this, "left_door");
this.frame = JsonToAnimationDefinition.findPart(this, "frame");
this.rightDoor = JsonToAnimationDefinition.findPart(this, "right_door");
this.portal = JsonToAnimationDefinition.findPart(this, "portal");
this.openAmount = openAmount;
this.openLeft = openLeft;
this.openRight = openRight;
}


Expand Down Expand Up @@ -76,8 +83,8 @@ public void setupAnim(Entity entity, float f, float g, float h, float i, float j
@Override
public void setDoorPosition(boolean open) {
if (open) {
this.leftDoor.yRot = -openAmount;
this.rightDoor.yRot = openAmount;
this.leftDoor.yRot = openLeft ? -openAmount : 0;
this.rightDoor.yRot = openRight ? openAmount : 0;
} else {
this.leftDoor.yRot = 0;
this.rightDoor.yRot = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package whocraft.tardis_refined.client.model.blockentity.door.interior;


import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import dev.jeryn.anim.tardis.JsonToAnimationDefinition;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.world.entity.Entity;
import whocraft.tardis_refined.common.blockentity.door.GlobalDoorBlockEntity;
import whocraft.tardis_refined.compat.ModCompatChecker;
import whocraft.tardis_refined.compat.portals.ImmersivePortalsClient;

public class DualTexInteriorDoorModel extends ShellDoorModel {

private final ModelPart root;
public final ModelPart open_door;
public final ModelPart closed_door;
private final ModelPart portal;
private final ModelPart frame;

public DualTexInteriorDoorModel(ModelPart root) {
this.root = root;
this.open_door = JsonToAnimationDefinition.findPart(this, "door_open");
this.closed_door = JsonToAnimationDefinition.findPart(this, "door_closed");
this.frame = JsonToAnimationDefinition.findPart(this, "frame");
this.portal = JsonToAnimationDefinition.findPart(this, "portal");
}


@Override
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
this.root().getAllParts().forEach(ModelPart::resetPose);
this.portal.visible = false;
this.root().render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}

@Override
public void renderFrame(GlobalDoorBlockEntity doorBlockEntity, boolean open, boolean isBaseModel, PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
this.root().getAllParts().forEach(ModelPart::resetPose);
setDoorPosition(open);
this.root().getAllParts().forEach(modelPart -> {
modelPart.visible = true;
});
this.portal.visible = false;
closed_door.visible = !open;
open_door.visible = open;
this.root().render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}

@Override
public void renderPortalMask(GlobalDoorBlockEntity doorBlockEntity, boolean open, boolean isBaseModel, PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {

if (ModCompatChecker.immersivePortals()) {
if (ImmersivePortalsClient.shouldStopRenderingInPortal()) {
return;
}
}

this.root().getAllParts().forEach(ModelPart::resetPose);
setDoorPosition(open);
this.root().getAllParts().forEach(modelPart -> modelPart.visible = false);
this.portal.visible = true;
portal.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}

@Override
public ModelPart root() {
return root;
}

@Override
public void setupAnim(Entity entity, float f, float g, float h, float i, float j) {

}

@Override
public void setDoorPosition(boolean open) {
// No OP
}

}
Loading

0 comments on commit 4498590

Please sign in to comment.