Skip to content

Commit

Permalink
Pathfinder Shell (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
CommandrMoose authored Mar 27, 2024
1 parent dcc2c9c commit 651d6f8
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class ModelRegistry {
public static ModelLayerLocation LIFT_SHELL;
public static ModelLayerLocation HIEROGLYPH_SHELL;
public static ModelLayerLocation CASTLE_SHELL;
public static ModelLayerLocation PATHFINDER_SHELL;


public static ModelLayerLocation ROOT_SHELL_DOOR;
Expand All @@ -72,6 +73,7 @@ public class ModelRegistry {
public static ModelLayerLocation LIFT_DOOR;
public static ModelLayerLocation HIEROGLYPH_DOOR;
public static ModelLayerLocation CASTLE_DOOR;
public static ModelLayerLocation PATHFINDER_DOOR;


public static ModelLayerLocation ARS_EGG;
Expand Down Expand Up @@ -114,6 +116,7 @@ public static void init() {
LIFT_SHELL = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "lift_shell"), "lift_shell"), LiftShellModel::createBodyLayer);
HIEROGLYPH_SHELL = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "hieroglyph_shell"), "hieroglyph_shell"), HieroglyphModel::createBodyLayer);
CASTLE_SHELL = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "castle_shell"), "castle_shell"), CastleShellModel::createBodyLayer);
PATHFINDER_SHELL = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "pathfinder_shell"), "pathfinder_shell"), PathfinderShellModel::createBodyLayer);


ROOT_SHELL_DOOR = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "root_shell_door"), "root_shell_door"), RootShellDoorModel::createBodyLayer);
Expand All @@ -134,7 +137,7 @@ public static void init() {
LIFT_DOOR = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "lift_door"), "lift_door"), LiftShellDoorModel::createBodyLayer);
HIEROGLYPH_DOOR = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "hieroglyph_door"), "hieroglyph_door"), HieroglyphShellDoor::createBodyLayer);
CASTLE_DOOR = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "castle_door"), "castle_door"), CastleShellDoorModel::createBodyLayer);

PATHFINDER_DOOR = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "pathfinder_door"), "pathfinder_door"), PathfinderShellModel::createBodyLayer);

ARS_EGG = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "ars_egg"), "ars_egg"), ArsEggModel::createBodyLayer);
BULK_HEAD_DOOR = register(new ModelLayerLocation(new ResourceLocation(TardisRefined.MODID, "bulk_head_door"), "bulk_head_door"), BulkHeadDoorModel::createBodyLayer);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package whocraft.tardis_refined.client.model.blockentity.door.interior;// Made with Blockbench 4.9.4
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports


import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.world.entity.Entity;
import whocraft.tardis_refined.client.model.blockentity.shell.ShellModel;
import whocraft.tardis_refined.common.blockentity.door.GlobalDoorBlockEntity;
import whocraft.tardis_refined.common.blockentity.shell.GlobalShellBlockEntity;

public class PathfinderDoorModel extends ShellDoorModel {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor

private final ModelPart root;
private final ModelPart bone3;
private final ModelPart r_door;
private final ModelPart l_door;
private final ModelPart bb_main;

public PathfinderDoorModel(ModelPart root) {
this.root = root;
this.bone3 = root.getChild("bone3");
this.r_door = root.getChild("r_door");
this.l_door = root.getChild("l_door");
this.bb_main = root.getChild("bb_main");
}

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

PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(47, 19).addBox(-10.0F, -54.0F, 2.775F, 19.0F, 4.0F, 4.0F, new CubeDeformation(0.025F))
.texOffs(27, 36).addBox(-12.0F, -50.0F, 3.025F, 23.0F, 8.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(47, 0).addBox(-12.0F, -50.0F, 4.025F, 23.0F, 8.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.5F, 29.0F, 1.25F));

PartDefinition cube_r1 = bone3.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(46, 47).mirror().addBox(-4.0F, -14.0F, -1.975F, 4.0F, 14.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(15.9565F, -41.351F, 4.75F, 0.0F, 0.0F, -0.5236F));

PartDefinition cube_r2 = bone3.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(46, 47).addBox(0.0F, -14.0F, -1.975F, 4.0F, 14.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-16.9565F, -41.351F, 4.75F, 0.0F, 0.0F, 0.5236F));

PartDefinition r_door = partdefinition.addOrReplaceChild("r_door", CubeListBuilder.create().texOffs(0, 36).addBox(-10.0F, -18.0F, -1.0F, 11.0F, 34.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(10.0F, 8.0F, 6.75F));

PartDefinition cube_r3 = r_door.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(47, 28).addBox(-2.5F, 0.0F, 0.0F, 5.0F, 5.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-6.5F, 0.0F, -1.0F, -0.2618F, 0.0F, -0.2618F));

PartDefinition l_door = partdefinition.addOrReplaceChild("l_door", CubeListBuilder.create().texOffs(0, 36).mirror().addBox(-1.0F, -18.0F, -1.0F, 11.0F, 34.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-10.0F, 8.0F, 6.75F));

