initial cleanup

This commit is contained in:
Boblet 2023-12-13 11:08:01 +01:00
parent 3d319a1b15
commit 8a59eb9dbc
11 changed files with 133 additions and 159 deletions

View File

@ -39,7 +39,7 @@ public class MobConfig {
public static int swarmCooldown = 120; public static int swarmCooldown = 120;
public static int baseSwarmSize = 5; 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 sootStep = 50;
public static int[] glyphidChance = {50, -40}; 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" + "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" + "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" + "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" + "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" + "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" + "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 spawning chance is: (chance + (modifier - modifier / (soot/10)))"
+ "The formula for glyphid swarm scaling is: (baseSwarmSize * Math.max(swarmScalingMult * soot/sootStep, 1))"); + "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}); 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}); 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" + "\n"
+ "Glyphid Scouts will naturally spawn alongside normal mobs if soot levels are above a certain threshold\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" + "Glyphids will always have the extended targetting enabled\n"

View File

@ -3,15 +3,12 @@ package com.hbm.entity.mob;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.generic.BlockGlyphidSpawner;
import com.hbm.config.MobConfig; import com.hbm.config.MobConfig;
import com.hbm.entity.logic.EntityWaypoint; import com.hbm.entity.logic.EntityWaypoint;
import com.hbm.entity.pathfinder.PathFinderUtils; import com.hbm.entity.pathfinder.PathFinderUtils;
import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.interfaces.IExplosionSFX;
import com.hbm.explosion.vanillant.standard.*; import com.hbm.explosion.vanillant.standard.*;
import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType; 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 //used for digging, bigger glyphids have a longer reach
public int blastSize = Math.min((int) (3 * (getScale()))/2, 5); 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; public boolean shouldDig;
// Tasks // Tasks
public static final int none = 0; /** Idle state, only makes glpyhids wander around randomly */
public static final int comm = 1; public static final int TASK_IDLE = 0;
public static final int expand = 2; /** Causes the glyphid to walk to the waypoint, then communicate the FOLLOW task to nearby glyphids */
public static final int reinforcements = 3; public static final int TASK_RETREAT_FOR_REINFORCEMENTS = 1;
public static final int follow = 4; /** Task used by scouts, if the waypoint is reached it will construct a new hive */
public static final int terraform = 5; public static final int TASK_BUILD_HIVE = 2;
public static final int dig = 6; /** 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; EntityWaypoint taskWaypoint = null;
public EntityGlyphid(World world) { public EntityGlyphid(World world) {
super(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); this.setSize(1.75F, 1F);
} }
@ -124,14 +122,14 @@ public class EntityGlyphid extends EntityMob {
onBlinded(); onBlinded();
} }
if(getCurrentTask() == follow){ if(getCurrentTask() == TASK_FOLLOW){
//incase the waypoint somehow doesn't exist and it got this task anyway //incase the waypoint somehow doesn't exist and it got this task anyway
if(isAtDestination() && taskX == none) { if(isAtDestination() && taskX == TASK_IDLE) {
setCurrentTask(none, null); setCurrentTask(TASK_IDLE, null);
} }
//the task cannot be 6 outside of rampant, so this is a non issue p much //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(); swingItem();
ExplosionVNT vnt = new ExplosionVNT(worldObj, taskX, taskY + 2, taskZ, blastSize, this); ExplosionVNT vnt = new ExplosionVNT(worldObj, taskX, taskY + 2, taskZ, blastSize, this);
@ -156,8 +154,8 @@ public class EntityGlyphid extends EntityMob {
@Override @Override
protected void dropFewItems(boolean byPlayer, int looting) { protected void dropFewItems(boolean byPlayer, int looting) {
super.dropFewItems(byPlayer, looting); super.dropFewItems(byPlayer, looting);
Item drop = isBurning() ? ModItems.glyphid_meat_grilled : ModItems.glyphid_meat; 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); if(rand.nextInt(2) == 0) this.entityDropItem(new ItemStack(drop, ((int) getScale() * 2) + looting), 0F);
} }
@Override @Override
@ -170,7 +168,7 @@ public class EntityGlyphid extends EntityMob {
@Override @Override
protected void updateWanderPath() { protected void updateWanderPath() {
if(getCurrentTask() == none) { if(getCurrentTask() == TASK_IDLE) {
super.updateWanderPath(); super.updateWanderPath();
} }
} }
@ -185,7 +183,7 @@ public class EntityGlyphid extends EntityMob {
// hell yeah!! // hell yeah!!
if (useExtendedTargeting() && this.entityToAttack != null) { if (useExtendedTargeting() && this.entityToAttack != null) {
this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, true, true)); 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"); this.worldObj.theProfiler.startSection("stroll");
@ -203,11 +201,11 @@ public class EntityGlyphid extends EntityMob {
} }
if (taskX != none) { if (taskX != TASK_IDLE) {
if(MobConfig.rampantDig) { if(MobConfig.rampantDig) {
MovingObjectPosition obstacle = findWaypointObstruction(); MovingObjectPosition obstacle = findWaypointObstruction();
if (getScale() >= 1 && getCurrentTask() != dig && obstacle != null) { if (getScale() >= 1 && getCurrentTask() != TASK_DIG && obstacle != null) {
digToWaypoint(obstacle); digToWaypoint(obstacle);
} else { } else {
Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ); Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ);
@ -222,19 +220,18 @@ public class EntityGlyphid extends EntityMob {
} }
} }
} }
this.worldObj.theProfiler.endSection(); this.worldObj.theProfiler.endSection();
} }
} }
} }
} }
public void onBlinded(){ public void onBlinded(){
this.entityToAttack = null; this.entityToAttack = null;
this.setPathToEntity(null); this.setPathToEntity(null);
fleeingTick = 80; this.fleeingTick = 80;
if(getScale() >= 1.25){ if(getScale() >= 1.25){
if(ticksExisted % 20 == 0) { if(ticksExisted % 20 == 0) {
@ -253,8 +250,6 @@ public class EntityGlyphid extends EntityMob {
if (block == ModBlocks.lantern) { if (block == ModBlocks.lantern) {
rotationYaw = 360F / 16 * i; rotationYaw = 360F / 16 * i;
swingItem(); 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); worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false);
} }
@ -270,7 +265,7 @@ public class EntityGlyphid extends EntityMob {
@Override @Override
protected boolean canDespawn() { protected boolean canDespawn() {
return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == none; return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == TASK_IDLE;
} }
@Override @Override
@ -454,16 +449,16 @@ public class EntityGlyphid extends EntityMob {
switch(task){ switch(task){
//call for reinforcements //call for reinforcements
case comm: if(taskWaypoint != null){ case TASK_RETREAT_FOR_REINFORCEMENTS: if(taskWaypoint != null){
communicate(follow, taskWaypoint); communicate(TASK_FOLLOW, taskWaypoint);
setCurrentTask(follow, taskWaypoint); setCurrentTask(TASK_FOLLOW, taskWaypoint);
} break; } break;
//expand the hive, used by the scout //expand the hive, used by the scout
//case 2: expandHive(null); //case 2: expandHive(null);
//retreat //retreat
case reinforcements: case TASK_INITIATE_RETREAT:
if (!worldObj.isRemote && taskWaypoint == null) { if (!worldObj.isRemote && taskWaypoint == null) {
@ -473,15 +468,15 @@ public class EntityGlyphid extends EntityMob {
//First, go home and get reinforcements //First, go home and get reinforcements
EntityWaypoint home = new EntityWaypoint(worldObj); EntityWaypoint home = new EntityWaypoint(worldObj);
home.setWaypointType(comm); home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS);
home.setAdditionalWaypoint(additional); home.setAdditionalWaypoint(additional);
home.setHighPriority(); home.setHighPriority();
home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0);
worldObj.spawnEntityInWorld(home); worldObj.spawnEntityInWorld(home);
this.taskWaypoint = home; this.taskWaypoint = home;
communicate(follow, home); communicate(TASK_FOLLOW, home);
setCurrentTask(follow, taskWaypoint); setCurrentTask(TASK_FOLLOW, taskWaypoint);
break; break;
} }
@ -492,7 +487,7 @@ public class EntityGlyphid extends EntityMob {
//fifth task is used only in the scout and big man johnson, for terraforming //fifth task is used only in the scout and big man johnson, for terraforming
//dig //dig
case dig: case TASK_DIG:
shouldDig = true; shouldDig = true;
break; 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; int radius = waypoint != null ? waypoint.radius : 4;
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( 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 * @return Whether it has expanded successfully or not
* **/ * **/
public boolean expandHive(){ public boolean expandHive(){
@ -532,10 +528,9 @@ public class EntityGlyphid extends EntityMob {
public boolean isAtDestination() { public boolean isAtDestination() {
int destinationRadius = taskWaypoint != null ? (int) Math.pow(taskWaypoint.radius, 2) : 25; int destinationRadius = taskWaypoint != null ? (int) Math.pow(taskWaypoint.radius, 2) : 25;
return this.getDistanceSq(taskX, taskY, taskZ) <= destinationRadius; return this.getDistanceSq(taskX, taskY, taskZ) <= destinationRadius;
} }
///TASK SYSTEM END ///TASK SYSTEM END
///DIGGING SYSTEM START ///DIGGING SYSTEM START
@ -564,17 +559,17 @@ public class EntityGlyphid extends EntityMob {
previousTask = getCurrentTask(); previousTask = getCurrentTask();
previousWaypoint = getWaypoint(); previousWaypoint = getWaypoint();
setCurrentTask(dig, target); setCurrentTask(TASK_DIG, target);
Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ); Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ);
int maxDist = (int) (Math.sqrt(vec.squareDistanceTo(taskX, taskY, taskZ)) * 1.2); 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)); this.setPathToEntity(PathFinderUtils.getPathEntityToCoordPartial(worldObj, this, taskX, taskY, taskZ, maxDist, true, false, true, true));
communicate(dig, target); communicate(TASK_DIG, target);
} }
///DIGGING END ///DIGGING END
@Override @Override
public void writeEntityToNBT(NBTTagCompound nbt) { public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt); super.writeEntityToNBT(nbt);
@ -608,5 +603,4 @@ public class EntityGlyphid extends EntityMob {
this.currentTask = nbt.getInteger("task"); this.currentTask = nbt.getInteger("task");
} }
} }

