diff --git a/src/main/java/mod/icarus/crimsonrevelations/entity/EntityCultistArcher.java b/src/main/java/mod/icarus/crimsonrevelations/entity/EntityCultistArcher.java new file mode 100644 index 0000000..f946b62 --- /dev/null +++ b/src/main/java/mod/icarus/crimsonrevelations/entity/EntityCultistArcher.java @@ -0,0 +1,73 @@ +package mod.icarus.crimsonrevelations.entity; + +import mod.icarus.crimsonrevelations.init.RegistryHandler; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.EntityCreature; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIAttackMelee; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAIOpenDoor; +import net.minecraft.entity.ai.EntityAIRestrictOpenDoor; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.monster.AbstractIllager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.item.ItemStack; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.World; +import thaumcraft.api.items.ItemsTC; +import thaumcraft.common.entities.ai.combat.AICultistHurtByTarget; +import thaumcraft.common.entities.monster.EntityEldritchGuardian; +import thaumcraft.common.entities.monster.cult.EntityCultist; + +public class EntityCultistArcher extends EntityCultist { + public EntityCultistArcher(World world) { + super(world); + } + + @Override + protected void initEntityAI() { + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(3, new EntityAIAttackMelee(this, 1.0, false)); + this.tasks.addTask(4, new EntityAIRestrictOpenDoor(this)); + this.tasks.addTask(5, new EntityAIOpenDoor(this, true)); + this.tasks.addTask(6, new EntityAIMoveTowardsRestriction(this, 0.8)); + this.tasks.addTask(7, new EntityAIWander(this, 0.8)); + this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0f)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new AICultistHurtByTarget(this, true)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityEldritchGuardian.class, true)); + this.targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, AbstractIllager.class, true)); + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(30.0); + } + + @Override + protected void setLoot(DifficultyInstance diff) { + this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(RegistryHandler.crimsonArcherHelmet)); + this.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(RegistryHandler.crimsonArcherChestplate)); + this.setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(RegistryHandler.crimsonArcherLeggings)); + this.setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ItemsTC.crimsonBoots)); + this.setHeldItem(this.getActiveHand(), new ItemStack(Items.BOW)); + } + + @Override + protected void setEnchantmentBasedOnDifficulty(DifficultyInstance diff) { + final float f = diff.getClampedAdditionalDifficulty(); + if (this.getHeldItemMainhand() != null && !this.getHeldItemMainhand().isEmpty() && this.rand.nextFloat() < 0.25f * f) { + EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItemMainhand(), (int) (5.0f + f * this.rand.nextInt(18)), false); + } + } +} diff --git a/src/main/java/mod/icarus/crimsonrevelations/init/RegistryHandler.java b/src/main/java/mod/icarus/crimsonrevelations/init/RegistryHandler.java index fd7c5e0..6b60ce7 100644 --- a/src/main/java/mod/icarus/crimsonrevelations/init/RegistryHandler.java +++ b/src/main/java/mod/icarus/crimsonrevelations/init/RegistryHandler.java @@ -3,6 +3,7 @@ import com.google.common.base.Preconditions; import mod.icarus.crimsonrevelations.CrimsonRevelations; import mod.icarus.crimsonrevelations.core.CRConfig; +import mod.icarus.crimsonrevelations.entity.EntityCultistArcher; import mod.icarus.crimsonrevelations.entity.boss.EntityOvergrownTaintacle; import mod.icarus.crimsonrevelations.item.ItemCR; import mod.icarus.crimsonrevelations.item.ItemCRSword; @@ -49,6 +50,14 @@ @EventBusSubscriber(modid = CrimsonRevelations.MODID) @GameRegistry.ObjectHolder(CrimsonRevelations.MODID) public class RegistryHandler { + @GameRegistry.ObjectHolder("bone_bow") + public static Item boneBow; + @GameRegistry.ObjectHolder("crimson_archer_helmet") + public static Item crimsonArcherHelmet; + @GameRegistry.ObjectHolder("crimson_archer_chestplate") + public static Item crimsonArcherChestplate; + @GameRegistry.ObjectHolder("crimson_archer_leggings") + public static Item crimsonArcherLeggings; @GameRegistry.ObjectHolder("crimson_fabric") public static Item crimsonFabric; @GameRegistry.ObjectHolder("crimson_plate") @@ -86,6 +95,8 @@ public static void registerRecipes(RegistryEvent.Register event) { public static void registerEntities(RegistryEvent.Register event) { int id = 0; + entityRegistryHelper("cultist_archer", EntityCultistArcher.class, id++, 64, 3, true, 0x1C1A2F, 0x5649B4); + if (Loader.isModLoaded("thaumicaugmentation") && CRConfig.general_settings.TA_INTEGRATION) entityRegistryHelper("overgrown_taintacle", EntityOvergrownTaintacle.class, id++, 64, 3, true, 0x1C1A2F, 0x5649B4); } diff --git a/src/main/java/mod/icarus/crimsonrevelations/init/RenderingHandler.java b/src/main/java/mod/icarus/crimsonrevelations/init/RenderingHandler.java index cb40ee6..222d539 100644 --- a/src/main/java/mod/icarus/crimsonrevelations/init/RenderingHandler.java +++ b/src/main/java/mod/icarus/crimsonrevelations/init/RenderingHandler.java @@ -2,6 +2,7 @@ import mod.icarus.crimsonrevelations.client.renderer.RenderOvergrownTaintacle; import mod.icarus.crimsonrevelations.core.CRConfig; +import mod.icarus.crimsonrevelations.entity.EntityCultistArcher; import mod.icarus.crimsonrevelations.entity.boss.EntityOvergrownTaintacle; import net.minecraft.client.model.ModelBiped; @@ -14,10 +15,13 @@ import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import thaumcraft.client.renderers.entity.mob.RenderCultist; @SideOnly(Side.CLIENT) public class RenderingHandler { public static void preInit() { + RenderingRegistry.registerEntityRenderingHandler(EntityCultistArcher.class, RenderCultist::new); + if (Loader.isModLoaded("thaumicaugmentation") && CRConfig.general_settings.TA_INTEGRATION) RenderingRegistry.registerEntityRenderingHandler(EntityOvergrownTaintacle.class, RenderOvergrownTaintacle::new); } diff --git a/src/main/resources/assets/crimsonrevelations/lang/en_us.lang b/src/main/resources/assets/crimsonrevelations/lang/en_us.lang index fabb5ac..bb53c2a 100644 --- a/src/main/resources/assets/crimsonrevelations/lang/en_us.lang +++ b/src/main/resources/assets/crimsonrevelations/lang/en_us.lang @@ -1,5 +1,6 @@ itemGroup.CrimsonRevelationsTab=New Crimson Revelations +entity.crimsonrevelations.cultist_archer.name=Crimson Archer entity.crimsonrevelations.overgrown_taintacle.name=Overgrown Taintacle item.crimsonrevelations.bone_bow.name=Bow of Bone