PartDefinition cube_r4 = l_door.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(47, 28).addBox(-2.5F, 0.0F, 0.0F, 5.0F, 5.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(6.5F, 0.0F, -1.0F, -0.2618F, 0.0F, 0.2618F));

PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(27, 47).addBox(-16.0F, -34.0F, 4.0F, 5.0F, 34.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(58, 61).addBox(-17.0F, -37.0F, 3.0F, 7.0F, 3.0F, 5.0F, new CubeDeformation(0.0F))
.texOffs(47, 11).addBox(-10.0F, -37.0F, 4.0F, 20.0F, 3.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(58, 61).mirror().addBox(10.0F, -37.0F, 3.0F, 7.0F, 3.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(27, 47).mirror().addBox(11.0F, -34.0F, 4.0F, 5.0F, 34.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(0, 0).addBox(-11.0F, -34.025F, 7.0F, 22.0F, 34.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));

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

@Override
public void renderInteriorDoor(GlobalDoorBlockEntity doorBlockEntity, boolean open, boolean isBaseModel, PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
bone3.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
l_door.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
r_door.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
bb_main.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);
}

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

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

}

@Override
public void setDoorPosition(boolean open) {
this.l_door.yRot = (open) ? -275f : 0;
this.r_door.yRot = (open) ? 275f : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public class ShellModelCollection {

private static ShellModel factoryShellModel, policeBoxModel, phoneBoothModel, mysticModel, drifterModel,
presentModel, vendingModel, briefcaseModel, groeningModel, bigBenModel, nukaModel, growthModel,
portalooModel, pagodaModel, liftModel, hieroglyphModel, castleShellModel;
portalooModel, pagodaModel, liftModel, hieroglyphModel, castleShellModel, pathfinderShellModel;

private static ShellDoorModel factoryDoorModel, policeBoxDoorModel, phoneBoothDoorModel, mysticDoorModel, drifterDoorModel, presentDoorModel, vendingDoorModel, briefcaseDoorModel,
groeningDoorModel, bigBenDoorModel, nukaDoorModel, growthDoorModel, portalooDoorModel, pagodaDoorModel, liftDoorModel, hieroglyphDoorModel, castleDoorModel;
groeningDoorModel, bigBenDoorModel, nukaDoorModel, growthDoorModel, portalooDoorModel, pagodaDoorModel, liftDoorModel, hieroglyphDoorModel, castleDoorModel, pathfinderDoorModel;

public static Map<ResourceLocation, ShellEntry> SHELL_MODELS = new HashMap<>();

Expand Down Expand Up @@ -49,6 +49,7 @@ public void registerModels(EntityModelSet context){
liftModel = new LiftShellModel(context.bakeLayer((ModelRegistry.LIFT_SHELL)));
hieroglyphModel = new HieroglyphModel(context.bakeLayer((ModelRegistry.HIEROGLYPH_SHELL)));
castleShellModel = new CastleShellModel(context.bakeLayer((ModelRegistry.CASTLE_SHELL)));
pathfinderShellModel = new PathfinderShellModel(context.bakeLayer((ModelRegistry.PATHFINDER_SHELL)));

// Doors
factoryDoorModel = new FactoryDoorModel(context.bakeLayer((ModelRegistry.FACTORY_DOOR)));
Expand All @@ -68,6 +69,7 @@ public void registerModels(EntityModelSet context){
liftDoorModel = new LiftShellDoorModel(context.bakeLayer((ModelRegistry.LIFT_DOOR)));
hieroglyphDoorModel = new HieroglyphShellDoor(context.bakeLayer((ModelRegistry.HIEROGLYPH_DOOR)));
castleDoorModel = new CastleShellDoorModel(context.bakeLayer((ModelRegistry.CASTLE_DOOR)));
pathfinderDoorModel = new PathfinderDoorModel(context.bakeLayer((ModelRegistry.PATHFINDER_DOOR)));

TardisEvents.SHELLENTRY_MODELS_SETUP.invoker().setUpShellAndInteriorModels(context);

Expand All @@ -88,6 +90,7 @@ public void registerModels(EntityModelSet context){
registerShellEntry(ShellTheme.LIFT.get(), liftModel, liftDoorModel);
registerShellEntry(ShellTheme.HIEROGLYPH.get(), hieroglyphModel, hieroglyphDoorModel);
registerShellEntry(ShellTheme.CASTLE.get(), castleShellModel, castleDoorModel);
registerShellEntry(ShellTheme.PATHFINDER.get(), pathfinderShellModel, pathfinderDoorModel);
}

public static void registerShellEntry(ShellTheme theme, ShellModel shellModel, ShellDoorModel shellDoorModel){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package whocraft.tardis_refined.client.model.blockentity.shell.shells;// Made with Blockbench 4.9.4
// Exported for Minecraft version 1.17 or later with Mojang mappings
// Paste this class into your mod and generate all required imports


import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.world.entity.Entity;
import whocraft.tardis_refined.client.model.blockentity.shell.ShellModel;
import whocraft.tardis_refined.common.blockentity.shell.GlobalShellBlockEntity;

public class PathfinderShellModel extends ShellModel {
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor

private final ModelPart root;
private final ModelPart bone3;
private final ModelPart r_door;
private final ModelPart l_door;
private final ModelPart bb_main;

public PathfinderShellModel(ModelPart root) {
super(root);
this.root = root;
this.bone3 = root.getChild("bone3");
this.r_door = root.getChild("r_door");
this.l_door = root.getChild("l_door");
this.bb_main = root.getChild("bb_main");
}

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

PartDefinition bone3 = partdefinition.addOrReplaceChild("bone3", CubeListBuilder.create().texOffs(47, 19).addBox(-10.0F, -54.0F, 2.775F, 19.0F, 4.0F, 4.0F, new CubeDeformation(0.025F))
.texOffs(27, 36).addBox(-12.0F, -50.0F, 3.025F, 23.0F, 8.0F, 2.0F, new CubeDeformation(0.0F))
.texOffs(47, 0).addBox(-12.0F, -50.0F, 4.025F, 23.0F, 8.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.5F, 29.0F, 1.25F));

PartDefinition cube_r1 = bone3.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(46, 47).mirror().addBox(-4.0F, -14.0F, -1.975F, 4.0F, 14.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(15.9565F, -41.351F, 4.75F, 0.0F, 0.0F, -0.5236F));

PartDefinition cube_r2 = bone3.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(46, 47).addBox(0.0F, -14.0F, -1.975F, 4.0F, 14.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-16.9565F, -41.351F, 4.75F, 0.0F, 0.0F, 0.5236F));

PartDefinition r_door = partdefinition.addOrReplaceChild("r_door", CubeListBuilder.create().texOffs(0, 36).addBox(-10.0F, -18.0F, -1.0F, 11.0F, 34.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(10.0F, 8.0F, 6.75F));

PartDefinition cube_r3 = r_door.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(47, 28).addBox(-2.5F, 0.0F, 0.0F, 5.0F, 5.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-6.5F, 0.0F, -1.0F, -0.2618F, 0.0F, -0.2618F));

PartDefinition l_door = partdefinition.addOrReplaceChild("l_door", CubeListBuilder.create().texOffs(0, 36).mirror().addBox(-1.0F, -18.0F, -1.0F, 11.0F, 34.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-10.0F, 8.0F, 6.75F));

PartDefinition cube_r4 = l_door.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(47, 28).addBox(-2.5F, 0.0F, 0.0F, 5.0F, 5.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(6.5F, 0.0F, -1.0F, -0.2618F, 0.0F, 0.2618F));

PartDefinition bb_main = partdefinition.addOrReplaceChild("bb_main", CubeListBuilder.create().texOffs(27, 47).addBox(-16.0F, -34.0F, 4.0F, 5.0F, 34.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(58, 61).addBox(-17.0F, -37.0F, 3.0F, 7.0F, 3.0F, 5.0F, new CubeDeformation(0.0F))
.texOffs(47, 11).addBox(-10.0F, -37.0F, 4.0F, 20.0F, 3.0F, 4.0F, new CubeDeformation(0.0F))
.texOffs(58, 61).mirror().addBox(10.0F, -37.0F, 3.0F, 7.0F, 3.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(27, 47).mirror().addBox(11.0F, -34.0F, 4.0F, 5.0F, 34.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false)
.texOffs(0, 0).addBox(-11.0F, -34.025F, 7.0F, 22.0F, 34.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F));

addMaterializationPart(partdefinition);

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

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

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

}

@Override
public void setDoorPosition(boolean open) {
this.l_door.yRot = (open) ? -275f : 0;
this.r_door.yRot = (open) ? 275f : 0;
}

@Override
public void renderShell(GlobalShellBlockEntity entity, boolean open, boolean isBaseModel, PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
if (isBaseModel) {
poseStack.scale(1.05f, 1.05f, 1.05f);
poseStack.translate(0, -0.07, 0);
}
handleAllAnimations(entity,bone3,isBaseModel, open, poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha);

bone3.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, this.getCurrentAlpha());
l_door.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, this.getCurrentAlpha());
r_door.render(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, this.getCurrentAlpha());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class ShellTheme implements Theme {
public static final RegistrySupplierHolder<ShellTheme, ShellTheme> LIFT = registerShellTheme("lift");
public static final RegistrySupplierHolder<ShellTheme, ShellTheme> HIEROGLYPH = registerShellTheme("hieroglyph");
public static final RegistrySupplierHolder<ShellTheme, ShellTheme> CASTLE = registerShellTheme("castle");
public static final RegistrySupplierHolder<ShellTheme, ShellTheme> PATHFINDER = registerShellTheme("pathfinder");


public static ShellTheme getShellTheme(ResourceLocation resourceLocation){
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ protected void addTranslations() {
addShell(ShellTheme.LIFT.getId(), "Lift");
addShell(ShellTheme.HIEROGLYPH.getId(), "Hieroglyph");
addShell(ShellTheme.CASTLE.getId(), "Castle");
addShell(ShellTheme.PATHFINDER.getId(), "Pathfinder");

/*Tool Tips*/
add(ModMessages.TOOLTIP_TARDIS_LIST_TITLE, "Key Set:");
Expand Down

0 comments on commit 651d6f8

Please sign in to comment.