From 8a59eb9dbc8f59721c39ff4875ea2db2668bd7fb Mon Sep 17 00:00:00 2001 From: Boblet Date: Wed, 13 Dec 2023 11:08:01 +0100 Subject: [PATCH] initial cleanup --- src/main/java/com/hbm/config/MobConfig.java | 10 +- .../com/hbm/entity/mob/EntityGlyphid.java | 98 ++++++------- .../hbm/entity/mob/EntityGlyphidBehemoth.java | 6 +- .../hbm/entity/mob/EntityGlyphidBrenda.java | 3 - .../hbm/entity/mob/EntityGlyphidNuclear.java | 19 ++- .../hbm/entity/mob/EntityGlyphidScout.java | 138 +++++++++--------- .../com/hbm/inventory/OreDictManager.java | 1 - .../java/com/hbm/inventory/fluid/Fluids.java | 4 +- src/main/java/com/hbm/main/ClientProxy.java | 2 +- .../com/hbm/world/feature/GlyphidHive.java | 2 - src/main/resources/assets/hbm/lang/en_US.lang | 9 +- 11 files changed, 133 insertions(+), 159 deletions(-) diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index 59f6c9e3f..19d515b5a 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -39,7 +39,7 @@ public class MobConfig { public static int swarmCooldown = 120; public static int baseSwarmSize = 5; - public static double swarmScalingMult = 1.2; + public static double swarmScalingMult = 1.2; public static int sootStep = 50; public static int[] glyphidChance = {50, -40}; @@ -119,10 +119,10 @@ public class MobConfig { + "The base chance is the stock chance of the bug to spawn within a swarm, unaffected by soot\n" + "As soot increases, the spawn rate of the bug increases until it reaches a limit determined by the modifier\n" + "If the default chance is negative, the mob will not spawn by default, and the lower it is,\n" - + "The longer it takes for the modifier to make it positive\n" - + "If the Modifier is negative, the bug will spawn less often in swarms,\n" + + "The longer it takes for the modifier to make it positive\n" + + "If the Modifier is negative, the bug will spawn less often in swarms,\n" + "And its place will be taken over by another one.\n" - + "\n" + + "\n" + "The formula for glyphid spawning chance is: (chance + (modifier - modifier / (soot/10)))" + "The formula for glyphid swarm scaling is: (baseSwarmSize * Math.max(swarmScalingMult * soot/sootStep, 1))"); @@ -140,7 +140,7 @@ public class MobConfig { brendaChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC06_brendaChance", "Base Spawn chance and soot modifier for a glyphid brenda", new int[]{-50, 60}); johnsonChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC07_johnsonChance", "Base Spawn chance and soot modifier for Big Man Johnson", new int[]{-50, 60}); - String rampantDesc = "Rampant Mode changes glyphid behavior and spawning to be more aggressive, changes include:\n" + String rampantDesc = "Rampant Mode changes glyphid behavior and spawning to be more aggressive, changes include:\n" + "\n" + "Glyphid Scouts will naturally spawn alongside normal mobs if soot levels are above a certain threshold\n" + "Glyphids will always have the extended targetting enabled\n" diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 5699f060f..11b26b439 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -3,15 +3,12 @@ package com.hbm.entity.mob; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Objects; import com.hbm.blocks.ModBlocks; -import com.hbm.blocks.generic.BlockGlyphidSpawner; import com.hbm.config.MobConfig; import com.hbm.entity.logic.EntityWaypoint; import com.hbm.entity.pathfinder.PathFinderUtils; import com.hbm.explosion.vanillant.ExplosionVNT; -import com.hbm.explosion.vanillant.interfaces.IExplosionSFX; import com.hbm.explosion.vanillant.standard.*; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; @@ -59,29 +56,30 @@ public class EntityGlyphid extends EntityMob { //used for digging, bigger glyphids have a longer reach public int blastSize = Math.min((int) (3 * (getScale()))/2, 5); - public int blastResToDig = Math.min((int) (50 * (getScale() * 2)), 150); + public int blastResToDig = Math.min((int) (50 * (getScale() * 2)), 150); public boolean shouldDig; // Tasks - public static final int none = 0; - public static final int comm = 1; - public static final int expand = 2; - public static final int reinforcements = 3; - public static final int follow = 4; - public static final int terraform = 5; - public static final int dig = 6; + /** Idle state, only makes glpyhids wander around randomly */ + public static final int TASK_IDLE = 0; + /** Causes the glyphid to walk to the waypoint, then communicate the FOLLOW task to nearby glyphids */ + public static final int TASK_RETREAT_FOR_REINFORCEMENTS = 1; + /** Task used by scouts, if the waypoint is reached it will construct a new hive */ + public static final int TASK_BUILD_HIVE = 2; + /** Creates a waypoint at the home position and then immediately initiates the RETREAT_FOR_REINFORCEMENTS task */ + public static final int TASK_INITIATE_RETREAT = 3; + /** Will simply walk to the waypoint and enter IDLE once it is reached */ + public static final int TASK_FOLLOW = 4; + /** Causes nuclear glyphids to immediately self-destruct, also signaling nearby scouts to retreat */ + public static final int TASK_TERRAFORM = 5; + /** Id any task other than IDLE is interrupted by an obstacle, initiates digging behavior which is also communicated to nearby glyohids */ + public static final int TASK_DIG = 6; + EntityWaypoint taskWaypoint = null; + public EntityGlyphid(World world) { super(world); - /*this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); - this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - this.tasks.addTask(8, new EntityAILookIdle(this)); - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));*/ this.setSize(1.75F, 1F); } @@ -124,14 +122,14 @@ public class EntityGlyphid extends EntityMob { onBlinded(); } - if(getCurrentTask() == follow){ + if(getCurrentTask() == TASK_FOLLOW){ //incase the waypoint somehow doesn't exist and it got this task anyway - if(isAtDestination() && taskX == none) { - setCurrentTask(none, null); + if(isAtDestination() && taskX == TASK_IDLE) { + setCurrentTask(TASK_IDLE, null); } //the task cannot be 6 outside of rampant, so this is a non issue p much - } else if (getCurrentTask() == dig && ticksExisted % 20 == 0 && isAtDestination()) { + } else if (getCurrentTask() == TASK_DIG && ticksExisted % 20 == 0 && isAtDestination()) { swingItem(); ExplosionVNT vnt = new ExplosionVNT(worldObj, taskX, taskY + 2, taskZ, blastSize, this); @@ -156,8 +154,8 @@ public class EntityGlyphid extends EntityMob { @Override protected void dropFewItems(boolean byPlayer, int looting) { super.dropFewItems(byPlayer, looting); - Item drop = isBurning() ? ModItems.glyphid_meat_grilled : ModItems.glyphid_meat; - if(rand.nextInt(2) == 0) this.entityDropItem(new ItemStack(drop, ((int)getScale()*2) + looting), 0F); + Item drop = isBurning() ? ModItems.glyphid_meat_grilled : ModItems.glyphid_meat; + if(rand.nextInt(2) == 0) this.entityDropItem(new ItemStack(drop, ((int) getScale() * 2) + looting), 0F); } @Override @@ -170,7 +168,7 @@ public class EntityGlyphid extends EntityMob { @Override protected void updateWanderPath() { - if(getCurrentTask() == none) { + if(getCurrentTask() == TASK_IDLE) { super.updateWanderPath(); } } @@ -185,7 +183,7 @@ public class EntityGlyphid extends EntityMob { // hell yeah!! if (useExtendedTargeting() && this.entityToAttack != null) { this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, true, true)); - } else if (getCurrentTask() != none) { + } else if (getCurrentTask() != TASK_IDLE) { this.worldObj.theProfiler.startSection("stroll"); @@ -203,11 +201,11 @@ public class EntityGlyphid extends EntityMob { } - if (taskX != none) { - if(MobConfig.rampantDig) { + if (taskX != TASK_IDLE) { + if(MobConfig.rampantDig) { MovingObjectPosition obstacle = findWaypointObstruction(); - if (getScale() >= 1 && getCurrentTask() != dig && obstacle != null) { + if (getScale() >= 1 && getCurrentTask() != TASK_DIG && obstacle != null) { digToWaypoint(obstacle); } else { Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ); @@ -222,19 +220,18 @@ public class EntityGlyphid extends EntityMob { } } } + this.worldObj.theProfiler.endSection(); - } } } - } public void onBlinded(){ this.entityToAttack = null; this.setPathToEntity(null); - fleeingTick = 80; + this.fleeingTick = 80; if(getScale() >= 1.25){ if(ticksExisted % 20 == 0) { @@ -253,8 +250,6 @@ public class EntityGlyphid extends EntityMob { if (block == ModBlocks.lantern) { rotationYaw = 360F / 16 * i; swingItem(); - //this function is incredibly useful for breaking blocks naturally but obfuscated - //jesus fucking christ who the fuck runs forge? worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false); } @@ -270,7 +265,7 @@ public class EntityGlyphid extends EntityMob { @Override protected boolean canDespawn() { - return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == none; + return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == TASK_IDLE; } @Override @@ -454,16 +449,16 @@ public class EntityGlyphid extends EntityMob { switch(task){ //call for reinforcements - case comm: if(taskWaypoint != null){ - communicate(follow, taskWaypoint); - setCurrentTask(follow, taskWaypoint); + case TASK_RETREAT_FOR_REINFORCEMENTS: if(taskWaypoint != null){ + communicate(TASK_FOLLOW, taskWaypoint); + setCurrentTask(TASK_FOLLOW, taskWaypoint); } break; //expand the hive, used by the scout //case 2: expandHive(null); //retreat - case reinforcements: + case TASK_INITIATE_RETREAT: if (!worldObj.isRemote && taskWaypoint == null) { @@ -473,15 +468,15 @@ public class EntityGlyphid extends EntityMob { //First, go home and get reinforcements EntityWaypoint home = new EntityWaypoint(worldObj); - home.setWaypointType(comm); + home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS); home.setAdditionalWaypoint(additional); home.setHighPriority(); home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); worldObj.spawnEntityInWorld(home); this.taskWaypoint = home; - communicate(follow, home); - setCurrentTask(follow, taskWaypoint); + communicate(TASK_FOLLOW, home); + setCurrentTask(TASK_FOLLOW, taskWaypoint); break; } @@ -492,7 +487,7 @@ public class EntityGlyphid extends EntityMob { //fifth task is used only in the scout and big man johnson, for terraforming //dig - case dig: + case TASK_DIG: shouldDig = true; break; @@ -502,7 +497,8 @@ public class EntityGlyphid extends EntityMob { } - public void communicate(int task, @Nullable EntityWaypoint waypoint) { + /** Copies tasks and waypoint to nearby glyphids. Does not work on glyphid scouts */ + public void communicate(int task, @Nullable EntityWaypoint waypoint) { int radius = waypoint != null ? waypoint.radius : 4; AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( @@ -523,7 +519,7 @@ public class EntityGlyphid extends EntityMob { } } - /** What each type of glyphid does when it is time to expand the hive. + /** What each type of glyphid does when it is time to expand the hive. * @return Whether it has expanded successfully or not * **/ public boolean expandHive(){ @@ -532,10 +528,9 @@ public class EntityGlyphid extends EntityMob { public boolean isAtDestination() { int destinationRadius = taskWaypoint != null ? (int) Math.pow(taskWaypoint.radius, 2) : 25; - return this.getDistanceSq(taskX, taskY, taskZ) <= destinationRadius; } - ///TASK SYSTEM END + ///TASK SYSTEM END ///DIGGING SYSTEM START @@ -564,17 +559,17 @@ public class EntityGlyphid extends EntityMob { previousTask = getCurrentTask(); previousWaypoint = getWaypoint(); - setCurrentTask(dig, target); + setCurrentTask(TASK_DIG, target); Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ); int maxDist = (int) (Math.sqrt(vec.squareDistanceTo(taskX, taskY, taskZ)) * 1.2); this.setPathToEntity(PathFinderUtils.getPathEntityToCoordPartial(worldObj, this, taskX, taskY, taskZ, maxDist, true, false, true, true)); - communicate(dig, target); + communicate(TASK_DIG, target); } ///DIGGING END - + @Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); @@ -608,5 +603,4 @@ public class EntityGlyphid extends EntityMob { this.currentTask = nbt.getInteger("task"); } - } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java index e042626c2..fbc138cde 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java @@ -2,8 +2,6 @@ package com.hbm.entity.mob; import com.hbm.entity.effect.EntityMist; import com.hbm.entity.projectile.EntityChemical; -import com.hbm.inventory.FluidContainerRegistry; -import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.main.ResourceManager; @@ -11,14 +9,12 @@ import com.hbm.main.ResourceManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraftforge.fluids.Fluid; public class EntityGlyphidBehemoth extends EntityGlyphid { @@ -100,7 +96,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid { @Override protected void dropFewItems(boolean byPlayer, int looting) { - this.entityDropItem(new ItemStack(ModItems.glyphid_gland, 1, Fluids.SULFURIC_ACID.getID()), 1); + this.entityDropItem(new ItemStack(ModItems.glyphid_gland, 1, Fluids.SULFURIC_ACID.getID()), 1); super.dropFewItems(byPlayer, looting); } @Override diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java index be4486456..33926bbde 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java @@ -1,15 +1,12 @@ package com.hbm.entity.mob; import com.hbm.entity.effect.EntityMist; -import com.hbm.inventory.FluidContainerRegistry; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.main.ResourceManager; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java index bb617e2b0..d98a13edd 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java @@ -1,7 +1,6 @@ package com.hbm.entity.mob; import com.hbm.blocks.ModBlocks; -import com.hbm.entity.effect.EntityMist; import com.hbm.entity.logic.EntityWaypoint; import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; @@ -9,7 +8,6 @@ import com.hbm.explosion.vanillant.standard.BlockMutatorDebris; import com.hbm.explosion.vanillant.standard.BlockProcessorStandard; import com.hbm.explosion.vanillant.standard.EntityProcessorStandard; import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; -import com.hbm.inventory.fluid.Fluids; import com.hbm.main.MainRegistry; import com.hbm.main.ResourceManager; import com.hbm.packet.AuxParticlePacketNT; @@ -50,22 +48,22 @@ public class EntityGlyphidNuclear extends EntityGlyphid { @Override public void onUpdate() { super.onUpdate(); - if (ticksExisted % 20 == 0) { - if (isAtDestination() && getCurrentTask() == follow) { - setCurrentTask(none, null); + if(ticksExisted % 20 == 0) { + if(isAtDestination() && getCurrentTask() == TASK_FOLLOW) { + setCurrentTask(TASK_IDLE, null); } - if(getCurrentTask() == expand && getAITarget() == null){ + if(getCurrentTask() == TASK_BUILD_HIVE && getAITarget() == null) { this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10 * 20, 3)); } - if (getCurrentTask() == terraform) { + if(getCurrentTask() == TASK_TERRAFORM) { this.setHealth(0); } - } } + /** Communicates only with glyphid scouts, unlike the super implementation which does the opposite */ @Override public void communicate(int task, @Nullable EntityWaypoint waypoint) { int radius = waypoint != null ? waypoint.radius : 4; @@ -99,7 +97,6 @@ public class EntityGlyphidNuclear extends EntityGlyphid { @Override public boolean isArmorBroken(float amount) { - // amount < 5 ? 5 : amount < 10 ? 3 : 2; return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.12, 2), 100); } @@ -131,9 +128,11 @@ public class EntityGlyphidNuclear extends EntityGlyphid { ++this.deathTicks; if(!hasWaypoint) { - communicate(reinforcements, null); + // effectively causes neighboring EntityGlyphidScout to retreat + communicate(TASK_INITIATE_RETREAT, null); hasWaypoint = true; } + if(deathTicks == 90){ int radius = 8; AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java index c1a24ad99..1ceaf824c 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java @@ -17,7 +17,6 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.*; import net.minecraft.world.World; -import javax.annotation.Nullable; import java.util.List; public class EntityGlyphidScout extends EntityGlyphid { @@ -28,6 +27,7 @@ public class EntityGlyphidScout extends EntityGlyphid { int minDistanceToHive = 8; boolean useLargeHive = false; float largeHiveChance = MobConfig.largeHiveChance; + public EntityGlyphidScout(World world) { super(world); this.setSize(1.25F, 0.75F); @@ -42,6 +42,7 @@ public class EntityGlyphidScout extends EntityGlyphid { } return false; } + @Override public ResourceLocation getSkin() { return ResourceManager.glyphid_scout_tex; @@ -64,14 +65,14 @@ public class EntityGlyphidScout extends EntityGlyphid { this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D); } + @Override public void onUpdate() { - super.onUpdate(); - if((getCurrentTask() != expand || getCurrentTask() != terraform) && taskWaypoint == null) { + if((getCurrentTask() != TASK_BUILD_HIVE || getCurrentTask() != TASK_TERRAFORM) && taskWaypoint == null) { - if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){ + if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){ if(!hasTarget) { Vec3 dirVec = playerBaseDirFinder( Vec3.createVectorHelper(posX, posY, posZ), @@ -84,62 +85,51 @@ public class EntityGlyphidScout extends EntityGlyphid { worldObj.spawnEntityInWorld(target); hasTarget = true; - setCurrentTask(1, target); + setCurrentTask(TASK_RETREAT_FOR_REINFORCEMENTS, target); } if(super.isAtDestination()) { - setCurrentTask(2, null) ; + setCurrentTask(TASK_BUILD_HIVE, null) ; hasTarget = false; } } else { - setCurrentTask(2, null); + setCurrentTask(TASK_BUILD_HIVE, null); } } - if(getCurrentTask() == expand || getCurrentTask() == terraform) { + if(getCurrentTask() == TASK_BUILD_HIVE || getCurrentTask() == TASK_TERRAFORM) { if(!worldObj.isRemote && !hasTarget) { //Check for whether a big man johnson is nearby, this makes the scout switch into its terraforming task - if(scoutingRange != 60 && findJohnson()){ - setCurrentTask(5, null); + if(scoutingRange != 60 && hasNuclearGlyphidNearby()){ + setCurrentTask(TASK_TERRAFORM, null); } - //Placeholder for a more advanced hive design - /* - if(PollutionHandler.getPollution(worldObj, - (int) posX, - (int) posY, - (int) posZ, PollutionHandler.PollutionType.SOOT) >= MobConfig.largeHiveThreshold){ - - useLargeHive = true; - this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 3)); - }*/ - - if (expandHive()){ - this.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 180*20, 1)); + if(expandHive()) { + this.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 180 * 20, 1)); hasTarget = true; } } - if (getCurrentTask() == terraform && super.isAtDestination() && doubleCheckHive()) { - communicate(terraform, taskWaypoint); + if (getCurrentTask() == TASK_TERRAFORM && super.isAtDestination() && canBuildHiveHere()) { + communicate(TASK_TERRAFORM, taskWaypoint); } if (ticksExisted % 10 == 0 && isAtDestination()) { timer++; - if (!worldObj.isRemote && doubleCheckHive()) { + if (!worldObj.isRemote && canBuildHiveHere()) { if(timer == 1) { EntityWaypoint additional = new EntityWaypoint(worldObj); additional.setLocationAndAngles(posX, posY, posZ, 0, 0); - additional.setWaypointType(none); + additional.setWaypointType(TASK_IDLE); //First, go home and get reinforcements EntityWaypoint home = new EntityWaypoint(worldObj); - home.setWaypointType(comm); + home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS); home.setAdditionalWaypoint(additional); home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); home.maxAge = 1200; @@ -149,7 +139,7 @@ public class EntityGlyphidScout extends EntityGlyphid { this.taskWaypoint = home; this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10)); - communicate(comm, taskWaypoint); + communicate(TASK_RETREAT_FOR_REINFORCEMENTS, taskWaypoint); } else if (timer >= 5) { @@ -161,15 +151,19 @@ public class EntityGlyphidScout extends EntityGlyphid { this.setDead(); } else { - communicate(follow, taskWaypoint); + communicate(TASK_FOLLOW, taskWaypoint); } } } } } - public boolean doubleCheckHive(){ + + /** Returns true if the position is far enough away from other hives. Also resets the task if unsuccessful. */ + public boolean canBuildHiveHere() { int length = useLargeHive ? 16 : 8; + for(int i = 0; i < 8; i++) { + float angle = (float) Math.toRadians(360D / 16 * i); Vec3 rot = Vec3.createVectorHelper(0, 0, length); rot.rotateAroundY(angle); @@ -177,12 +171,12 @@ public class EntityGlyphidScout extends EntityGlyphid { Vec3 nextPos = Vec3.createVectorHelper(this.posX + rot.xCoord, this.posY + 1, this.posZ + rot.zCoord); MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos); - if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if(mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); - if (block == ModBlocks.glyphid_base) { - setCurrentTask(none ,null); + if(block == ModBlocks.glyphid_base) { + setCurrentTask(TASK_IDLE, null); hasTarget = false; return false; } @@ -194,10 +188,10 @@ public class EntityGlyphidScout extends EntityGlyphid { @Override public boolean isAtDestination() { - return this.getCurrentTask() == expand && super.isAtDestination(); + return this.getCurrentTask() == TASK_BUILD_HIVE && super.isAtDestination(); } - public boolean findJohnson(){ + public boolean hasNuclearGlyphidNearby(){ int radius = 8; AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( @@ -209,6 +203,7 @@ public class EntityGlyphidScout extends EntityGlyphid { this.posZ + radius); List bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); + for (Entity e: bugs){ if(e instanceof EntityGlyphidNuclear){ return true; @@ -220,51 +215,50 @@ public class EntityGlyphidScout extends EntityGlyphid { @Override public boolean expandHive() { - int nestX = rand.nextInt((homeX + scoutingRange) - (homeX - scoutingRange)) + (homeX - scoutingRange); - int nestZ = rand.nextInt((homeZ + scoutingRange) - (homeZ - scoutingRange)) + (homeZ - scoutingRange); - int nestY = worldObj.getHeightValue(nestX, nestZ); - Block b = worldObj.getBlock(nestX, nestY - 1, nestZ); + int nestX = rand.nextInt((homeX + scoutingRange) - (homeX - scoutingRange)) + (homeX - scoutingRange); + int nestZ = rand.nextInt((homeZ + scoutingRange) - (homeZ - scoutingRange)) + (homeZ - scoutingRange); + int nestY = worldObj.getHeightValue(nestX, nestZ); + Block b = worldObj.getBlock(nestX, nestY - 1, nestZ); - boolean distanceCheck = Vec3.createVectorHelper( - nestX - homeX, - nestY - homeY, - nestZ - homeZ).lengthVector() > minDistanceToHive; + boolean distanceCheck = Vec3.createVectorHelper(nestX - homeX, nestY - homeY, nestZ - homeZ).lengthVector() > minDistanceToHive; - if(distanceCheck && b.getMaterial() != Material.air && b.isNormalCube() && b != ModBlocks.glyphid_base) { + if(distanceCheck && b.getMaterial() != Material.air && b.isNormalCube() && b != ModBlocks.glyphid_base) { - if(b == ModBlocks.basalt) { - useLargeHive = true; - largeHiveChance /= 2; - this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 3)); - } - if(!worldObj.isRemote) { - EntityWaypoint nest = new EntityWaypoint(worldObj); - nest.setWaypointType(getCurrentTask()); - nest.radius = 5; + if(b == ModBlocks.basalt) { + useLargeHive = true; + largeHiveChance /= 2; + this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 3)); + } + + if(!worldObj.isRemote) { + EntityWaypoint nest = new EntityWaypoint(worldObj); + nest.setWaypointType(getCurrentTask()); + nest.radius = 5; - if(useLargeHive) - nest.setHighPriority(); + if(useLargeHive) + nest.setHighPriority(); - nest.setLocationAndAngles(nestX, nestY, nestZ, 0, 0); - worldObj.spawnEntityInWorld(nest); + nest.setLocationAndAngles(nestX, nestY, nestZ, 0, 0); + worldObj.spawnEntityInWorld(nest); - taskWaypoint = nest; + taskWaypoint = nest; - //updates the task coordinates - setCurrentTask(getCurrentTask(), taskWaypoint); - communicate(expand, taskWaypoint); - } - return true; - } - return false; + // updates the task coordinates + setCurrentTask(getCurrentTask(), taskWaypoint); + communicate(TASK_BUILD_HIVE, taskWaypoint); + } + + return true; + } + + return false; } - @Override public void carryOutTask() { if (!worldObj.isRemote && taskWaypoint == null) { switch(getCurrentTask()){ - case reinforcements: + case TASK_INITIATE_RETREAT: this.removePotionEffect(Potion.moveSlowdown.id); this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 20, 4)); @@ -283,23 +277,25 @@ public class EntityGlyphidScout extends EntityGlyphid { worldObj.spawnEntityInWorld(home); communicate(4, home); - break; + break; //terraforming task, only used if a big man johnson is near the scout - case terraform: + case TASK_TERRAFORM: scoutingRange = 60; minDistanceToHive = 20; + break; } } super.carryOutTask(); } + @Override public boolean useExtendedTargeting() { return false; } - ///RAMPANT MODE STUFFS + ///RAMPANT MODE STUFFS /** Finds the direction from the bug's location to the target and adds it to their current coord * Used as a performant way to make scouts expand toward the player's spawn point diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index a25849cd1..348f1704c 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -302,7 +302,6 @@ public class OreDictManager { /** Any special post-RBMK gating material, namely bismuth and arsenic */ public static final DictFrame ANY_BISMOID = new DictFrame("AnyBismoid"); public static final DictFrame ANY_ASH = new DictFrame("Ash"); - /** Any, nevermind, this should be self-explanatory**/ public static void registerOres() { diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index 4c83847b2..5cc0ee007 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -328,12 +328,12 @@ public class Fluids { HEAVYWATER_HOT = new FluidType("HEAVYWATER_HOT", 0x4D007B, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID); SODIUM = new FluidType("SODIUM", 0xCCD4D5, 1, 2, 3, EnumSymbol.NONE).setTemp(400).addTraits(LIQUID); SODIUM_HOT = new FluidType("SODIUM_HOT", 0xE2ADC1, 1, 2, 3, EnumSymbol.NONE).setTemp(1200).addTraits(LIQUID); - PHEROMONE = new FluidType("PHEROMONE", 0x5FA6E8, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(1)); - PHEROMONE_M = new FluidType("PHEROMONE_M", 0x48C9B0 , 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(2)); THORIUM_SALT = new FluidType("THORIUM_SALT", 0x7A5542, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, new FT_Corrosive(65)); THORIUM_SALT_HOT = new FluidType("THORIUM_SALT_HOT", 0x3E3627, 2, 0, 3, EnumSymbol.NONE).setTemp(1600).addTraits(LIQUID, new FT_Corrosive(65)); THORIUM_SALT_DEPLETED = new FluidType("THORIUM_SALT_DEPLETED", 0x302D1C, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, new FT_Corrosive(65)); FULLERENE = new FluidType(132, "FULLERENE", 0xFF7FED, 3, 3, 3, EnumSymbol.NONE).addTraits(LIQUID, new FT_Corrosive(65)); + PHEROMONE = new FluidType("PHEROMONE", 0x5FA6E8, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(1)); + PHEROMONE_M = new FluidType("PHEROMONE_M", 0x48C9B0 , 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(2)); // ^ ^ ^ ^ ^ ^ ^ ^ //ADD NEW FLUIDS HERE diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index ad1a4a00b..3d82a99ed 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -522,7 +522,7 @@ public class ClientProxy extends ServerProxy { MinecraftForgeClient.registerItemRenderer(ModItems.gun_quadro, new ItemRenderWeaponQuadro()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_sauer, new ItemRenderWeaponSauer()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_vortex, new ItemRenderWeaponVortex()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_thompson, new ItemRenderWeaponThompson());; + MinecraftForgeClient.registerItemRenderer(ModItems.gun_thompson, new ItemRenderWeaponThompson()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolter, new ItemRenderWeaponBolter()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolter_digamma, new ItemRenderWeaponBolter()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_fireext, new ItemRenderFireExt()); diff --git a/src/main/java/com/hbm/world/feature/GlyphidHive.java b/src/main/java/com/hbm/world/feature/GlyphidHive.java index f7c83e76f..f0ddf5c41 100644 --- a/src/main/java/com/hbm/world/feature/GlyphidHive.java +++ b/src/main/java/com/hbm/world/feature/GlyphidHive.java @@ -4,8 +4,6 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; -import net.minecraft.block.Block; -import com.hbm.util.LootGenerator; import net.minecraft.init.Blocks; import net.minecraft.world.World; diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 44f03fd5b..720fc1d5f 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -2390,6 +2390,8 @@ item.dieselsuit_helmet.name=Diesel-Powered Head-Mounted Environmental Sensor item.dieselsuit_legs.name=Diesel-Powered Leg Servos item.dieselsuit_plate.name=Diesel-Powered Cybernetics item.digamma_diagnostic.name=Digamma Diagnostic +item.disperser_canister.name= Disperser Canister: +item.disperser_canister_empty.name= Disperser Canister item.dns_boots.name=DNT Nano Suit Boots item.dns_legs.name=DNT Nano Suit Leggings item.dns_helmet.name=DNT Nano Suit Helmet @@ -2616,13 +2618,8 @@ item.grenade_smart.name=Smart Grenade item.grenade_strong.name=Enhanced Grenade item.grenade_tau.name=Tau Grenade item.grenade_zomg.name=Negative Energy Pair Annihilation Grenade - -item.disperser_canister.name= Disperser Canister: -item.disperser_canister_empty.name= Disperser Canister - item.glyphid_gland.name= Gland item.glyphid_gland_empty.name= Glyphid's Fluid Gland - item.gun_ar15.name=Josh item.gun_avenger.name=CZ57 Avenger Minigun item.gun_b92.name=§9B92 Energy Pistol§r @@ -4887,9 +4884,7 @@ tile.door_office.name=Office Door tile.ducrete.name=Ducrete Tile tile.ducrete_stairs.name=Ducrete Tile Stairs tile.ducrete_smooth.name=Ducrete - tile.ducrete_smooth_stairs.name=Ducrete Stairs - tile.dummy_block.name=Dummy Block tile.dummy_port.name=Dummy Block (Electricity Port) tile.dungeon_chain.name=Metal Chain