Skip to content

Commit

Permalink
Start custom armors + new textures
Browse files Browse the repository at this point in the history
  • Loading branch information
IcarussOne committed May 29, 2024
1 parent 588a534 commit cfe6277
Show file tree
Hide file tree
Showing 22 changed files with 640 additions and 3 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
import mod.icarus.crimsonrevelations.entity.boss.EntityOvergrownTaintacle;
import mod.icarus.crimsonrevelations.item.ItemCR;
import mod.icarus.crimsonrevelations.item.ItemCRSword;
import mod.icarus.crimsonrevelations.item.armor.ItemCultistArcherArmor;

import net.minecraft.block.Block;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockSlab;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.Entity;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
Expand Down Expand Up @@ -51,14 +56,20 @@ public class RegistryHandler {
@GameRegistry.ObjectHolder("crimson_sword")
public static Item crimsonSword;

static ToolMaterial TOOL_CULTIST = EnumHelper.addToolMaterial("CULTIST", 3, 321, 7.5F, 2.5F, 20).setRepairItem(new ItemStack(crimsonPlate));
public static ArmorMaterial ARMOR_CULTIST_ARCHER = EnumHelper.addArmorMaterial("CULTIST_ARCHER", "CULTIST_ARCHER", 17, new int[]{2, 5, 5, 2}, 13, SoundEvents.ITEM_ARMOR_EQUIP_CHAIN, 0.0F).setRepairItem(new ItemStack(crimsonPlate));

public static ToolMaterial TOOL_CULTIST = EnumHelper.addToolMaterial("CULTIST", 3, 321, 7.5F, 2.5F, 20).setRepairItem(new ItemStack(crimsonPlate));

@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
event.getRegistry().registerAll(
setup(new ItemCR(EnumRarity.UNCOMMON), "crimson_fabric"),
setup(new ItemCR(EnumRarity.UNCOMMON), "crimson_plate"),
setup(new ItemCRSword(TOOL_CULTIST, EnumRarity.UNCOMMON), "crimson_sword")
setup(new ItemCRSword(TOOL_CULTIST, EnumRarity.UNCOMMON), "crimson_sword"),

setup(new ItemCultistArcherArmor(EntityEquipmentSlot.HEAD), "crimson_archer_helmet"),
setup(new ItemCultistArcherArmor(EntityEquipmentSlot.CHEST), "crimson_archer_chestplate"),
setup(new ItemCultistArcherArmor(EntityEquipmentSlot.LEGS), "crimson_archer_leggings")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
import mod.icarus.crimsonrevelations.client.renderer.RenderOvergrownTaintacle;
import mod.icarus.crimsonrevelations.core.CRConfig;
import mod.icarus.crimsonrevelations.entity.boss.EntityOvergrownTaintacle;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHandSide;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.relauncher.Side;
Expand All @@ -14,4 +21,55 @@ public static void preInit() {
if (Loader.isModLoaded("thaumicaugmentation") && CRConfig.general_settings.TA_INTEGRATION)
RenderingRegistry.registerEntityRenderingHandler(EntityOvergrownTaintacle.class, RenderOvergrownTaintacle::new);
}

@SideOnly(Side.CLIENT)
public static ModelBiped getCustomArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped model) {
if (model != null) {
model.bipedHead.showModel = (armorSlot == EntityEquipmentSlot.HEAD);
model.bipedHeadwear.showModel = (armorSlot == EntityEquipmentSlot.HEAD);
model.bipedBody.showModel = (armorSlot == EntityEquipmentSlot.CHEST || armorSlot == EntityEquipmentSlot.LEGS);
model.bipedRightArm.showModel = (armorSlot == EntityEquipmentSlot.CHEST);
model.bipedLeftArm.showModel = (armorSlot == EntityEquipmentSlot.CHEST);
model.bipedRightLeg.showModel = (armorSlot == EntityEquipmentSlot.LEGS);
model.bipedLeftLeg.showModel = (armorSlot == EntityEquipmentSlot.LEGS);
model.isSneak = entityLiving.isSneaking();
model.isRiding = entityLiving.isRiding();
model.isChild = entityLiving.isChild();

ItemStack stackMain = entityLiving.getHeldItemMainhand();
ModelBiped.ArmPose armPoseMain = ModelBiped.ArmPose.EMPTY;

if (stackMain != null && !stackMain.isEmpty()) {
armPoseMain = ModelBiped.ArmPose.ITEM;

if (entityLiving.getItemInUseCount() > 0) {
EnumAction actionMain = stackMain.getItemUseAction();

if (actionMain == EnumAction.BLOCK) {
armPoseMain = ModelBiped.ArmPose.BLOCK;
} else if (actionMain == EnumAction.BOW) {
armPoseMain = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
}

ItemStack stackOff = entityLiving.getHeldItemOffhand();
ModelBiped.ArmPose armPoseOff = ModelBiped.ArmPose.EMPTY;

if (stackOff != null && !stackOff.isEmpty()) {
armPoseOff = ModelBiped.ArmPose.ITEM;
if (entityLiving.getItemInUseCount() > 0) {
EnumAction actionOff = stackOff.getItemUseAction();
if (actionOff == EnumAction.BLOCK) {
armPoseOff = ModelBiped.ArmPose.BLOCK;
}
}
}

model.rightArmPose = (entityLiving.getPrimaryHand() == EnumHandSide.RIGHT) ? armPoseMain : armPoseOff;
model.leftArmPose = (entityLiving.getPrimaryHand() == EnumHandSide.RIGHT) ? armPoseOff : armPoseMain;
}

return model;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package mod.icarus.crimsonrevelations.item.armor;

import mod.icarus.crimsonrevelations.CrimsonRevelations;
import mod.icarus.crimsonrevelations.client.model.gear.ModelCultistArcherArmor;
import mod.icarus.crimsonrevelations.init.RegistryHandler;
import mod.icarus.crimsonrevelations.init.RenderingHandler;

import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class ItemCultistArcherArmor extends ItemArmor {
ModelBiped model1 = null;
ModelBiped model2 = null;

protected static final String TEXTURE_PATH = new ResourceLocation(CrimsonRevelations.MODID, "textures/models/armor/cultist_archer_armor.png").toString();

public ItemCultistArcherArmor(EntityEquipmentSlot equipmentSlot) {
super(RegistryHandler.ARMOR_CULTIST_ARCHER, 4, equipmentSlot);
}

@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) {
if (this.model1 == null) {
this.model1 = new ModelCultistArcherArmor(0.5f);
}
if (this.model2 == null) {
this.model2 = new ModelCultistArcherArmor(1.0F);
}
EntityEquipmentSlot type = ((ItemArmor) itemStack.getItem()).armorType;
ModelBiped model = (type == EntityEquipmentSlot.LEGS) ? this.model1 : this.model2;
return RenderingHandler.getCustomArmorModel(entityLiving, itemStack, armorSlot, model);
}

@Override
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
return TEXTURE_PATH;
}

@Override
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.UNCOMMON;
}
}
9 changes: 8 additions & 1 deletion src/main/resources/assets/crimsonrevelations/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ itemGroup.CrimsonRevelationsTab=New Crimson Revelations

entity.crimsonrevelations.overgrown_taintacle.name=Overgrown Taintacle

item.crimsonrevelations.crimson_archer_helmet.name=Crimson Archer Helm
item.crimsonrevelations.crimson_archer_chestplate.name=Crimson Archer Chestplate
item.crimsonrevelations.crimson_archer_leggings.name=Crimson Archer Leggings
item.crimsonrevelations.crimson_fabric.name=Crimson Fabric
item.crimsonrevelations.crimson_plate.name=Crimson Plate
item.crimsonrevelations.crimson_sword.name=Crimson Cult Sword
Expand Down Expand Up @@ -53,10 +56,14 @@ crimsonrevelations.research.focus_taint_poison.stage.0=Taint Poison is much more
crimsonrevelations.research.overgrown_taintacle.title=Overgrown Taintacle
crimsonrevelations.research.overgrown_taintacle.stage.0=During one of my treks in the Emptiness, I have discovered a significantly stronger and more aggressive Taintacle variant. It seems to have a symbiotic relationship with the environment, which would explain the main source of its power.<BR>Hunting these larger Taintacles would be ideal, I should be able to harvest whatever congealed energy it leaves off for my own purposes.

crimsonrevelations.text.overgrown_taintacle=You have absorbed some of the Overgrown Taintacle's power.

focus.crimsonrevelations.poison.name=Poison
focus.crimsonrevelations.poison.text=Summons a blob of goo at your target and poisons it for double the usual duration.

focus.crimsonrevelations.taint_poison.name=Taint Poison
focus.crimsonrevelations.taint_poison.text=Unleashes a glob of infectious taint at your target and poisons it for double the usual duration. Vulnerable targets can become corrupted with taint.

focus.common.double_duration=Duration (two seconds)
focus.common.double_duration=Duration (two seconds)

research.m_OVERGROWN_TAINTACLE.text=Eliminate an Overgrown Taintacle.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "crimsonrevelations:items/crimson_archer_chestplate"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "crimsonrevelations:items/crimson_archer_helmet"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "crimsonrevelations:items/crimson_archer_leggings"
}
}
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.
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.
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.
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.
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.
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.
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 cfe6277

Please sign in to comment.