View File

@ -2,8 +2,6 @@ package com.hbm.entity.mob;
import com.hbm.entity.effect.EntityMist; import com.hbm.entity.effect.EntityMist;
import com.hbm.entity.projectile.EntityChemical; 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.inventory.fluid.Fluids;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
@ -11,14 +9,12 @@ import com.hbm.main.ResourceManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
public class EntityGlyphidBehemoth extends EntityGlyphid { public class EntityGlyphidBehemoth extends EntityGlyphid {
@ -100,7 +96,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid {
@Override @Override
protected void dropFewItems(boolean byPlayer, int looting) { 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); super.dropFewItems(byPlayer, looting);
} }
@Override @Override

View File

@ -1,15 +1,12 @@
package com.hbm.entity.mob; package com.hbm.entity.mob;
import com.hbm.entity.effect.EntityMist; import com.hbm.entity.effect.EntityMist;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -1,7 +1,6 @@
package com.hbm.entity.mob; package com.hbm.entity.mob;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.entity.effect.EntityMist;
import com.hbm.entity.logic.EntityWaypoint; import com.hbm.entity.logic.EntityWaypoint;
import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; 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.BlockProcessorStandard;
import com.hbm.explosion.vanillant.standard.EntityProcessorStandard; import com.hbm.explosion.vanillant.standard.EntityProcessorStandard;
import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.main.ResourceManager; import com.hbm.main.ResourceManager;
import com.hbm.packet.AuxParticlePacketNT; import com.hbm.packet.AuxParticlePacketNT;
@ -50,22 +48,22 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
@Override @Override
public void onUpdate() { public void onUpdate() {
super.onUpdate(); super.onUpdate();
if (ticksExisted % 20 == 0) { if(ticksExisted % 20 == 0) {
if (isAtDestination() && getCurrentTask() == follow) { if(isAtDestination() && getCurrentTask() == TASK_FOLLOW) {
setCurrentTask(none, null); 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)); this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10 * 20, 3));
} }
if (getCurrentTask() == terraform) { if(getCurrentTask() == TASK_TERRAFORM) {
this.setHealth(0); this.setHealth(0);
} }
} }
} }
/** Communicates only with glyphid scouts, unlike the super implementation which does the opposite */
@Override @Override
public void communicate(int task, @Nullable EntityWaypoint waypoint) { public void communicate(int task, @Nullable EntityWaypoint waypoint) {
int radius = waypoint != null ? waypoint.radius : 4; int radius = waypoint != null ? waypoint.radius : 4;
@ -99,7 +97,6 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
@Override @Override
public boolean isArmorBroken(float amount) { 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); 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; ++this.deathTicks;
if(!hasWaypoint) { if(!hasWaypoint) {
communicate(reinforcements, null); // effectively causes neighboring EntityGlyphidScout to retreat
communicate(TASK_INITIATE_RETREAT, null);
hasWaypoint = true; hasWaypoint = true;
} }
if(deathTicks == 90){ if(deathTicks == 90){
int radius = 8; int radius = 8;
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(

View File

@ -17,7 +17,6 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.*; import net.minecraft.util.*;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class EntityGlyphidScout extends EntityGlyphid { public class EntityGlyphidScout extends EntityGlyphid {
@ -28,6 +27,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
int minDistanceToHive = 8; int minDistanceToHive = 8;
boolean useLargeHive = false; boolean useLargeHive = false;
float largeHiveChance = MobConfig.largeHiveChance; float largeHiveChance = MobConfig.largeHiveChance;
public EntityGlyphidScout(World world) { public EntityGlyphidScout(World world) {
super(world); super(world);
this.setSize(1.25F, 0.75F); this.setSize(1.25F, 0.75F);
@ -42,6 +42,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
} }
return false; return false;
} }
@Override @Override
public ResourceLocation getSkin() { public ResourceLocation getSkin() {
return ResourceManager.glyphid_scout_tex; return ResourceManager.glyphid_scout_tex;
@ -64,14 +65,14 @@ public class EntityGlyphidScout extends EntityGlyphid {
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D);
} }
@Override @Override
public void onUpdate() { public void onUpdate() {
super.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) { if(!hasTarget) {
Vec3 dirVec = playerBaseDirFinder( Vec3 dirVec = playerBaseDirFinder(
Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(posX, posY, posZ),
@ -84,62 +85,51 @@ public class EntityGlyphidScout extends EntityGlyphid {
worldObj.spawnEntityInWorld(target); worldObj.spawnEntityInWorld(target);
hasTarget = true; hasTarget = true;
setCurrentTask(1, target); setCurrentTask(TASK_RETREAT_FOR_REINFORCEMENTS, target);
} }
if(super.isAtDestination()) { if(super.isAtDestination()) {
setCurrentTask(2, null) ; setCurrentTask(TASK_BUILD_HIVE, null) ;
hasTarget = false; hasTarget = false;
} }
} else { } 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) { if(!worldObj.isRemote && !hasTarget) {
//Check for whether a big man johnson is nearby, this makes the scout switch into its terraforming task //Check for whether a big man johnson is nearby, this makes the scout switch into its terraforming task
if(scoutingRange != 60 && findJohnson()){ if(scoutingRange != 60 && hasNuclearGlyphidNearby()){
setCurrentTask(5, null); setCurrentTask(TASK_TERRAFORM, null);
} }
//Placeholder for a more advanced hive design if(expandHive()) {
/* this.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 180 * 20, 1));
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));
hasTarget = true; hasTarget = true;
} }
} }
if (getCurrentTask() == terraform && super.isAtDestination() && doubleCheckHive()) { if (getCurrentTask() == TASK_TERRAFORM && super.isAtDestination() && canBuildHiveHere()) {
communicate(terraform, taskWaypoint); communicate(TASK_TERRAFORM, taskWaypoint);
} }
if (ticksExisted % 10 == 0 && isAtDestination()) { if (ticksExisted % 10 == 0 && isAtDestination()) {
timer++; timer++;
if (!worldObj.isRemote && doubleCheckHive()) { if (!worldObj.isRemote && canBuildHiveHere()) {
if(timer == 1) { if(timer == 1) {
EntityWaypoint additional = new EntityWaypoint(worldObj); EntityWaypoint additional = new EntityWaypoint(worldObj);
additional.setLocationAndAngles(posX, posY, posZ, 0, 0); additional.setLocationAndAngles(posX, posY, posZ, 0, 0);
additional.setWaypointType(none); additional.setWaypointType(TASK_IDLE);
//First, go home and get reinforcements //First, go home and get reinforcements
EntityWaypoint home = new EntityWaypoint(worldObj); EntityWaypoint home = new EntityWaypoint(worldObj);
home.setWaypointType(comm); home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS);
home.setAdditionalWaypoint(additional); home.setAdditionalWaypoint(additional);
home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0);
home.maxAge = 1200; home.maxAge = 1200;
@ -149,7 +139,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
this.taskWaypoint = home; this.taskWaypoint = home;
this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10)); this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10));
communicate(comm, taskWaypoint); communicate(TASK_RETREAT_FOR_REINFORCEMENTS, taskWaypoint);
} else if (timer >= 5) { } else if (timer >= 5) {
@ -161,15 +151,19 @@ public class EntityGlyphidScout extends EntityGlyphid {
this.setDead(); this.setDead();
} else { } 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; int length = useLargeHive ? 16 : 8;
for(int i = 0; i < 8; i++) { for(int i = 0; i < 8; i++) {
float angle = (float) Math.toRadians(360D / 16 * i); float angle = (float) Math.toRadians(360D / 16 * i);
Vec3 rot = Vec3.createVectorHelper(0, 0, length); Vec3 rot = Vec3.createVectorHelper(0, 0, length);
rot.rotateAroundY(angle); 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); Vec3 nextPos = Vec3.createVectorHelper(this.posX + rot.xCoord, this.posY + 1, this.posZ + rot.zCoord);
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos); 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); Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
if (block == ModBlocks.glyphid_base) { if(block == ModBlocks.glyphid_base) {
setCurrentTask(none ,null); setCurrentTask(TASK_IDLE, null);
hasTarget = false; hasTarget = false;
return false; return false;
} }
@ -194,10 +188,10 @@ public class EntityGlyphidScout extends EntityGlyphid {
@Override @Override
public boolean isAtDestination() { 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; int radius = 8;
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(
@ -209,6 +203,7 @@ public class EntityGlyphidScout extends EntityGlyphid {
this.posZ + radius); this.posZ + radius);
List<Entity> bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); List<Entity> bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb);
for (Entity e: bugs){ for (Entity e: bugs){
if(e instanceof EntityGlyphidNuclear){ if(e instanceof EntityGlyphidNuclear){
return true; return true;
@ -220,51 +215,50 @@ public class EntityGlyphidScout extends EntityGlyphid {
@Override @Override
public boolean expandHive() { public boolean expandHive() {
int nestX = rand.nextInt((homeX + scoutingRange) - (homeX - scoutingRange)) + (homeX - scoutingRange); int nestX = rand.nextInt((homeX + scoutingRange) - (homeX - scoutingRange)) + (homeX - scoutingRange);
int nestZ = rand.nextInt((homeZ + scoutingRange) - (homeZ - scoutingRange)) + (homeZ - scoutingRange); int nestZ = rand.nextInt((homeZ + scoutingRange) - (homeZ - scoutingRange)) + (homeZ - scoutingRange);
int nestY = worldObj.getHeightValue(nestX, nestZ); int nestY = worldObj.getHeightValue(nestX, nestZ);
Block b = worldObj.getBlock(nestX, nestY - 1, nestZ); Block b = worldObj.getBlock(nestX, nestY - 1, nestZ);
boolean distanceCheck = Vec3.createVectorHelper( boolean distanceCheck = Vec3.createVectorHelper(nestX - homeX, nestY - homeY, nestZ - homeZ).lengthVector() > minDistanceToHive;
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) { if(b == ModBlocks.basalt) {
useLargeHive = true; useLargeHive = true;
largeHiveChance /= 2; largeHiveChance /= 2;
this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 3)); this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 3));
} }
if(!worldObj.isRemote) {
EntityWaypoint nest = new EntityWaypoint(worldObj); if(!worldObj.isRemote) {
nest.setWaypointType(getCurrentTask()); EntityWaypoint nest = new EntityWaypoint(worldObj);
nest.radius = 5; nest.setWaypointType(getCurrentTask());
nest.radius = 5;
if(useLargeHive) if(useLargeHive)
nest.setHighPriority(); nest.setHighPriority();
nest.setLocationAndAngles(nestX, nestY, nestZ, 0, 0); nest.setLocationAndAngles(nestX, nestY, nestZ, 0, 0);
worldObj.spawnEntityInWorld(nest); worldObj.spawnEntityInWorld(nest);
taskWaypoint = nest; taskWaypoint = nest;
//updates the task coordinates // updates the task coordinates
setCurrentTask(getCurrentTask(), taskWaypoint); setCurrentTask(getCurrentTask(), taskWaypoint);
communicate(expand, taskWaypoint); communicate(TASK_BUILD_HIVE, taskWaypoint);
} }
return true;
} return true;
return false; }
return false;
} }
@Override @Override
public void carryOutTask() { public void carryOutTask() {
if (!worldObj.isRemote && taskWaypoint == null) { if (!worldObj.isRemote && taskWaypoint == null) {
switch(getCurrentTask()){ switch(getCurrentTask()){
case reinforcements: case TASK_INITIATE_RETREAT:
this.removePotionEffect(Potion.moveSlowdown.id); this.removePotionEffect(Potion.moveSlowdown.id);
this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 20, 4)); this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 20, 4));
@ -283,23 +277,25 @@ public class EntityGlyphidScout extends EntityGlyphid {
worldObj.spawnEntityInWorld(home); worldObj.spawnEntityInWorld(home);
communicate(4, home); communicate(4, home);
break; break;
//terraforming task, only used if a big man johnson is near the scout //terraforming task, only used if a big man johnson is near the scout
case terraform: case TASK_TERRAFORM:
scoutingRange = 60; scoutingRange = 60;
minDistanceToHive = 20; minDistanceToHive = 20;
break;
} }
} }
super.carryOutTask(); super.carryOutTask();
} }
@Override @Override
public boolean useExtendedTargeting() { public boolean useExtendedTargeting() {
return false; 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 /** 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 * Used as a performant way to make scouts expand toward the player's spawn point

View File

@ -302,7 +302,6 @@ public class OreDictManager {
/** Any special post-RBMK gating material, namely bismuth and arsenic */ /** Any special post-RBMK gating material, namely bismuth and arsenic */
public static final DictFrame ANY_BISMOID = new DictFrame("AnyBismoid"); public static final DictFrame ANY_BISMOID = new DictFrame("AnyBismoid");
public static final DictFrame ANY_ASH = new DictFrame("Ash"); public static final DictFrame ANY_ASH = new DictFrame("Ash");
/** Any, nevermind, this should be self-explanatory**/
public static void registerOres() { public static void registerOres() {

View File

@ -328,12 +328,12 @@ public class Fluids {
HEAVYWATER_HOT = new FluidType("HEAVYWATER_HOT", 0x4D007B, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID); 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 = 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); 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 = 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_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)); 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)); 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 //ADD NEW FLUIDS HERE

View File

@ -522,7 +522,7 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.gun_quadro, new ItemRenderWeaponQuadro()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_quadro, new ItemRenderWeaponQuadro());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_sauer, new ItemRenderWeaponSauer()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_sauer, new ItemRenderWeaponSauer());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_vortex, new ItemRenderWeaponVortex()); 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, new ItemRenderWeaponBolter());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolter_digamma, new ItemRenderWeaponBolter()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolter_digamma, new ItemRenderWeaponBolter());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_fireext, new ItemRenderFireExt()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_fireext, new ItemRenderFireExt());

View File

@ -4,8 +4,6 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import net.minecraft.block.Block;
import com.hbm.util.LootGenerator;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -2390,6 +2390,8 @@ item.dieselsuit_helmet.name=Diesel-Powered Head-Mounted Environmental Sensor
item.dieselsuit_legs.name=Diesel-Powered Leg Servos item.dieselsuit_legs.name=Diesel-Powered Leg Servos
item.dieselsuit_plate.name=Diesel-Powered Cybernetics item.dieselsuit_plate.name=Diesel-Powered Cybernetics
item.digamma_diagnostic.name=Digamma Diagnostic 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_boots.name=DNT Nano Suit Boots
item.dns_legs.name=DNT Nano Suit Leggings item.dns_legs.name=DNT Nano Suit Leggings
item.dns_helmet.name=DNT Nano Suit Helmet 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_strong.name=Enhanced Grenade
item.grenade_tau.name=Tau Grenade item.grenade_tau.name=Tau Grenade
item.grenade_zomg.name=Negative Energy Pair Annihilation 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.name= Gland
item.glyphid_gland_empty.name= Glyphid's Fluid Gland item.glyphid_gland_empty.name= Glyphid's Fluid Gland
item.gun_ar15.name=Josh item.gun_ar15.name=Josh
item.gun_avenger.name=CZ57 Avenger Minigun item.gun_avenger.name=CZ57 Avenger Minigun
item.gun_b92.name=§9B92 Energy Pistol§r 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.name=Ducrete Tile
tile.ducrete_stairs.name=Ducrete Tile Stairs tile.ducrete_stairs.name=Ducrete Tile Stairs
tile.ducrete_smooth.name=Ducrete tile.ducrete_smooth.name=Ducrete
tile.ducrete_smooth_stairs.name=Ducrete Stairs tile.ducrete_smooth_stairs.name=Ducrete Stairs
tile.dummy_block.name=Dummy Block tile.dummy_block.name=Dummy Block
tile.dummy_port.name=Dummy Block (Electricity Port) tile.dummy_port.name=Dummy Block (Electricity Port)
tile.dungeon_chain.name=Metal Chain tile.dungeon_chain.name=Metal Chain