Skip to content

Commit

Permalink
feat: add anbu armor
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Jul 12, 2022
1 parent a61fb07 commit dce00f2
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,321 @@
package com.sekwah.narutomod.client.model.item.model;

import com.sekwah.narutomod.NarutoMod;
import com.sekwah.sekclib.util.ModelUtils;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
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.LivingEntity;
import net.minecraft.resources.ResourceLocation;

public class AnbuArmorModel<T extends LivingEntity> extends HumanoidModel<T>
{

public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(new ResourceLocation(NarutoMod.MOD_ID, "anbu_armor"), "main");

public AnbuArmorModel(ModelPart modelPart) {
super(modelPart);
}

// Grab the parts in the constructor if you need them

public static LayerDefinition createLayer() {
//MeshDefinition definition = new MeshDefinition();
MeshDefinition definition = ModelUtils.createBlankHumanoidMesh();
PartDefinition root = definition.getRoot();

PartDefinition body = root.addOrReplaceChild("body",
CubeListBuilder.create()
.texOffs(16, 16)
.addBox(-4, 0, -2, 8, 6, 4),
PartPose.ZERO);

body.addOrReplaceChild("armor2",
CubeListBuilder.create()
.texOffs(40, 50)
.addBox(-4, 1.9F, -2.2F, 8, 4, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor23",
CubeListBuilder.create()
.texOffs(100, 12)
.addBox(-3.8F, -0.1F, -2.3F, 1, 1, 4),
PartPose.ZERO);

body.addOrReplaceChild("armor18",
CubeListBuilder.create()
.texOffs(90, 0)
.addBox(-3.8F, 0, 1.3F, 1, 2, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor17",
CubeListBuilder.create()
.texOffs(100, 0)
.addBox(2.8F, 1.9F, 1.4F, 1, 1, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor19",
CubeListBuilder.create()
.texOffs(100, 0)
.addBox(-3.8F, 1.9F, 1.4F, 1, 1, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor24",
CubeListBuilder.create()
.texOffs(99, 13)
.addBox(2.8F, -0.1F, 1.3F, 1, 1, 1),
PartPose.ZERO);

body.addOrReplaceChild("armorleft1",
CubeListBuilder.create()
.texOffs(105, 63)
.addBox(3.1F, 2, -2, 1, 4, 4),
PartPose.ZERO);

body.addOrReplaceChild("armor10",
CubeListBuilder.create()
.texOffs(105, 63)
.addBox(-4.1F, 2, -2, 1, 4, 4),
PartPose.ZERO);

body.addOrReplaceChild("armor22",
CubeListBuilder.create()
.texOffs(99, 13)
.addBox(2.8F, -0.1F, -2.3F, 1, 1, 4),
PartPose.ZERO);

body.addOrReplaceChild("armor11",
CubeListBuilder.create()
.texOffs(90, 0)
.addBox(2.8F, 0, -2.3F, 1, 2, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor14",
CubeListBuilder.create()
.texOffs(100, 0)
.addBox(-3.8F, 1.9F, -2.4F, 1, 1, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor12",
CubeListBuilder.create()
.texOffs(90, 0)
.addBox(-3.8F, 0, -2.3F, 1, 2, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor13",
CubeListBuilder.create()
.texOffs(100, 0)
.addBox(2.8F, 1.9F, -2.4F, 1, 1, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor25",
CubeListBuilder.create()
.texOffs(100, 12)
.addBox(-3.8F, -0.1F, 1.3F, 1, 1, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor16",
CubeListBuilder.create()
.texOffs(90, 0)
.addBox(2.8F, 0, 1.3F, 1, 2, 1),
PartPose.ZERO);

body.addOrReplaceChild("armor6",
CubeListBuilder.create()
.texOffs(60, 50)
.addBox(-4, 1.9F, 1.2F, 8, 4, 1),
PartPose.ZERO);

PartDefinition lower_left_arm = root.getChild("left_arm").addOrReplaceChild("lower_left_arm",
CubeListBuilder.create()
.texOffs(40, 28)
.addBox(-6, 2, -2, 4, 6, 4),
PartPose.offsetAndRotation(5, 2, 0, 0, 0, 0));

lower_left_arm.addOrReplaceChild("arm1_1",
CubeListBuilder.create()
.texOffs(0, 90)
.addBox(-2.5F, 1.8F, -1, 1, 5, 2),
PartPose.offsetAndRotation(0, 0, 0, 0, 0, 0.024609142453120045F));

lower_left_arm.addOrReplaceChild("arm3_1",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(-5.8F, 5.3F, 0.1F, 4, 1, 2),
PartPose.ZERO);

lower_left_arm.addOrReplaceChild("arm8_1",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(-6.1F, 5.3F, -2.09F, 1, 1, 4),
PartPose.ZERO);

lower_left_arm.addOrReplaceChild("arm5_1",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(-5.8F, 2.8F, 0.1F, 4, 1, 2),
PartPose.ZERO);

lower_left_arm.addOrReplaceChild("arm6_1",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(-6.1F, 2.8F, -2.09F, 1, 1, 4),
PartPose.ZERO);

lower_left_arm.addOrReplaceChild("arm7_1",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(-6.09F, 2.8F, 1.09F, 1, 1, 1),
PartPose.ZERO);

lower_left_arm.addOrReplaceChild("arm2_1",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(-5.8F, 2.8F, -2.1F, 4, 1, 2),
PartPose.ZERO);

lower_left_arm.addOrReplaceChild("arm4_1",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(-5.8F, 5.3F, -2.1F, 4, 1, 2),
PartPose.ZERO);

lower_left_arm.addOrReplaceChild("arm9_1",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(-6.09F, 5.3F, 1.09F, 1, 1, 1),
PartPose.ZERO);

PartDefinition lower_body = body.addOrReplaceChild("lower_body",
CubeListBuilder.create()
.texOffs(16, 28)
.addBox(-4, 0, -2, 8, 6, 4),
PartPose.offsetAndRotation(0, 0, 0, 0, 0, 0));

lower_body.addOrReplaceChild("armor4",
CubeListBuilder.create()
.texOffs(0, 50)
.addBox(3.2F, 11, -2.3F, 1, 1, 4),
PartPose.ZERO);

lower_body.addOrReplaceChild("armor2_1",
CubeListBuilder.create()
.texOffs(40, 50)
.addBox(-4, 5.9F, -2.2F, 8, 6, 1),
PartPose.ZERO);

lower_body.addOrReplaceChild("armor6_1",
CubeListBuilder.create()
.texOffs(60, 50)
.addBox(-4, 5.9F, 1.2F, 8, 6, 1),
PartPose.ZERO);

lower_body.addOrReplaceChild("armor20",
CubeListBuilder.create()
.texOffs(70, 20)
.addBox(3.6F, 5.1F, -2.25F, 1, 2, 1),
PartPose.offsetAndRotation(0, 0, 0, 0, 0, 0.2617993877991494F));

lower_body.addOrReplaceChild("armor10_1",
CubeListBuilder.create()
.texOffs(105, 63)
.addBox(-4.1F, 5.9F, -2, 1, 6, 4),
PartPose.ZERO);

lower_body.addOrReplaceChild("armor3",
CubeListBuilder.create()
.texOffs(0, 50)
.addBox(-3.8F, 11, 1.3F, 8, 1, 1),
PartPose.ZERO);

lower_body.addOrReplaceChild("armor1",
CubeListBuilder.create()
.texOffs(0, 50)
.addBox(-4.2F, 11, -2.3F, 8, 1, 1),
PartPose.ZERO);

lower_body.addOrReplaceChild("armorleft2",
CubeListBuilder.create()
.texOffs(105, 63)
.addBox(3.1F, 5.9F, -2, 1, 6, 4),
PartPose.ZERO);

lower_body.addOrReplaceChild("armor21",
CubeListBuilder.create()
.texOffs(70, 20)
.addBox(-4.6F, 5.1F, -2.25F, 1, 2, 1),
PartPose.offsetAndRotation(0, 0, 0, 0, 0, -0.2617993877991494F));

lower_body.addOrReplaceChild("armor5",
CubeListBuilder.create()
.texOffs(0, 50)
.addBox(-4.2F, 11, -1.7F, 1, 1, 4),
PartPose.ZERO);

PartDefinition lower_right_arm = root.getChild("right_arm").addOrReplaceChild("lower_right_arm",
CubeListBuilder.create()
.texOffs(40, 28)
.addBox(2, 2, -2, 4, 6, 4),
PartPose.offsetAndRotation(-5, 2, 0, 0, 0, 0));

lower_right_arm.addOrReplaceChild("arm2",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(1.8F, 2.8F, -2.1F, 4, 1, 2),
PartPose.ZERO);

lower_right_arm.addOrReplaceChild("arm8",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(5.1F, 5.3F, -2.09F, 1, 1, 4),
PartPose.ZERO);

lower_right_arm.addOrReplaceChild("arm3",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(1.8F, 5.3F, 0.1F, 4, 1, 2),
PartPose.ZERO);

lower_right_arm.addOrReplaceChild("arm9",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(5.09F, 5.3F, 1.09F, 1, 1, 1),
PartPose.ZERO);

lower_right_arm.addOrReplaceChild("arm6",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(5.1F, 2.8F, -2.09F, 1, 1, 4),
PartPose.ZERO);

lower_right_arm.addOrReplaceChild("arm4",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(1.8F, 5.3F, -2.1F, 4, 1, 2),
PartPose.ZERO);

lower_right_arm.addOrReplaceChild("arm1",
CubeListBuilder.create()
.texOffs(0, 90)
.addBox(1.5F, 1.8F, -1, 1, 5, 2),
PartPose.offsetAndRotation(0, 0, 0, 0, 0, -0.024609142453120045F));

lower_right_arm.addOrReplaceChild("arm5",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(1.8F, 2.8F, 0.1F, 4, 1, 2),
PartPose.ZERO);

lower_right_arm.addOrReplaceChild("arm7",
CubeListBuilder.create()
.texOffs(0, 70)
.addBox(5.09F, 2.8F, 1.09F, 1, 1, 1),
PartPose.ZERO);

return LayerDefinition.create(definition, 150, 100);
}

// May need to implement the rendering parts depending on what you are doing
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import com.sekwah.narutomod.NarutoMod;
import com.sekwah.narutomod.block.NarutoBlocks;
import com.sekwah.narutomod.client.model.entity.SubstitutionLogModel;
import com.sekwah.narutomod.client.model.item.model.AnbuMaskModel;
import com.sekwah.narutomod.client.model.item.model.FlakJacketModel;
import com.sekwah.narutomod.client.model.item.model.FlakJacketNewModel;
import com.sekwah.narutomod.client.model.item.model.HeadbandModel;
import com.sekwah.narutomod.client.model.item.model.*;
import com.sekwah.narutomod.client.model.jutsu.FireballJutsuModel;
import com.sekwah.narutomod.client.model.jutsu.WaterBulletModel;
import com.sekwah.narutomod.client.renderer.entity.*;
Expand Down Expand Up @@ -65,6 +62,7 @@ public static void layerDefinitions(EntityRenderersEvent.RegisterLayerDefinition

event.registerLayerDefinition(FlakJacketNewModel.LAYER_LOCATION, FlakJacketNewModel::createLayer);
event.registerLayerDefinition(FlakJacketModel.LAYER_LOCATION, FlakJacketModel::createLayer);
event.registerLayerDefinition(AnbuArmorModel.LAYER_LOCATION, AnbuArmorModel::createLayer);

// Jutsu
event.registerLayerDefinition(FireballJutsuModel.LAYER_LOCATION, FireballJutsuModel::createLayer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.sekwah.narutomod.client.renderer;

import com.sekwah.narutomod.client.model.item.model.AnbuMaskModel;
import com.sekwah.narutomod.client.model.item.model.FlakJacketModel;
import com.sekwah.narutomod.client.model.item.model.FlakJacketNewModel;
import com.sekwah.narutomod.client.model.item.model.HeadbandModel;
import com.sekwah.narutomod.client.model.item.model.*;
import com.sekwah.narutomod.item.NarutoItems;
import com.sekwah.narutomod.item.armor.NarutoArmorItem;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -47,6 +44,10 @@ public void onResourceManagerReload(ResourceManager resourceManager) {
.setArmorModel(new FlakJacketModel(modelSet.bakeLayer(FlakJacketModel.LAYER_LOCATION)))
.setArmorTexture("textures/models/armor/flak_jacket.png");

((NarutoArmorItem) NarutoItems.ANBU_ARMOR.get())
.setArmorModel(new AnbuArmorModel(modelSet.bakeLayer(AnbuArmorModel.LAYER_LOCATION)))
.setArmorTexture("textures/models/armor/anbu_armor.png");

setHeadbandRenderer(modelSet, NarutoItems.HEADBAND_BLUE, "textures/models/armor/headband/headband_blue_blank.png");
setHeadbandRenderer(modelSet, NarutoItems.HEADBAND_BLACK, "textures/models/armor/headband/headband_black_blank.png");
setHeadbandRenderer(modelSet, NarutoItems.HEADBAND_RED, "textures/models/armor/headband/headband_red_blank.png");
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/sekwah/narutomod/item/NarutoItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public ItemStack makeIcon() {
public static final RegistryObject<Item> FLAK_JACKET = ITEMS.register("flak_jacket", ()
-> new NarutoArmorItem(NarutoArmorMaterial.FLAK_MAT, EquipmentSlot.CHEST, new Item.Properties().tab(NINJA_ARMOR)));

public static final RegistryObject<Item> ANBU_ARMOR = ITEMS.register("anbu_armor", ()
-> new NarutoArmorItem(NarutoArmorMaterial.ANBU_MAT, EquipmentSlot.CHEST, new Item.Properties().tab(NINJA_ARMOR)));

public static final RegistryObject<Item> LONELY_MARCH = ITEMS.register("lonely_march", ()
-> new RecordItem(41, NarutoSounds.LONELY_MARCH, new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(1).rarity(Rarity.RARE)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public enum NarutoArmorMaterial implements ArmorMaterial {

ANBU_MAT("anbu", 35, new int[]{2, 8, 5, 2}, 8, null, 2.1F, 0.0F, () -> null),
FLAK_MAT("anbu", 35, new int[]{2, 7, 5, 2}, 8, null, 2.1F, 0.0F, () -> null),
FLAK_MAT("flak", 35, new int[]{2, 7, 5, 2}, 8, null, 2.1F, 0.0F, () -> null),
HEADBAND("headband", 35, new int[]{2, 8, 5, 2}, 8, null, 2.1F, 0.0F, () -> null),
;

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/narutomod/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"item.narutomod.lonely_march.desc": "Sekwah - Lonely March",
"item.narutomod.flak_jacket": "Flak Jacket",
"item.narutomod.flak_jacket_new": "Flak Jacket",
"item.narutomod.anbu_armor": "Anbu Armor",
"block.narutomod.paper_bomb":"Paper Bomb",
"block.narutomod.bonsai_tree":"Bonsai Tree",
"narutomod.subtitle.kunai_thud": "Projectile Thud",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "narutomod:items/armor/anbu_armor"
}
}
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.

0 comments on commit dce00f2

Please sign in to comment.