From ca96afa37598c54b5115858b3c2eb44e44bbc227 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Thu, 22 Sep 2016 14:20:05 -0400 Subject: [PATCH] - Changed the recipe of the Acceleration rune so that it is a T4 rune. - Added the Charging rune, which accumulates charge by using the LP from the Blood Altar (1 charge = 1 LP always). If enough charge is stored when crafting, the crafting occurs instantly. --- changelog.txt | 2 + .../bloodmagic/altar/BloodAltar.java | 5 +- .../entity/CorruptedSpiderRenderFactory.java | 15 ++ .../render/entity/RenderCorruptedSpider.java | 39 +++ .../layer/LayerCorruptedSpiderEyes.java | 57 ++++ .../render/model/ModelCorruptedSpider.java | 148 +++++++++++ .../entity/ai/EntityAIPickUpAlly.java | 170 ++++++++++++ .../entity/mob/EntityCorruptedChicken.java | 8 +- .../entity/mob/EntityCorruptedSpider.java | 246 ++++++++++++++++++ .../item/sigil/ItemSigilDivination.java | 13 +- .../bloodmagic/proxy/ClientProxy.java | 3 + .../bloodmagic/registry/ModEntities.java | 2 + .../bloodmagic/registry/ModRecipes.java | 3 +- 13 files changed, 699 insertions(+), 12 deletions(-) create mode 100644 src/main/java/WayofTime/bloodmagic/client/render/entity/CorruptedSpiderRenderFactory.java create mode 100644 src/main/java/WayofTime/bloodmagic/client/render/entity/RenderCorruptedSpider.java create mode 100644 src/main/java/WayofTime/bloodmagic/client/render/entity/layer/LayerCorruptedSpiderEyes.java create mode 100644 src/main/java/WayofTime/bloodmagic/client/render/model/ModelCorruptedSpider.java create mode 100644 src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIPickUpAlly.java create mode 100644 src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedSpider.java diff --git a/changelog.txt b/changelog.txt index f67465ba..58129736 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,8 @@ Version 2.1.0-64 ------------------------------------------------------ - Fixed the symmetry issues of the Ritual of Containment +- Changed the recipe of the Acceleration rune so that it is a T4 rune. +- Added the Charging rune, which accumulates charge by using the LP from the Blood Altar (1 charge = 1 LP always). If enough charge is stored when crafting, the crafting occurs instantly. ------------------------------------------------------ Version 2.1.0-63 diff --git a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java index 0e7b0172..da924c36 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java @@ -1,6 +1,5 @@ package WayofTime.bloodmagic.altar; -import java.util.Collections; import java.util.List; import lombok.Getter; @@ -580,6 +579,7 @@ public class BloodAltar implements IFluidHandler } else if (!tier.equals(EnumAltarTier.ONE) && upgrade != null) { this.isUpgraded = true; + this.accelerationUpgrades = upgrade.getAccelerationCount(); this.consumptionMultiplier = (float) (0.20 * upgrade.getSpeedCount()); this.efficiencyMultiplier = (float) Math.pow(0.85, upgrade.getEfficiencyCount()); this.sacrificeEfficiencyMultiplier = (float) (0.10 * upgrade.getSacrificeCount()); @@ -587,9 +587,8 @@ public class BloodAltar implements IFluidHandler this.capacityMultiplier = (float) ((1 * Math.pow(1.10, upgrade.getBetterCapacityCount()) + 0.20 * upgrade.getCapacityCount())); this.dislocationMultiplier = (float) (Math.pow(1.2, upgrade.getDisplacementCount())); this.orbCapacityMultiplier = (float) (1 + 0.02 * upgrade.getOrbCapacityCount()); - this.accelerationUpgrades = upgrade.getAccelerationCount(); this.chargingFrequency = Math.max(20 - upgrade.getAccelerationCount(), 1); - this.chargingRate = 100 * upgrade.getChargingCount(); + this.chargingRate = (int) (10 * upgrade.getChargingCount() * (1 + consumptionMultiplier / 2)); this.maxCharge = (int) (FluidContainerRegistry.BUCKET_VOLUME * Math.max(0.5 * capacityMultiplier, 1) * upgrade.getChargingCount()); } diff --git a/src/main/java/WayofTime/bloodmagic/client/render/entity/CorruptedSpiderRenderFactory.java b/src/main/java/WayofTime/bloodmagic/client/render/entity/CorruptedSpiderRenderFactory.java new file mode 100644 index 00000000..eb0d211f --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/client/render/entity/CorruptedSpiderRenderFactory.java @@ -0,0 +1,15 @@ +package WayofTime.bloodmagic.client.render.entity; + +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraftforge.fml.client.registry.IRenderFactory; +import WayofTime.bloodmagic.entity.mob.EntityCorruptedSpider; + +public class CorruptedSpiderRenderFactory implements IRenderFactory +{ + @Override + public Render createRenderFor(RenderManager manager) + { + return new RenderCorruptedSpider(manager); + } +} diff --git a/src/main/java/WayofTime/bloodmagic/client/render/entity/RenderCorruptedSpider.java b/src/main/java/WayofTime/bloodmagic/client/render/entity/RenderCorruptedSpider.java new file mode 100644 index 00000000..e118403b --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/client/render/entity/RenderCorruptedSpider.java @@ -0,0 +1,39 @@ +package WayofTime.bloodmagic.client.render.entity; + +import net.minecraft.client.model.ModelSpider; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import WayofTime.bloodmagic.client.render.entity.layer.LayerCorruptedSpiderEyes; +import WayofTime.bloodmagic.client.render.entity.layer.LayerWill; +import WayofTime.bloodmagic.client.render.model.ModelCorruptedSpider; +import WayofTime.bloodmagic.entity.mob.EntityCorruptedSpider; + +@SideOnly(Side.CLIENT) +public class RenderCorruptedSpider extends RenderLiving +{ + private static final ResourceLocation SPIDER_TEXTURES = new ResourceLocation("textures/entity/spider/spider.png"); + + public RenderCorruptedSpider(RenderManager renderManagerIn) + { + super(renderManagerIn, new ModelSpider(), 1.0F); + this.addLayer(new LayerCorruptedSpiderEyes(this)); + this.addLayer(new LayerWill(this, new ModelCorruptedSpider(1.1f))); + } + + protected float getDeathMaxRotation(EntityCorruptedSpider entityLivingBaseIn) + { + return 180.0F; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called + * unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityCorruptedSpider entity) + { + return SPIDER_TEXTURES; + } +} \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/client/render/entity/layer/LayerCorruptedSpiderEyes.java b/src/main/java/WayofTime/bloodmagic/client/render/entity/layer/LayerCorruptedSpiderEyes.java new file mode 100644 index 00000000..2101fae7 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/client/render/entity/layer/LayerCorruptedSpiderEyes.java @@ -0,0 +1,57 @@ +package WayofTime.bloodmagic.client.render.entity.layer; + +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.entity.layers.LayerRenderer; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import WayofTime.bloodmagic.client.render.entity.RenderCorruptedSpider; +import WayofTime.bloodmagic.entity.mob.EntityCorruptedSpider; + +@SideOnly(Side.CLIENT) +public class LayerCorruptedSpiderEyes implements LayerRenderer +{ + private static final ResourceLocation SPIDER_EYES = new ResourceLocation("textures/entity/spider_eyes.png"); + private final RenderCorruptedSpider spiderRenderer; + + public LayerCorruptedSpiderEyes(RenderCorruptedSpider spiderRendererIn) + { + this.spiderRenderer = spiderRendererIn; + } + + public void doRenderLayer(EntityCorruptedSpider entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + this.spiderRenderer.bindTexture(SPIDER_EYES); + GlStateManager.enableBlend(); + GlStateManager.disableAlpha(); + GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); + + if (entitylivingbaseIn.isInvisible()) + { + GlStateManager.depthMask(false); + } else + { + GlStateManager.depthMask(true); + } + + int i = 61680; + int j = i % 65536; + int k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j, (float) k); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.spiderRenderer.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale); + i = entitylivingbaseIn.getBrightnessForRender(partialTicks); + j = i % 65536; + k = i / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j, (float) k); + this.spiderRenderer.setLightmap(entitylivingbaseIn, partialTicks); + GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); + } + + public boolean shouldCombineTextures() + { + return false; + } +} \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/client/render/model/ModelCorruptedSpider.java b/src/main/java/WayofTime/bloodmagic/client/render/model/ModelCorruptedSpider.java new file mode 100644 index 00000000..4c000ba8 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/client/render/model/ModelCorruptedSpider.java @@ -0,0 +1,148 @@ +package WayofTime.bloodmagic.client.render.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.MathHelper; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ModelCorruptedSpider extends ModelBase +{ + /** The spider's head box */ + public ModelRenderer spiderHead; + /** The spider's neck box */ + public ModelRenderer spiderNeck; + /** The spider's body box */ + public ModelRenderer spiderBody; + /** Spider's first leg */ + public ModelRenderer spiderLeg1; + /** Spider's second leg */ + public ModelRenderer spiderLeg2; + /** Spider's third leg */ + public ModelRenderer spiderLeg3; + /** Spider's fourth leg */ + public ModelRenderer spiderLeg4; + /** Spider's fifth leg */ + public ModelRenderer spiderLeg5; + /** Spider's sixth leg */ + public ModelRenderer spiderLeg6; + /** Spider's seventh leg */ + public ModelRenderer spiderLeg7; + /** Spider's eight leg */ + public ModelRenderer spiderLeg8; + + public ModelCorruptedSpider(float scale) + { + float f = 0.0F; + int i = 15; + this.spiderHead = new ModelRenderer(this, 32, 4); + this.spiderHead.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, scale); + this.spiderHead.setRotationPoint(0.0F, 15.0F, -3.0F); + this.spiderNeck = new ModelRenderer(this, 0, 0); + this.spiderNeck.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6, scale); + this.spiderNeck.setRotationPoint(0.0F, 15.0F, 0.0F); + this.spiderBody = new ModelRenderer(this, 0, 12); + this.spiderBody.addBox(-5.0F, -4.0F, -6.0F, 10, 8, 12, scale); + this.spiderBody.setRotationPoint(0.0F, 15.0F, 9.0F); + this.spiderLeg1 = new ModelRenderer(this, 18, 0); + this.spiderLeg1.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, scale); + this.spiderLeg1.setRotationPoint(-4.0F, 15.0F, 2.0F); + this.spiderLeg2 = new ModelRenderer(this, 18, 0); + this.spiderLeg2.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, scale); + this.spiderLeg2.setRotationPoint(4.0F, 15.0F, 2.0F); + this.spiderLeg3 = new ModelRenderer(this, 18, 0); + this.spiderLeg3.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, scale); + this.spiderLeg3.setRotationPoint(-4.0F, 15.0F, 1.0F); + this.spiderLeg4 = new ModelRenderer(this, 18, 0); + this.spiderLeg4.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, scale); + this.spiderLeg4.setRotationPoint(4.0F, 15.0F, 1.0F); + this.spiderLeg5 = new ModelRenderer(this, 18, 0); + this.spiderLeg5.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, scale); + this.spiderLeg5.setRotationPoint(-4.0F, 15.0F, 0.0F); + this.spiderLeg6 = new ModelRenderer(this, 18, 0); + this.spiderLeg6.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, scale); + this.spiderLeg6.setRotationPoint(4.0F, 15.0F, 0.0F); + this.spiderLeg7 = new ModelRenderer(this, 18, 0); + this.spiderLeg7.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, scale); + this.spiderLeg7.setRotationPoint(-4.0F, 15.0F, -1.0F); + this.spiderLeg8 = new ModelRenderer(this, 18, 0); + this.spiderLeg8.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, scale); + this.spiderLeg8.setRotationPoint(4.0F, 15.0F, -1.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) + { + this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); + this.spiderHead.render(scale); + this.spiderNeck.render(scale); + this.spiderBody.render(scale); + this.spiderLeg1.render(scale); + this.spiderLeg2.render(scale); + this.spiderLeg3.render(scale); + this.spiderLeg4.render(scale); + this.spiderLeg5.render(scale); + this.spiderLeg6.render(scale); + this.spiderLeg7.render(scale); + this.spiderLeg8.render(scale); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are + * used for animating the movement of arms and legs, where par1 represents + * the time(so that arms and legs swing back and forth) and par2 represents + * how "far" arms and legs can swing at most. + */ + public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) + { + this.spiderHead.rotateAngleY = netHeadYaw * 0.017453292F; + this.spiderHead.rotateAngleX = headPitch * 0.017453292F; + float f = ((float) Math.PI / 4F); + this.spiderLeg1.rotateAngleZ = -((float) Math.PI / 4F); + this.spiderLeg2.rotateAngleZ = ((float) Math.PI / 4F); + this.spiderLeg3.rotateAngleZ = -0.58119464F; + this.spiderLeg4.rotateAngleZ = 0.58119464F; + this.spiderLeg5.rotateAngleZ = -0.58119464F; + this.spiderLeg6.rotateAngleZ = 0.58119464F; + this.spiderLeg7.rotateAngleZ = -((float) Math.PI / 4F); + this.spiderLeg8.rotateAngleZ = ((float) Math.PI / 4F); + float f1 = -0.0F; + float f2 = 0.3926991F; + this.spiderLeg1.rotateAngleY = ((float) Math.PI / 4F); + this.spiderLeg2.rotateAngleY = -((float) Math.PI / 4F); + this.spiderLeg3.rotateAngleY = 0.3926991F; + this.spiderLeg4.rotateAngleY = -0.3926991F; + this.spiderLeg5.rotateAngleY = -0.3926991F; + this.spiderLeg6.rotateAngleY = 0.3926991F; + this.spiderLeg7.rotateAngleY = -((float) Math.PI / 4F); + this.spiderLeg8.rotateAngleY = ((float) Math.PI / 4F); + float f3 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + 0.0F) * 0.4F) * limbSwingAmount; + float f4 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + (float) Math.PI) * 0.4F) * limbSwingAmount; + float f5 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + ((float) Math.PI / 2F)) * 0.4F) * limbSwingAmount; + float f6 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + ((float) Math.PI * 3F / 2F)) * 0.4F) * limbSwingAmount; + float f7 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + 0.0F) * 0.4F) * limbSwingAmount; + float f8 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + (float) Math.PI) * 0.4F) * limbSwingAmount; + float f9 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + ((float) Math.PI / 2F)) * 0.4F) * limbSwingAmount; + float f10 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + ((float) Math.PI * 3F / 2F)) * 0.4F) * limbSwingAmount; + this.spiderLeg1.rotateAngleY += f3; + this.spiderLeg2.rotateAngleY += -f3; + this.spiderLeg3.rotateAngleY += f4; + this.spiderLeg4.rotateAngleY += -f4; + this.spiderLeg5.rotateAngleY += f5; + this.spiderLeg6.rotateAngleY += -f5; + this.spiderLeg7.rotateAngleY += f6; + this.spiderLeg8.rotateAngleY += -f6; + this.spiderLeg1.rotateAngleZ += f7; + this.spiderLeg2.rotateAngleZ += -f7; + this.spiderLeg3.rotateAngleZ += f8; + this.spiderLeg4.rotateAngleZ += -f8; + this.spiderLeg5.rotateAngleZ += f9; + this.spiderLeg6.rotateAngleZ += -f9; + this.spiderLeg7.rotateAngleZ += f10; + this.spiderLeg8.rotateAngleZ += -f10; + } +} \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIPickUpAlly.java b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIPickUpAlly.java new file mode 100644 index 00000000..c1ac0d59 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/entity/ai/EntityAIPickUpAlly.java @@ -0,0 +1,170 @@ +package WayofTime.bloodmagic.entity.ai; + +import java.util.List; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.EntityAIBase; +import net.minecraft.pathfinding.Path; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.world.World; +import WayofTime.bloodmagic.entity.mob.EntityAspectedDemonBase; + +public class EntityAIPickUpAlly extends EntityAIBase +{ + World worldObj; + protected EntityAspectedDemonBase entity; + /** + * An amount of decrementing ticks that allows the entity to attack once the + * tick reaches 0. + */ + protected int attackTick; + /** The speed with which the mob will approach the target */ + double speedTowardsTarget; + /** + * When true, the mob will continue chasing its target, even if it can't + * find a path to them right now. + */ + boolean longMemory; + /** The PathEntity of our entity. */ + Path entityPathEntity; + private int delayCounter; + private double targetX; + private double targetY; + private double targetZ; + protected final int attackInterval = 20; + private int failedPathFindingPenalty = 0; + private boolean canPenalize = false; + + private EntityLivingBase pickupTarget = null; + + public EntityAIPickUpAlly(EntityAspectedDemonBase creature, double speedIn, boolean useLongMemory) + { + this.entity = creature; + this.worldObj = creature.worldObj; + this.speedTowardsTarget = speedIn; + this.longMemory = useLongMemory; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.entity.getRidingEntity() != null) + { + return false; + } + + AxisAlignedBB bb = new AxisAlignedBB(entity.posX - 0.5, entity.posY - 0.5, entity.posZ - 0.5, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5).expandXyz(5); + List list = this.entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bb, new EntityAspectedDemonBase.WillTypePredicate(entity.getType())); + for (EntityLivingBase testEntity : list) + { + if (testEntity != this.entity) + { + Path path = this.entity.getNavigator().getPathToEntityLiving(testEntity); + if (path != null) + { + this.entityPathEntity = path; + this.pickupTarget = testEntity; + return true; + } + } + } + + return false; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.entity.getRidingEntity() != null; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.entity.getNavigator().setPath(this.entityPathEntity, this.speedTowardsTarget); + this.delayCounter = 0; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.entity.getNavigator().clearPathEntity(); + this.pickupTarget = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + EntityLivingBase entitylivingbase = this.pickupTarget; + this.entity.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F); + double d0 = this.entity.getDistanceSq(entitylivingbase.posX, entitylivingbase.getEntityBoundingBox().minY, entitylivingbase.posZ); + --this.delayCounter; + + if ((this.longMemory || this.entity.getEntitySenses().canSee(entitylivingbase)) && this.delayCounter <= 0 && (this.targetX == 0.0D && this.targetY == 0.0D && this.targetZ == 0.0D || entitylivingbase.getDistanceSq(this.targetX, this.targetY, this.targetZ) >= 1.0D || this.entity.getRNG().nextFloat() < 0.05F)) + { + this.targetX = entitylivingbase.posX; + this.targetY = entitylivingbase.getEntityBoundingBox().minY; + this.targetZ = entitylivingbase.posZ; + this.delayCounter = 4 + this.entity.getRNG().nextInt(7); + + if (this.canPenalize) + { + this.delayCounter += failedPathFindingPenalty; + if (this.entity.getNavigator().getPath() != null) + { + net.minecraft.pathfinding.PathPoint finalPathPoint = this.entity.getNavigator().getPath().getFinalPathPoint(); + if (finalPathPoint != null && entitylivingbase.getDistanceSq(finalPathPoint.xCoord, finalPathPoint.yCoord, finalPathPoint.zCoord) < 1) + failedPathFindingPenalty = 0; + else + failedPathFindingPenalty += 10; + } else + { + failedPathFindingPenalty += 10; + } + } + + if (d0 > 1024.0D) + { + this.delayCounter += 10; + } else if (d0 > 256.0D) + { + this.delayCounter += 5; + } + + if (!this.entity.getNavigator().tryMoveToEntityLiving(entitylivingbase, this.speedTowardsTarget)) + { + this.delayCounter += 15; + } + } + + this.attackTick = Math.max(this.attackTick - 1, 0); + this.pickUpEntity(entitylivingbase, d0); + } + + protected void pickUpEntity(EntityLivingBase potentialPickup, double distance) + { + double d0 = this.getAttackReachSqr(potentialPickup); + + if (distance <= d0 && this.attackTick <= 0 && !potentialPickup.isRiding()) + { + System.out.println("Hai!"); + potentialPickup.startRiding(this.entity, true); + } + } + + protected double getAttackReachSqr(EntityLivingBase attackTarget) + { + return (double) (this.entity.width * 2.0F * this.entity.width * 2.0F + attackTarget.width); + } +} \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedChicken.java b/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedChicken.java index 1c1d1176..2b7208a9 100644 --- a/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedChicken.java +++ b/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedChicken.java @@ -120,7 +120,7 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase @Override public double getBaseKnockbackResist(EnumDemonWillType type) { - return super.getBaseKnockbackResist(type) + 0.2; + return super.getBaseKnockbackResist(type); } @Override @@ -187,6 +187,12 @@ public class EntityCorruptedChicken extends EntityAspectedDemonBase return SoundEvents.ENTITY_CHICKEN_DEATH; } + @Override + protected float getSoundPitch() + { + return super.getSoundPitch() * 0.5f; + } + @Override protected void playStepSound(BlockPos pos, Block blockIn) { diff --git a/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedSpider.java b/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedSpider.java new file mode 100644 index 00000000..ee512510 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/entity/mob/EntityCorruptedSpider.java @@ -0,0 +1,246 @@ +package WayofTime.bloodmagic.entity.mob; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.ai.EntityAIAttackMelee; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.ai.EntityAILeapAtTarget; +import net.minecraft.entity.ai.EntityAILookIdle; +import net.minecraft.entity.ai.EntityAINearestAttackableTarget; +import net.minecraft.entity.ai.EntityAISwimming; +import net.minecraft.entity.ai.EntityAIWander; +import net.minecraft.entity.ai.EntityAIWatchClosest; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.MobEffects; +import net.minecraft.init.SoundEvents; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.pathfinding.PathNavigate; +import net.minecraft.pathfinding.PathNavigateClimber; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import WayofTime.bloodmagic.api.soul.EnumDemonWillType; +import WayofTime.bloodmagic.entity.ai.EntityAIPickUpAlly; + +public class EntityCorruptedSpider extends EntityAspectedDemonBase +{ + private static final DataParameter CLIMBING = EntityDataManager.createKey(EntityCorruptedSpider.class, DataSerializers.BYTE); + + public EntityCorruptedSpider(World world) + { + this(world, EnumDemonWillType.DEFAULT); + } + + public EntityCorruptedSpider(World world, EnumDemonWillType type) + { + super(world); + this.setSize(1.4F, 0.9F); + + this.setType(type); + } + + protected void initEntityAI() + { + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); + this.tasks.addTask(3, new EntityAIPickUpAlly(this, 1, true)); + this.tasks.addTask(4, new EntityCorruptedSpider.AISpiderAttack(this)); + this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); + + this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLivingBase.class, 10, true, false, new EntityAspectedDemonBase.TeamAttackPredicate(this))); + } + + @Override + public double getBaseHP(EnumDemonWillType type) + { + return super.getBaseHP(type); + } + + @Override + public double getBaseMeleeDamage(EnumDemonWillType type) + { + return super.getBaseMeleeDamage(type); + } + + @Override + public double getBaseSpeed(EnumDemonWillType type) + { + return super.getBaseSpeed(type); + } + + @Override + public double getBaseSprintModifier(EnumDemonWillType type) + { + return super.getBaseSprintModifier(type); + } + + @Override + public double getBaseKnockbackResist(EnumDemonWillType type) + { + return super.getBaseKnockbackResist(type); + } + + @Override + public double getMountedYOffset() + { + return (double) (this.height * 0.5F); + } + + @Override + protected PathNavigate getNewNavigator(World worldIn) + { + return new PathNavigateClimber(this, worldIn); + } + + @Override + protected void entityInit() + { + super.entityInit(); + this.dataManager.register(CLIMBING, Byte.valueOf((byte) 0)); + } + + @Override + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote) + { + this.setBesideClimbableBlock(this.isCollidedHorizontally); + } + } + + @Override + protected SoundEvent getAmbientSound() + { + return SoundEvents.ENTITY_SPIDER_AMBIENT; + } + + @Override + protected SoundEvent getHurtSound() + { + return SoundEvents.ENTITY_SPIDER_HURT; + } + + @Override + protected SoundEvent getDeathSound() + { + return SoundEvents.ENTITY_SPIDER_DEATH; + } + + @Override + protected float getSoundPitch() + { + return super.getSoundPitch() * 0.5f; + } + + @Override + protected void playStepSound(BlockPos pos, Block blockIn) + { + this.playSound(SoundEvents.ENTITY_SPIDER_STEP, 0.15F, 1.0F); + } + + @Override + public boolean isOnLadder() + { + return this.isBesideClimbableBlock(); + } + + @Override + public void setInWeb() + { + } + + @Override + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.ARTHROPOD; + } + + @Override + public boolean isPotionApplicable(PotionEffect potioneffectIn) + { + return potioneffectIn.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(potioneffectIn); + } + + public boolean isBesideClimbableBlock() + { + return (((Byte) this.dataManager.get(CLIMBING)).byteValue() & 1) != 0; + } + + public void setBesideClimbableBlock(boolean climbing) + { + byte b0 = ((Byte) this.dataManager.get(CLIMBING)).byteValue(); + + if (climbing) + { + b0 = (byte) (b0 | 1); + } else + { + b0 = (byte) (b0 & -2); + } + + this.dataManager.set(CLIMBING, Byte.valueOf(b0)); + } + + @Override + public float getEyeHeight() + { + return 0.65F; + } + + static class AISpiderAttack extends EntityAIAttackMelee + { + public AISpiderAttack(EntityCorruptedSpider spider) + { + super(spider, 1.0D, true); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + float f = this.attacker.getBrightness(1.0F); + + if (f >= 0.5F && this.attacker.getRNG().nextInt(100) == 0) + { + this.attacker.setAttackTarget((EntityLivingBase) null); + return false; + } else + { + return super.continueExecuting(); + } + } + + protected double getAttackReachSqr(EntityLivingBase attackTarget) + { + return (double) (4.0F + attackTarget.width); + } + } + + static class AISpiderTarget extends EntityAINearestAttackableTarget + { + public AISpiderTarget(EntityCorruptedSpider spider, Class classTarget) + { + super(spider, classTarget, true); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + float f = this.taskOwner.getBrightness(1.0F); + return f >= 0.5F ? false : super.shouldExecute(); + } + } +} \ No newline at end of file diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilDivination.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilDivination.java index f4a05d23..c12dc127 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilDivination.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilDivination.java @@ -17,7 +17,6 @@ import WayofTime.bloodmagic.api.iface.IAltarReader; import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import WayofTime.bloodmagic.api.util.helper.PlayerHelper; -import WayofTime.bloodmagic.entity.mob.EntityCorruptedChicken; import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep; import WayofTime.bloodmagic.tile.TileIncenseAltar; import WayofTime.bloodmagic.tile.TileInversionPillar; @@ -42,12 +41,12 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader // DungeonTester.testDungeonElementWithOutput((WorldServer) world, player.getPosition()); // } - if (!world.isRemote) - { - EntityCorruptedChicken fred = new EntityCorruptedChicken(world, EnumDemonWillType.DESTRUCTIVE); - fred.setPosition(player.posX, player.posY, player.posZ); - world.spawnEntityInWorld(fred); - } +// if (!world.isRemote) +// { +// EntityCorruptedSheep fred = new EntityCorruptedSheep(world, EnumDemonWillType.DESTRUCTIVE); +// fred.setPosition(player.posX, player.posY, player.posZ); +// world.spawnEntityInWorld(fred); +// } if (!world.isRemote) { diff --git a/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java b/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java index fcdc744a..2308ddd0 100644 --- a/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java +++ b/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java @@ -42,6 +42,7 @@ import WayofTime.bloodmagic.client.render.block.RenderMimic; import WayofTime.bloodmagic.client.render.entity.BloodLightRenderFactory; import WayofTime.bloodmagic.client.render.entity.CorruptedChickenRenderFactory; import WayofTime.bloodmagic.client.render.entity.CorruptedSheepRenderFactory; +import WayofTime.bloodmagic.client.render.entity.CorruptedSpiderRenderFactory; import WayofTime.bloodmagic.client.render.entity.CorruptedZombieRenderFactory; import WayofTime.bloodmagic.client.render.entity.MeteorRenderFactory; import WayofTime.bloodmagic.client.render.entity.MimicRenderFactory; @@ -50,6 +51,7 @@ import WayofTime.bloodmagic.client.render.entity.SentientSpecterRenderFactory; import WayofTime.bloodmagic.client.render.entity.SoulSnareRenderFactory; import WayofTime.bloodmagic.entity.mob.EntityCorruptedChicken; import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep; +import WayofTime.bloodmagic.entity.mob.EntityCorruptedSpider; import WayofTime.bloodmagic.entity.mob.EntityCorruptedZombie; import WayofTime.bloodmagic.entity.mob.EntityMimic; import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; @@ -130,6 +132,7 @@ public class ClientProxy extends CommonProxy RenderingRegistry.registerEntityRenderingHandler(EntityCorruptedZombie.class, new CorruptedZombieRenderFactory()); RenderingRegistry.registerEntityRenderingHandler(EntityCorruptedSheep.class, new CorruptedSheepRenderFactory()); RenderingRegistry.registerEntityRenderingHandler(EntityCorruptedChicken.class, new CorruptedChickenRenderFactory()); + RenderingRegistry.registerEntityRenderingHandler(EntityCorruptedSpider.class, new CorruptedSpiderRenderFactory()); ShaderHelper.init(); } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModEntities.java b/src/main/java/WayofTime/bloodmagic/registry/ModEntities.java index b0cd10f6..0fce4e69 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModEntities.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModEntities.java @@ -4,6 +4,7 @@ import net.minecraftforge.fml.common.registry.EntityRegistry; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.entity.mob.EntityCorruptedChicken; import WayofTime.bloodmagic.entity.mob.EntityCorruptedSheep; +import WayofTime.bloodmagic.entity.mob.EntityCorruptedSpider; import WayofTime.bloodmagic.entity.mob.EntityCorruptedZombie; import WayofTime.bloodmagic.entity.mob.EntityMimic; import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter; @@ -27,5 +28,6 @@ public class ModEntities EntityRegistry.registerModEntity(EntityCorruptedZombie.class, "CorruptedZombie", id++, BloodMagic.instance, 64, 1, true); EntityRegistry.registerModEntity(EntityCorruptedSheep.class, "CorruptedSheep", id++, BloodMagic.instance, 64, 1, true); EntityRegistry.registerModEntity(EntityCorruptedChicken.class, "CorruptedChicken", id++, BloodMagic.instance, 64, 1, true); + EntityRegistry.registerModEntity(EntityCorruptedSpider.class, "CorruptedSpider", id++, BloodMagic.instance, 64, 1, true); } } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 52201175..18d7f112 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -115,7 +115,8 @@ public class ModRecipes GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.BLOOD_RUNE, 1, 6), "aba", "bcb", "ada", 'a', "stone", 'b', Items.BUCKET, 'c', new ItemStack(ModBlocks.BLOOD_RUNE), 'd', new ItemStack(ModItems.SLATE, 1, 2))); //Capacity GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.BLOOD_RUNE, 1, 7), "aba", "cdc", "aea", 'a', Blocks.OBSIDIAN, 'b', new ItemStack(ModItems.SLATE, 1, 3), 'c', Items.BUCKET, 'd', new ItemStack(ModBlocks.BLOOD_RUNE, 1, 6), 'e', OrbRegistry.getOrbStack(ModItems.ORB_MASTER))); //Augmented Capacity GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.BLOOD_RUNE, 1, 8), "aba", "cdc", "aba", 'a', "stone", 'b', OrbRegistry.getOrbStack(ModItems.ORB_WEAK), 'c', new ItemStack(ModBlocks.BLOOD_RUNE), 'd', OrbRegistry.getOrbStack(ModItems.ORB_MASTER))); //Orb - GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.BLOOD_RUNE, 1, 9), "aba", "cdc", "aea", 'a', Items.BUCKET, 'b', new ItemStack(ModItems.SLATE, 1, 4), 'c', "ingotGold", 'd', new ItemStack(ModBlocks.BLOOD_RUNE, 1, 1), 'e', OrbRegistry.getOrbStack(ModItems.ORB_ARCHMAGE))); //Acceleration + GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.BLOOD_RUNE, 1, 9), "aba", "cdc", "aea", 'a', Items.BUCKET, 'b', new ItemStack(ModItems.SLATE, 1, 3), 'c', "ingotGold", 'd', new ItemStack(ModBlocks.BLOOD_RUNE, 1, 1), 'e', OrbRegistry.getOrbStack(ModItems.ORB_MASTER))); //Acceleration + GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.BLOOD_RUNE, 1, 10), "RsR", "GrG", "ReR", 'G', "glowstone", 's', new ItemStack(ModItems.SLATE, 1, 3), 'R', "dustRedstone", 'r', new ItemStack(ModBlocks.BLOOD_RUNE, 1), 'e', OrbRegistry.getOrbStack(ModItems.ORB_MASTER))); //Charging GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_STONE, 4), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', new ItemStack(ModItems.SLATE, 1, 1), 'c', OrbRegistry.getOrbStack(ModItems.ORB_APPRENTICE))); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_CONTROLLER), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', ModBlocks.RITUAL_STONE, 'c', OrbRegistry.getOrbStack(ModItems.ORB_MAGICIAN))); GameRegistry.addRecipe(new ShapedBloodOrbRecipe(new ItemStack(ModBlocks.RITUAL_CONTROLLER, 1, 1), "aba", "bcb", "aba", 'a', Blocks.OBSIDIAN, 'b', "stone", 'c', OrbRegistry.getOrbStack(ModItems.ORB_WEAK)));