diff --git a/src/main/java/com/verdantartifice/thaumicwonders/client/renderers/entity/monsters/RenderCorruptionAvatar.java b/src/main/java/com/verdantartifice/thaumicwonders/client/renderers/entity/monsters/RenderCorruptionAvatar.java index 933390cc..b64c7aa3 100644 --- a/src/main/java/com/verdantartifice/thaumicwonders/client/renderers/entity/monsters/RenderCorruptionAvatar.java +++ b/src/main/java/com/verdantartifice/thaumicwonders/client/renderers/entity/monsters/RenderCorruptionAvatar.java @@ -7,7 +7,12 @@ import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.entity.RenderBiped; +import net.minecraft.client.renderer.entity.RenderLivingBase; import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.layers.LayerBipedArmor; +import net.minecraft.client.renderer.entity.layers.LayerHeldItem; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -15,16 +20,24 @@ @SideOnly(Side.CLIENT) public class RenderCorruptionAvatar extends RenderBiped { protected static final ResourceLocation SKIN = new ResourceLocation(ThaumicWonders.MODID, "textures/entities/monsters/corruption_avatar.png"); - + public RenderCorruptionAvatar(RenderManager manager) { super(manager, new ModelBiped(), 0.5F); + this.addLayer((LayerRenderer) new LayerHeldItem((RenderLivingBase) this)); + final LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { + protected void initArmor() { + this.modelLeggings = new ModelBiped(); + this.modelArmor = new ModelBiped(); + } + }; + this.addLayer((LayerRenderer) layerbipedarmor); } - + @Override protected ResourceLocation getEntityTexture(EntityCorruptionAvatar entity) { return SKIN; } - + @Override protected void preRenderCallback(EntityCorruptionAvatar entitylivingbaseIn, float partialTickTime) { super.preRenderCallback(entitylivingbaseIn, partialTickTime); diff --git a/src/main/java/com/verdantartifice/thaumicwonders/client/renderers/models/gear/ModelVoidcallerArmor.java b/src/main/java/com/verdantartifice/thaumicwonders/client/renderers/models/gear/ModelVoidcallerArmor.java new file mode 100644 index 00000000..62423b4b --- /dev/null +++ b/src/main/java/com/verdantartifice/thaumicwonders/client/renderers/models/gear/ModelVoidcallerArmor.java @@ -0,0 +1,290 @@ +package com.verdantartifice.thaumicwonders.client.renderers.models.gear; + +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.MathHelper; +import thaumcraft.client.renderers.models.gear.ModelCustomArmor; + +public class ModelVoidcallerArmor extends ModelCustomArmor { + ModelRenderer Helmet; + ModelRenderer CollarF; + ModelRenderer CollarB; + ModelRenderer CollarR; + ModelRenderer CollarL; + ModelRenderer BeltR; + ModelRenderer Mbelt; + ModelRenderer MbeltL; + ModelRenderer MbeltR; + ModelRenderer BeltL; + ModelRenderer CloakTL; + ModelRenderer Cloak3; + ModelRenderer CloakTR; + ModelRenderer Cloak1; + ModelRenderer Cloak2; + ModelRenderer Chestplate; + ModelRenderer ChestOrnament; + ModelRenderer ChestClothL; + ModelRenderer ChestClothR; + ModelRenderer Backplate; + ModelRenderer GauntletstrapR1; + ModelRenderer GauntletstrapR2; + ModelRenderer ShoulderR; + ModelRenderer ShoulderR1; + ModelRenderer ShoulderR2; + ModelRenderer ShoulderR5; + ModelRenderer ShoulderR3; + ModelRenderer ShoulderR4; + ModelRenderer GauntletR2; + ModelRenderer GauntletR; + ModelRenderer GauntletL2; + ModelRenderer GauntletstrapL1; + ModelRenderer GauntletstrapL2; + ModelRenderer ShoulderL; + ModelRenderer ShoulderL1; + ModelRenderer ShoulderL2; + ModelRenderer ShoulderL3; + ModelRenderer ShoulderL5; + ModelRenderer ShoulderL4; + ModelRenderer GauntletL; + ModelRenderer LegClothR; + ModelRenderer BackpanelR2; + ModelRenderer BackpanelR3; + ModelRenderer BackpanelR4; + ModelRenderer LegClothL; + ModelRenderer BackpanelL4; + ModelRenderer BackpanelL2; + ModelRenderer BackpanelL3; + ModelRenderer BackpanelL1; + ModelRenderer BackpanelR1; + + public ModelVoidcallerArmor(float f) { + super(f, 0, 128, 64); + textureWidth = 128; + textureHeight = 64; + Helmet = new ModelRenderer(this, 41, 8).addBox(-4.5f, -9.0f, -4.5f, 9, 9, 9); + Helmet.setTextureSize(128, 64); + setRotation(Helmet, 0.0f, 0.0f, 0.0f); + CollarF = new ModelRenderer(this, 17, 31).addBox(-4.5f, -1.5f, -3.0f, 9, 4, 1); + CollarF.setRotationPoint(0.0f, 0.0f, -2.5f); + setRotation(CollarF, 0.2268928f, 0.0f, 0.0f); + CollarB = new ModelRenderer(this, 17, 26).addBox(-4.5f, -1.5f, 7.0f, 9, 4, 1); + CollarB.setRotationPoint(0.0f, 0.0f, -2.5f); + setRotation(CollarB, 0.2268928f, 0.0f, 0.0f); + CollarR = new ModelRenderer(this, 17, 11).addBox(-5.5f, -1.5f, -3.0f, 1, 4, 11); + CollarR.setRotationPoint(0.0f, 0.0f, -2.5f); + setRotation(CollarR, 0.2268928f, 0.0f, 0.0f); + CollarL = new ModelRenderer(this, 17, 11).addBox(4.5f, -1.5f, -3.0f, 1, 4, 11); + CollarL.setRotationPoint(0.0f, 0.0f, -2.5f); + setRotation(CollarL, 0.2268928f, 0.0f, 0.0f); + BeltR = new ModelRenderer(this, 76, 44).addBox(-5.0f, 4.0f, -3.0f, 1, 3, 6); + Mbelt = new ModelRenderer(this, 56, 55).addBox(-4.0f, 8.0f, -3.0f, 8, 4, 1); + MbeltL = new ModelRenderer(this, 76, 44).addBox(4.0f, 8.0f, -3.0f, 1, 3, 6); + MbeltR = new ModelRenderer(this, 76, 44).addBox(-5.0f, 8.0f, -3.0f, 1, 3, 6); + BeltL = new ModelRenderer(this, 76, 44).addBox(4.0f, 4.0f, -3.0f, 1, 3, 6); + CloakTL = new ModelRenderer(this, 0, 43).addBox(2.5f, 1.0f, -1.0f, 2, 1, 3); + CloakTL.setRotationPoint(0.0f, 0.0f, 3.0f); + setRotation(CloakTL, 0.1396263f, 0.0f, 0.0f); + Cloak3 = new ModelRenderer(this, 0, 59).addBox(-4.5f, 17.0f, -3.7f, 9, 4, 1); + Cloak3.setRotationPoint(0.0f, 0.0f, 3.0f); + setRotation(Cloak3, 0.4465716f, 0.0f, 0.0f); + CloakTR = new ModelRenderer(this, 0, 43).addBox(-4.5f, 1.0f, -1.0f, 2, 1, 3); + CloakTR.setRotationPoint(0.0f, 0.0f, 3.0f); + setRotation(CloakTR, 0.1396263f, 0.0f, 0.0f); + Cloak1 = new ModelRenderer(this, 0, 47).addBox(-4.5f, 2.0f, 1.0f, 9, 12, 1); + Cloak1.setRotationPoint(0.0f, 0.0f, 3.0f); + setRotation(Cloak1, 0.1396263f, 0.0f, 0.0f); + Cloak2 = new ModelRenderer(this, 0, 59).addBox(-4.5f, 14.0f, -1.3f, 9, 4, 1); + Cloak2.setRotationPoint(0.0f, 0.0f, 3.0f); + setRotation(Cloak2, 0.3069452f, 0.0f, 0.0f); + Chestplate = new ModelRenderer(this, 56, 45).addBox(-4.0f, 1.0f, -3.8f, 8, 7, 2); + ChestOrnament = new ModelRenderer(this, 76, 53).addBox(-2.5f, 3.0f, -4.8f, 5, 5, 1); + ChestClothL = new ModelRenderer(this, 20, 47); + ChestClothL.mirror = true; + ChestClothL.addBox(1.5f, 1.2f, -4.5f, 3, 9, 1); + setRotation(ChestClothL, 0.0663225f, 0.0f, 0.0f); + ChestClothR = new ModelRenderer(this, 20, 47).addBox(-4.5f, 1.2f, -4.5f, 3, 9, 1); + setRotation(ChestClothR, 0.0663225f, 0.0f, 0.0f); + Backplate = new ModelRenderer(this, 36, 45).addBox(-4.0f, 1.0f, 2.0f, 8, 11, 2); + GauntletR = new ModelRenderer(this, 100, 26).addBox(-3.5f, 3.5f, -2.5f, 2, 6, 5); + GauntletL = new ModelRenderer(this, 114, 26).addBox(1.5f, 3.5f, -2.5f, 2, 6, 5); + GauntletstrapL1 = new ModelRenderer(this, 84, 31); + GauntletstrapL1.mirror = true; + GauntletstrapL1.addBox(-1.5f, 3.5f, -2.5f, 3, 1, 5); + GauntletstrapL2 = new ModelRenderer(this, 84, 31); + GauntletstrapL2.mirror = true; + GauntletstrapL2.addBox(-1.5f, 6.5f, -2.5f, 3, 1, 5); + GauntletstrapR1 = new ModelRenderer(this, 84, 31).addBox(-1.5f, 3.5f, -2.5f, 3, 1, 5); + GauntletstrapR2 = new ModelRenderer(this, 84, 31).addBox(-1.5f, 6.5f, -2.5f, 3, 1, 5); + GauntletR2 = new ModelRenderer(this, 102, 37).addBox(-5.0f, 3.5f, -2.0f, 1, 5, 4); + setRotation(GauntletR2, 0.0f, 0.0f, -0.1675516f); + GauntletL2 = new ModelRenderer(this, 102, 37).addBox(4.0f, 3.5f, -2.0f, 1, 5, 4); + setRotation(GauntletL2, 0.0f, 0.0f, 0.1675516f); + ShoulderR = new ModelRenderer(this, 56, 35).addBox(-3.5f, -2.5f, -2.5f, 5, 5, 5); + ShoulderR1 = new ModelRenderer(this, 0, 0).addBox(-4.3f, -1.5f, -3.0f, 3, 5, 6); + setRotation(ShoulderR1, 0.0f, 0.0f, 0.7853982f); + ShoulderR2 = new ModelRenderer(this, 0, 19).addBox(-3.3f, 3.5f, -2.5f, 1, 1, 5); + setRotation(ShoulderR2, 0.0f, 0.0f, 0.7853982f); + ShoulderR5 = new ModelRenderer(this, 18, 4).addBox(-2.3f, -1.5f, 3.0f, 1, 6, 1); + setRotation(ShoulderR5, 0.0f, 0.0f, 0.7853982f); + ShoulderR3 = new ModelRenderer(this, 0, 11).addBox(-2.3f, 3.5f, -3.0f, 1, 2, 6); + setRotation(ShoulderR3, 0.0f, 0.0f, 0.7853982f); + ShoulderR4 = new ModelRenderer(this, 18, 4).addBox(-2.3f, -1.5f, -4.0f, 1, 6, 1); + setRotation(ShoulderR4, 0.0f, 0.0f, 0.7853982f); + ShoulderL = new ModelRenderer(this, 56, 35).addBox(-1.5f, -2.5f, -2.5f, 5, 5, 5); + ShoulderL1 = new ModelRenderer(this, 0, 0).addBox(1.3f, -1.5f, -3.0f, 3, 5, 6); + setRotation(ShoulderL1, 0.0f, 0.0f, -0.7853982f); + ShoulderL2 = new ModelRenderer(this, 0, 19); + ShoulderL2.mirror = true; + ShoulderL2.addBox(2.3f, 3.5f, -2.5f, 1, 1, 5); + setRotation(ShoulderL2, 0.0f, 0.0f, -0.7853982f); + ShoulderL3 = new ModelRenderer(this, 0, 11).addBox(1.3f, 3.5f, -3.0f, 1, 2, 6); + setRotation(ShoulderL3, 0.0f, 0.0f, -0.7853982f); + ShoulderL5 = new ModelRenderer(this, 18, 4).addBox(1.3f, -1.5f, 3.0f, 1, 6, 1); + ShoulderL5.setTextureSize(128, 64); + setRotation(ShoulderL5, 0.0f, 0.0f, -0.7853982f); + ShoulderL4 = new ModelRenderer(this, 18, 4).addBox(1.3f, -1.5f, -4.0f, 1, 6, 1); + setRotation(ShoulderL4, 0.0f, 0.0f, -0.7853982f); + LegClothR = new ModelRenderer(this, 20, 55).addBox(0.0f, 0.0f, 0.0f, 3, 8, 1); + LegClothR.setRotationPoint(-4.5f, 10.4f, -3.9f); + setRotation(LegClothR, -0.0349066f, 0.0f, 0.0f); + LegClothL = new ModelRenderer(this, 20, 55); + LegClothL.mirror = true; + LegClothL.addBox(0.0f, 0.0f, 0.0f, 3, 8, 1); + LegClothL.setRotationPoint(1.5f, 10.4f, -3.9f); + setRotation(LegClothL, -0.0349066f, 0.0f, 0.0f); + BackpanelR1 = new ModelRenderer(this, 0, 25).addBox(-3.0f, -0.5f, 2.5f, 5, 7, 1); + setRotation(BackpanelR1, 0.0698132f, 0.0f, 0.0f); + BackpanelR2 = new ModelRenderer(this, 96, 14).addBox(-3.0f, -0.5f, -2.5f, 5, 3, 5); + setRotation(BackpanelR2, 0.0f, 0.0f, 0.1396263f); + BackpanelR3 = new ModelRenderer(this, 116, 13).addBox(-3.0f, 2.5f, -2.5f, 1, 4, 5); + setRotation(BackpanelR3, 0.0f, 0.0f, 0.1396263f); + BackpanelR4 = new ModelRenderer(this, 0, 25); + BackpanelR4.mirror = true; + BackpanelR4.addBox(-3.0f, -0.5f, -3.5f, 5, 7, 1); + setRotation(BackpanelR4, -0.0349066f, 0.0f, 0.0f); + BackpanelL1 = new ModelRenderer(this, 0, 25).addBox(-2.0f, -0.5f, 2.5f, 5, 7, 1); + setRotation(BackpanelL1, 0.0698132f, 0.0f, 0.0f); + BackpanelL4 = new ModelRenderer(this, 0, 25).addBox(-2.0f, -0.5f, -3.5f, 5, 7, 1); + setRotation(BackpanelL4, -0.0349066f, 0.0f, 0.0f); + BackpanelL2 = new ModelRenderer(this, 96, 14).addBox(-2.0f, -0.5f, -2.5f, 5, 3, 5); + setRotation(BackpanelL2, 0.0f, 0.0f, -0.1396263f); + BackpanelL3 = new ModelRenderer(this, 116, 13).addBox(2.0f, 2.5f, -2.5f, 1, 4, 5); + setRotation(BackpanelL3, 0.0f, 0.0f, -0.1396263f); + bipedHeadwear.cubeList.clear(); + bipedHead.cubeList.clear(); + bipedHead.addChild(Helmet); + bipedBody.cubeList.clear(); + bipedRightLeg.cubeList.clear(); + bipedLeftLeg.cubeList.clear(); + bipedBody.addChild(Mbelt); + bipedBody.addChild(MbeltL); + bipedBody.addChild(MbeltR); + + if (f >= 1.0f) { + bipedBody.addChild(BeltL); + bipedBody.addChild(BeltR); + bipedBody.addChild(Chestplate); + bipedBody.addChild(ChestOrnament); + bipedBody.addChild(ChestClothR); + bipedBody.addChild(ChestClothL); + bipedBody.addChild(LegClothR); + bipedBody.addChild(LegClothL); + bipedBody.addChild(Backplate); + bipedBody.addChild(CollarB); + bipedBody.addChild(CollarR); + bipedBody.addChild(CollarL); + bipedBody.addChild(CollarF); + bipedBody.addChild(Cloak1); + bipedBody.addChild(Cloak2); + bipedBody.addChild(Cloak3); + bipedBody.addChild(CloakTL); + bipedBody.addChild(CloakTR); + } + + bipedRightArm.cubeList.clear(); + bipedRightArm.addChild(ShoulderR); + bipedRightArm.addChild(ShoulderR1); + bipedRightArm.addChild(ShoulderR2); + bipedRightArm.addChild(ShoulderR3); + bipedRightArm.addChild(ShoulderR4); + bipedRightArm.addChild(ShoulderR5); + bipedRightArm.addChild(GauntletR); + bipedRightArm.addChild(GauntletR2); + bipedRightArm.addChild(GauntletstrapR1); + bipedRightArm.addChild(GauntletstrapR2); + bipedLeftArm.cubeList.clear(); + bipedLeftArm.addChild(ShoulderL); + bipedLeftArm.addChild(ShoulderL1); + bipedLeftArm.addChild(ShoulderL2); + bipedLeftArm.addChild(ShoulderL3); + bipedLeftArm.addChild(ShoulderL4); + bipedLeftArm.addChild(ShoulderL5); + bipedLeftArm.addChild(GauntletL); + bipedLeftArm.addChild(GauntletL2); + bipedLeftArm.addChild(GauntletstrapL1); + bipedLeftArm.addChild(GauntletstrapL2); + bipedRightLeg.addChild(BackpanelR1); + bipedRightLeg.addChild(BackpanelR2); + bipedRightLeg.addChild(BackpanelR3); + bipedRightLeg.addChild(BackpanelR4); + bipedLeftLeg.addChild(BackpanelL1); + bipedLeftLeg.addChild(BackpanelL2); + bipedLeftLeg.addChild(BackpanelL3); + bipedLeftLeg.addChild(BackpanelL4); + } + + public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity); + GlStateManager.pushMatrix(); + + float a = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + float b = MathHelper.cos(limbSwing * 0.6662F + 3.1415927F) * 1.4F * limbSwingAmount; + float c = Math.min(a, b); + + LegClothR.rotateAngleX = a - 0.1047198f; + LegClothL.rotateAngleX = b - 0.1047198f; + Cloak1.rotateAngleX = -c / 2.0f + 0.1396263f; + Cloak2.rotateAngleX = -c / 2.0f + 0.3069452f; + Cloak3.rotateAngleX = -c / 2.0f + 0.4465716f; + + if (isChild) { + GlStateManager.scale(0.75F, 0.75F, 0.75F); + GlStateManager.translate(0.0F, 16.0F * scale, 0.0F); + bipedHead.render(scale); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(0.5F, 0.5F, 0.5F); + GlStateManager.translate(0.0F, 24.0F * scale, 0.0F); + bipedBody.render(scale); + bipedRightArm.render(scale); + bipedLeftArm.render(scale); + bipedRightLeg.render(scale); + bipedLeftLeg.render(scale); + bipedHeadwear.render(scale); + } else { + GlStateManager.scale(1.01F, 1.01F, 1.01F); + + if (entity.isSneaking()) { + GlStateManager.translate(0.0F, 0.2F, 0.0F); + } + + bipedHead.render(scale); + bipedBody.render(scale); + bipedRightArm.render(scale); + bipedLeftArm.render(scale); + bipedRightLeg.render(scale); + bipedLeftLeg.render(scale); + bipedHeadwear.render(scale); + } + + GlStateManager.popMatrix(); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} + diff --git a/src/main/java/com/verdantartifice/thaumicwonders/common/entities/monsters/EntityCorruptionAvatar.java b/src/main/java/com/verdantartifice/thaumicwonders/common/entities/monsters/EntityCorruptionAvatar.java index 05a6d988..91d3c0cd 100644 --- a/src/main/java/com/verdantartifice/thaumicwonders/common/entities/monsters/EntityCorruptionAvatar.java +++ b/src/main/java/com/verdantartifice/thaumicwonders/common/entities/monsters/EntityCorruptionAvatar.java @@ -4,6 +4,7 @@ import com.google.common.base.Predicate; import com.verdantartifice.thaumicwonders.common.entities.EntityFluxFireball; +import com.verdantartifice.thaumicwonders.common.items.ItemsTW; import com.verdantartifice.thaumicwonders.common.misc.FluxExplosion; import com.verdantartifice.thaumicwonders.common.network.PacketHandler; import com.verdantartifice.thaumicwonders.common.network.packets.PacketAvatarZapFx; @@ -12,6 +13,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.IRangedAttackMob; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; @@ -24,16 +26,20 @@ import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.MobEffects; +import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.MathHelper; +import net.minecraft.world.DifficultyInstance; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; import thaumcraft.api.aura.AuraHelper; import thaumcraft.api.entities.IEldritchMob; import thaumcraft.api.entities.ITaintedMob; +import thaumcraft.api.items.ItemsTC; import thaumcraft.api.potions.PotionFluxTaint; import thaumcraft.common.entities.EntityFluxRift; import thaumcraft.common.entities.ai.combat.AILongRangeAttack; @@ -47,20 +53,20 @@ public class EntityCorruptionAvatar extends EntityThaumcraftBoss implements IRangedAttackMob, IEldritchMob, ITaintedMob { protected int seedCooldown = 0; protected boolean isSuffocating = false; - + protected static final Predicate NOT_HORROR = new Predicate() { @Override public boolean apply(Entity input) { return !(input instanceof IEldritchMob) && !(input instanceof ITaintedMob); } }; - + public EntityCorruptionAvatar(World world) { super(world); this.setSize(0.75F, 2.25F); - this.experienceValue = 50; + this.experienceValue = 200; } - + @Override protected void initEntityAI() { this.tasks.addTask(1, new EntityAISwimming(this)); @@ -73,7 +79,7 @@ protected void initEntityAI() { this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, false, NOT_HORROR)); } - + @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); @@ -82,12 +88,12 @@ protected void applyEntityAttributes() { this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(8.0D); this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(6.0D); } - + @Override public boolean isOnSameTeam(Entity el) { return (el instanceof IEldritchMob) || (el instanceof ITaintedMob) || super.isOnSameTeam(el); } - + @Override public boolean canAttackClass(Class cls) { return !IEldritchMob.class.isAssignableFrom(cls) && !ITaintedMob.class.isAssignableFrom(cls) && super.canAttackClass(cls); @@ -98,25 +104,41 @@ public void attackEntityWithRangedAttack(EntityLivingBase target, float distance if (this.canEntityBeSeen(target)) { this.swingArm(this.getActiveHand()); this.getLookHelper().setLookPosition(target.posX, target.getEntityBoundingBox().minY + target.height / 2.0F, target.posZ, 30.0F, 30.0F); - + double sourceY = this.posY + this.height / 2.0F; double deltaX = target.posX - this.posX; double deltaY = target.getEntityBoundingBox().minY + target.height / 2.0F - sourceY; double deltaZ = target.posZ - this.posZ; - + EntityFluxFireball fireball = new EntityFluxFireball(this.world, this, deltaX, deltaY, deltaZ); fireball.posX = this.posX; fireball.posY = sourceY; fireball.posZ = this.posZ; - + this.playSound(SoundsTC.egattack, 1.0F, 1.0F + this.rand.nextFloat() * 0.1F); this.world.spawnEntity(fireball); } } @Override - public void setSwingingArms(boolean swingingArms) {} - + public void setSwingingArms(boolean swingingArms) { + } + + @Override + protected void setEquipmentBasedOnDifficulty(DifficultyInstance difficulty) { + this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(ItemsTW.VOIDCALLER_HELM)); + this.setItemStackToSlot(EntityEquipmentSlot.CHEST, new ItemStack(ItemsTW.VOIDCALLER_CHEST)); + this.setItemStackToSlot(EntityEquipmentSlot.LEGS, new ItemStack(ItemsTW.VOIDCALLER_LEGS)); + this.setItemStackToSlot(EntityEquipmentSlot.FEET, new ItemStack(ItemsTC.voidBoots)); + } + + @Override + public IEntityLivingData onInitialSpawn(DifficultyInstance diff, IEntityLivingData data) { + this.setEquipmentBasedOnDifficulty(diff); + this.setEnchantmentBasedOnDifficulty(diff); + return super.onInitialSpawn(diff, data); + } + @Override protected void updateAITasks() { if (!this.world.isRemote) { @@ -124,14 +146,14 @@ protected void updateAITasks() { if (this.ticksExisted % 5 == 0) { AuraHelper.polluteAura(this.world, this.getPosition().up(), 1.0F, true); } - + // Regenerate based on local flux if (this.ticksExisted % 40 == 0) { float flux = Math.min(100.0F, AuraHelper.getFlux(this.world, this.getPosition())); - int amp = (int)(0.5F * MathHelper.sqrt(flux)); + int amp = (int) (0.5F * MathHelper.sqrt(flux)); this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 40, amp, false, false)); } - + // Generate flux phage and taint poison aura if (this.ticksExisted % 20 == 0) { List livingNearby = EntityUtils.getEntitiesInRange(this.world, this.getPosition(), this, EntityLivingBase.class, 8.0D); @@ -140,7 +162,7 @@ protected void updateAITasks() { creature.addPotionEffect(new PotionEffect(PotionFluxTaint.instance, 100, 0)); } } - + // Spawn taint seeds if (++this.seedCooldown >= 200) { EnumDifficulty diff = this.world.getDifficulty(); @@ -150,25 +172,25 @@ protected void updateAITasks() { int primeThreshold = diff == EnumDifficulty.EASY ? -1 : (diff == EnumDifficulty.HARD ? 1 : 0); int boost = diff == EnumDifficulty.EASY ? 50 : (diff == EnumDifficulty.HARD ? 200 : 100); EntityTaintSeed seed = this.rand.nextInt(10) <= primeThreshold ? - new EntityTaintSeedPrime(this.world) : - new EntityTaintSeed(this.world); + new EntityTaintSeedPrime(this.world) : + new EntityTaintSeed(this.world); seed.boost = boost; seed.setLocationAndAngles( - (int)(this.posX + this.rand.nextGaussian() * 5.0D) + 0.5D, - (int)(this.posY + this.rand.nextGaussian() * 5.0D), - (int)(this.posZ + this.rand.nextGaussian() * 5.0D) + 0.5D, + (int) (this.posX + this.rand.nextGaussian() * 5.0D) + 0.5D, + (int) (this.posY + this.rand.nextGaussian() * 5.0D), + (int) (this.posZ + this.rand.nextGaussian() * 5.0D) + 0.5D, this.rand.nextInt(360), 0.0F); if (diff != EnumDifficulty.PEACEFUL && seed.isNotColliding() && this.world.spawnEntity(seed)) { this.getLookHelper().setLookPositionWithEntity(seed, this.getHorizontalFaceSpeed(), this.getVerticalFaceSpeed()); PacketHandler.INSTANCE.sendToAllAround( - new PacketAvatarZapFx(this.getEntityId(), seed.getEntityId()), + new PacketAvatarZapFx(this.getEntityId(), seed.getEntityId()), new NetworkRegistry.TargetPoint(this.world.provider.getDimension(), this.posX, this.posY, this.posZ, 32.0D)); this.playSound(SoundsTC.zap, 1.0F, 1.0F); this.seedCooldown = 0; } } } - + // Empower if near a rift if (this.ticksExisted % 200 == 0) { List riftsNearby = EntityUtils.getEntitiesInRange(this.world, this.getPosition(), this, EntityFluxRift.class, 16.0D); @@ -178,16 +200,16 @@ protected void updateAITasks() { this.addPotionEffect(new PotionEffect(MobEffects.HASTE, 200, riftCount)); for (EntityFluxRift rift : riftsNearby) { PacketHandler.INSTANCE.sendToAllAround( - new PacketAvatarZapFx(rift.getEntityId(), this.getEntityId()), + new PacketAvatarZapFx(rift.getEntityId(), this.getEntityId()), new NetworkRegistry.TargetPoint(this.world.provider.getDimension(), rift.posX, rift.posY, rift.posZ, 32.0D)); rift.playSound(SoundsTC.zap, 1.0F, 1.0F); } PacketHandler.INSTANCE.sendToAllAround( - new PacketLocalizedMessage("event.corruption_avatar.empower"), + new PacketLocalizedMessage("event.corruption_avatar.empower"), new NetworkRegistry.TargetPoint(this.world.provider.getDimension(), this.posX, this.posY, this.posZ, 32.0D)); } } - + // Explode if suffocating if (this.isSuffocating && this.ticksExisted % 20 == 0) { FluxExplosion.create(this.world, this, this.posX, this.posY, this.posZ, 7.0F, false, true, true); @@ -196,7 +218,7 @@ protected void updateAITasks() { } super.updateAITasks(); } - + @Override public boolean attackEntityFrom(DamageSource source, float amount) { if (source == DamageSource.DROWN || source.getTrueSource() instanceof EntityCorruptionAvatar) { @@ -208,17 +230,17 @@ public boolean attackEntityFrom(DamageSource source, float amount) { return super.attackEntityFrom(source, amount); } } - + @Override protected SoundEvent getAmbientSound() { return SoundsTC.egidle; } - + @Override protected SoundEvent getDeathSound() { return SoundsTC.egdeath; } - + @Override public int getTalkInterval() { return 500; diff --git a/src/main/java/com/verdantartifice/thaumicwonders/common/init/InitItems.java b/src/main/java/com/verdantartifice/thaumicwonders/common/init/InitItems.java index fa18e4ee..267ce120 100644 --- a/src/main/java/com/verdantartifice/thaumicwonders/common/init/InitItems.java +++ b/src/main/java/com/verdantartifice/thaumicwonders/common/init/InitItems.java @@ -5,6 +5,7 @@ import com.verdantartifice.thaumicwonders.common.items.armor.ItemNightVisionGoggles; import com.verdantartifice.thaumicwonders.common.items.armor.ItemVoidFortressArmor; +import com.verdantartifice.thaumicwonders.common.items.armor.ItemVoidcallerArmor; import com.verdantartifice.thaumicwonders.common.items.base.IVariantItem; import com.verdantartifice.thaumicwonders.common.items.base.ItemTW; import com.verdantartifice.thaumicwonders.common.items.baubles.ItemCleansingCharm; @@ -28,18 +29,21 @@ public class InitItems { public static final Set ITEMS = new HashSet(); public static final Set ITEM_VARIANT_HOLDERS = new HashSet(); - + public static void initItems(IForgeRegistry forgeRegistry) { registerItem(forgeRegistry, new ItemPrimalDestroyer()); registerItem(forgeRegistry, new ItemFlyingCarpet()); registerItem(forgeRegistry, new ItemTimewinder()); registerItem(forgeRegistry, new ItemAlchemistStone()); registerItem(forgeRegistry, new ItemTransmuterStone()); - registerItem(forgeRegistry, new ItemTW("eldritch_cluster", new String[] { "iron", "gold", "copper", "tin", "silver", "lead", "cinnabar", "quartz", "void" })); + registerItem(forgeRegistry, new ItemTW("eldritch_cluster", new String[]{"iron", "gold", "copper", "tin", "silver", "lead", "cinnabar", "quartz", "void"})); registerItem(forgeRegistry, new ItemAlienistStone()); registerItem(forgeRegistry, new ItemVoidFortressArmor("void_fortress_helm", ItemVoidFortressArmor.MATERIAL, 4, EntityEquipmentSlot.HEAD)); registerItem(forgeRegistry, new ItemVoidFortressArmor("void_fortress_chest", ItemVoidFortressArmor.MATERIAL, 4, EntityEquipmentSlot.CHEST)); registerItem(forgeRegistry, new ItemVoidFortressArmor("void_fortress_legs", ItemVoidFortressArmor.MATERIAL, 4, EntityEquipmentSlot.LEGS)); + registerItem(forgeRegistry, new ItemVoidcallerArmor("voidcaller_helm", ItemVoidcallerArmor.MATERIAL, 4, EntityEquipmentSlot.HEAD)); + registerItem(forgeRegistry, new ItemVoidcallerArmor("voidcaller_chest", ItemVoidcallerArmor.MATERIAL, 4, EntityEquipmentSlot.CHEST)); + registerItem(forgeRegistry, new ItemVoidcallerArmor("voidcaller_legs", ItemVoidcallerArmor.MATERIAL, 4, EntityEquipmentSlot.LEGS)); registerItem(forgeRegistry, new ItemStructureDiviner()); registerItem(forgeRegistry, new ItemNightVisionGoggles()); registerItem(forgeRegistry, new ItemCleansingCharm()); @@ -50,11 +54,11 @@ public static void initItems(IForgeRegistry forgeRegistry) { registerItem(forgeRegistry, new ItemPanacea()); registerItem(forgeRegistry, new ItemLetheWater()); } - + private static void registerItem(IForgeRegistry forgeRegistry, Item item) { forgeRegistry.register(item); if (item.getHasSubtypes() && item instanceof IVariantItem) { - InitItems.ITEM_VARIANT_HOLDERS.add((IVariantItem)item); + InitItems.ITEM_VARIANT_HOLDERS.add((IVariantItem) item); } else { InitItems.ITEMS.add(item); } diff --git a/src/main/java/com/verdantartifice/thaumicwonders/common/items/armor/ItemVoidcallerArmor.java b/src/main/java/com/verdantartifice/thaumicwonders/common/items/armor/ItemVoidcallerArmor.java new file mode 100644 index 00000000..d2a2e324 --- /dev/null +++ b/src/main/java/com/verdantartifice/thaumicwonders/common/items/armor/ItemVoidcallerArmor.java @@ -0,0 +1,179 @@ +package com.verdantartifice.thaumicwonders.common.items.armor; + +import java.util.List; + +import com.verdantartifice.thaumicwonders.ThaumicWonders; +import com.verdantartifice.thaumicwonders.client.renderers.models.gear.ModelVoidFortressArmor; +import com.verdantartifice.thaumicwonders.client.renderers.models.gear.ModelVoidcallerArmor; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; +import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.World; +import net.minecraftforge.common.ISpecialArmor; +import net.minecraftforge.common.util.EnumHelper; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import thaumcraft.api.capabilities.IPlayerWarp; +import thaumcraft.api.capabilities.ThaumcraftCapabilities; +import thaumcraft.api.items.IGoggles; +import thaumcraft.api.items.IWarpingGear; +import thaumcraft.api.items.ItemsTC; + +public class ItemVoidcallerArmor extends ItemArmor implements ISpecialArmor, IWarpingGear, IGoggles { + public static ItemArmor.ArmorMaterial MATERIAL = EnumHelper.addArmorMaterial("VOIDCALLER", "VOIDCALLER", 50, new int[]{2, 3, 4, 2}, 15, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 3.0F); + ModelBiped model1 = null; + ModelBiped model2 = null; + + public ItemVoidcallerArmor(String name, ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) { + super(materialIn, renderIndexIn, equipmentSlotIn); + this.setRegistryName(ThaumicWonders.MODID, name); + this.setTranslationKey(ThaumicWonders.MODID + "." + this.getRegistryName().getPath()); + this.setCreativeTab(ThaumicWonders.CREATIVE_TAB); + } + + @Override + @SideOnly(Side.CLIENT) + public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { + if (this.model1 == null) { + this.model1 = new ModelVoidcallerArmor(0.5f); + } + if (this.model2 == null) { + this.model2 = new ModelVoidcallerArmor(1.0F); + } + EntityEquipmentSlot type = ((ItemArmor) itemStack.getItem()).armorType; + ModelBiped model = (type == EntityEquipmentSlot.LEGS) ? this.model1 : this.model2; + return CustomArmorHelper.getCustomArmorModel(entityLiving, itemStack, armorSlot, model); + } + + @Override + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { + return ThaumicWonders.MODID + ":textures/entities/armor/voidcaller_armor.png"; + } + + @Override + public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) { + return repair.isItemEqual(new ItemStack(ItemsTC.ingots, 1, 1)) ? true : super.getIsRepairable(toRepair, repair); + } + + @Override + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + super.onArmorTick(world, player, itemStack); + if (!world.isRemote && itemStack.getItemDamage() > 0 && player.ticksExisted % 20 == 0) { + itemStack.damageItem(-1, player); + } + } + + @Override + public int getWarp(ItemStack itemstack, EntityPlayer player) { + return 3; + } + + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { + int priority = 0; + double ratio = this.damageReduceAmount / 25.0D; + if (source.isMagicDamage()) { + priority = 1; + ratio = this.damageReduceAmount / 35.0D; + } else if (source.isFireDamage() || source.isExplosion()) { + priority = 1; + ratio = this.damageReduceAmount / 20.0D; + } else if (source.isUnblockable()) { + priority = 0; + ratio = 0.0D; + } + + ArmorProperties ap = new ArmorProperties(priority, ratio, armor.getMaxDamage() - armor.getItemDamage() + 1); + + // Compute set bonus + EntityEquipmentSlot[] slots = new EntityEquipmentSlot[]{EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.HEAD}; + int set = 0; + for (EntityEquipmentSlot equipmentSlot : slots) { + ItemStack piece = player.getItemStackFromSlot(equipmentSlot); + if (piece != null && piece.getItem() instanceof ItemVoidcallerArmor) { + set++; + } + } + if (set >= 2) { + ap.Armor += 1.0D; + ap.Toughness += 1.0D; + } + if (set >= 3) { + ap.Armor += 1.0D; + } + + // Compute warpshell bonus + if (player instanceof EntityPlayer) { + EntityPlayer ep = (EntityPlayer) player; + IPlayerWarp warp = ThaumcraftCapabilities.getWarp(ep); + if (warp != null) { + int pw = Math.min(100, warp.get(IPlayerWarp.EnumWarpType.PERMANENT)); + ap.Toughness += ((double) pw / 25.0D); + } + } + + return ap; + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + // Compute set bonus for armor display + EntityEquipmentSlot[] slots = new EntityEquipmentSlot[]{EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.HEAD}; + int set = 0; + int armorRating = 0; + for (EntityEquipmentSlot equipmentSlot : slots) { + ItemStack piece = player.getItemStackFromSlot(equipmentSlot); + if (piece != null && piece.getItem() instanceof ItemVoidcallerArmor) { + set++; + } + } + if (set >= 2) { + armorRating++; + } + if (set >= 3) { + armorRating++; + } + + return armorRating; + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + if (source != DamageSource.FALL) { + stack.damageItem(damage, entity); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, World worldIn, List tooltip, ITooltipFlag flagIn) { + tooltip.add(TextFormatting.GOLD + I18n.format("enchantment.special.warpshell")); + super.addInformation(stack, worldIn, tooltip, flagIn); + } + + @Override + public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) { + if (itemstack != null && itemstack.getItem() instanceof ItemArmor) { + ItemArmor armor = (ItemArmor) itemstack.getItem(); + return armor.armorType == EntityEquipmentSlot.HEAD; + } else { + return false; + } + } + + @Override + public EnumRarity getRarity(ItemStack stack) { + return EnumRarity.EPIC; + } +} diff --git a/src/main/resources/assets/thaumicwonders/lang/en_us.lang b/src/main/resources/assets/thaumicwonders/lang/en_us.lang index df13d5bf..10d3dd7d 100644 --- a/src/main/resources/assets/thaumicwonders/lang/en_us.lang +++ b/src/main/resources/assets/thaumicwonders/lang/en_us.lang @@ -68,6 +68,9 @@ item.thaumicwonders.vishroom_spore.name=Vishroom Spore item.thaumicwonders.panacea.normal.name=Panacea item.thaumicwonders.panacea.enchanted.name=Enchanted Panacea item.thaumicwonders.lethe_water.name=Lethe Water +item.thaumicwonders.voidcaller_helm.name=Voidcaller Helm +item.thaumicwonders.voidcaller_chest.name=Voidcaller Cuirass +item.thaumicwonders.voidcaller_legs.name=Voidcaller Thigh Guards // Entities entity.flying_carpet.name=Flying Carpet @@ -82,7 +85,7 @@ fluid.fluid_quicksilver=Quicksilver tc.research_category.THAUMIC_WONDERS=Wonderology thaumicwonders.research.base.title=Wonderology -thaumicwonders.research.base.text.stage.1=What wonders can the arts of thaumaturgy reveal to me? +thaumicwonders.research.base.text.stage.1=While the application of thaumaturgy arts and its rules is close at times to mundane technology, sometimes I wonder what I can do with it when I decide to do something more... exotic? Something, that hardly any mundane devices can make. I must delve deeper into this and see what wonders the arts of thaumaturgy reveal to me. thaumicwonders.research.nether_hedge.title=Infernal Hedge Alchemy thaumicwonders.research.nether_hedge.text.stage.1=It bothers me a little that the principles of hedge alchemy are applicable to so few materials in this world. Perhaps other worlds contain things that this art can be used to create... diff --git a/src/main/resources/assets/thaumicwonders/models/item/voidcaller_chest.json b/src/main/resources/assets/thaumicwonders/models/item/voidcaller_chest.json new file mode 100644 index 00000000..3688f8e5 --- /dev/null +++ b/src/main/resources/assets/thaumicwonders/models/item/voidcaller_chest.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "thaumicwonders:items/voidcaller_chest" + } +} diff --git a/src/main/resources/assets/thaumicwonders/models/item/voidcaller_helm.json b/src/main/resources/assets/thaumicwonders/models/item/voidcaller_helm.json new file mode 100644 index 00000000..68e62d73 --- /dev/null +++ b/src/main/resources/assets/thaumicwonders/models/item/voidcaller_helm.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "thaumicwonders:items/voidcaller_helm" + } +} diff --git a/src/main/resources/assets/thaumicwonders/models/item/voidcaller_legs.json b/src/main/resources/assets/thaumicwonders/models/item/voidcaller_legs.json new file mode 100644 index 00000000..68fff613 --- /dev/null +++ b/src/main/resources/assets/thaumicwonders/models/item/voidcaller_legs.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "thaumicwonders:items/voidcaller_legs" + } +} diff --git a/src/main/resources/assets/thaumicwonders/textures/entities/armor/voidcaller_armor.png b/src/main/resources/assets/thaumicwonders/textures/entities/armor/voidcaller_armor.png new file mode 100644 index 00000000..c01a6c3a Binary files /dev/null and b/src/main/resources/assets/thaumicwonders/textures/entities/armor/voidcaller_armor.png differ diff --git a/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_chest.png b/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_chest.png new file mode 100644 index 00000000..403ec765 Binary files /dev/null and b/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_chest.png differ diff --git a/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_helm.png b/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_helm.png new file mode 100644 index 00000000..f2430e16 Binary files /dev/null and b/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_helm.png differ diff --git a/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_legs.png b/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_legs.png new file mode 100644 index 00000000..62ee36b6 Binary files /dev/null and b/src/main/resources/assets/thaumicwonders/textures/items/voidcaller_legs.png differ diff --git a/src/main/resources/assets/thaumicwonders/textures/research/r_corruption_avatar.png b/src/main/resources/assets/thaumicwonders/textures/research/r_corruption_avatar.png index fec6bb6e..2c60aac0 100644 Binary files a/src/main/resources/assets/thaumicwonders/textures/research/r_corruption_avatar.png and b/src/main/resources/assets/thaumicwonders/textures/research/r_corruption_avatar.png differ