diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java index f02a8efba..f2acc1999 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java @@ -1,7 +1,7 @@ package com.hbm.blocks.generic; -import java.util.List; -import java.util.Random; +import java.util.*; +import java.util.function.Function; import com.hbm.config.MobConfig; import com.hbm.entity.mob.EntityGlyphid; @@ -16,9 +16,13 @@ import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.items.ModItems; + +import com.hbm.util.Tuple.Pair; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.EnumDifficulty; @@ -34,6 +38,18 @@ public class BlockGlyphidSpawner extends BlockContainer { public Item getItemDropped(int meta, Random rand, int fortune) { return ModItems.egg_glyphid; } + private static final ArrayList, int[]>> spawnMap = new ArrayList<>(); + + static{ + //big thanks to martin for the suggestion of using functions + spawnMap.add(new Pair<>(EntityGlyphid::new, MobConfig.glyphidChance)); + spawnMap.add(new Pair<>(EntityGlyphidBombardier::new, MobConfig.bombardierChance)); + spawnMap.add(new Pair<>(EntityGlyphidBrawler::new, MobConfig.brawlerChance)); + spawnMap.add(new Pair<>(EntityGlyphidBlaster::new, MobConfig.blasterChance)); + spawnMap.add(new Pair<>(EntityGlyphidBehemoth::new, MobConfig.behemothChance)); + spawnMap.add(new Pair<>(EntityGlyphidBrenda::new, MobConfig.brendaChance)); + spawnMap.add(new Pair<>(EntityGlyphidNuclear::new, MobConfig.johnsonChance)); + } @Override public int quantityDropped(int meta, int fortune, Random rand) { @@ -46,47 +62,88 @@ public class BlockGlyphidSpawner extends BlockContainer { } public static class TileEntityGlpyhidSpawner extends TileEntity { - + + boolean initialSpawn = true; + @Override public void updateEntity() { - - if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 60 == 0 && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) { - - int count = 0; - - for(Object e : worldObj.loadedEntityList) { - if(e instanceof EntityGlyphid) { - count++; - if(count >= MobConfig.spawnMax) return; - } - } + float soot; + + if(!worldObj.isRemote && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) { + + if (initialSpawn || worldObj.getTotalWorldTime() % MobConfig.swarmCooldown == 0) { + + if (worldObj.getBlock(xCoord, yCoord + 1, zCoord) != Blocks.air) { + return; + } + int count = 0; + + for (Object e : worldObj.loadedEntityList) { + if (e instanceof EntityGlyphid) { + count++; + if (count >= MobConfig.spawnMax) return; + } + } + + List list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 6, yCoord + 1, zCoord - 6, xCoord + 7, yCoord + 9, zCoord + 7)); + soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT); + + if (list.size() <= 3) { + + ArrayList currentSwarm = createSwarm(soot); + + for (EntityGlyphid glyphid : currentSwarm) { + glyphid.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F); + worldObj.spawnEntityInWorld(glyphid); + glyphid.moveEntity(worldObj.rand.nextGaussian(), 0, worldObj.rand.nextGaussian()); + } + + if (!initialSpawn && worldObj.rand.nextInt(MobConfig.scoutSwarmSpawnChance + 1) == 0 && soot >= MobConfig.scoutThreshold) { + EntityGlyphidScout scout = new EntityGlyphidScout(worldObj); + scout.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F); + worldObj.spawnEntityInWorld(scout); + } + + initialSpawn = false; + + } - float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT); - List list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 6, yCoord + 1, zCoord - 6, xCoord + 7, yCoord + 9, zCoord + 7)); - - if(list.size() < 3) { - EntityGlyphid glyphid = createGlyphid(soot); - glyphid.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F); - this.worldObj.spawnEntityInWorld(glyphid); - } - - if(worldObj.rand.nextInt(20) == 0 && soot >= MobConfig.scoutThreshold) { - EntityGlyphidScout scout = new EntityGlyphidScout(worldObj); - scout.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F); - this.worldObj.spawnEntityInWorld(scout); } } } - - public EntityGlyphid createGlyphid(float soot) { + + public ArrayList createSwarm(float soot) { + Random rand = new Random(); - if(soot < MobConfig.tier2Threshold) return rand.nextInt(5) == 0 ? new EntityGlyphidBombardier(worldObj) : new EntityGlyphid(worldObj); - if(soot < MobConfig.tier3Threshold) return rand.nextInt(5) == 0 ? new EntityGlyphidBombardier(worldObj) : new EntityGlyphidBrawler(worldObj); - if(soot < MobConfig.tier4Threshold) return rand.nextInt(5) == 0 ? new EntityGlyphidBlaster(worldObj) : new EntityGlyphidBehemoth(worldObj); - if(soot < MobConfig.tier5Threshold) return rand.nextInt(5) == 0 ? new EntityGlyphidBlaster(worldObj) : new EntityGlyphidBrenda(worldObj); + ArrayList currentSpawns = new ArrayList<>(); - return rand.nextInt(3) == 0 ? new EntityGlyphidBlaster(worldObj) : new EntityGlyphidNuclear(worldObj); + int swarmAmount = (int) Math.min(MobConfig.baseSwarmSize * Math.max(MobConfig.swarmScalingMult * (soot / MobConfig.sootStep), 1), 10); + + while(currentSpawns.size() <= swarmAmount) { + //(dys)functional programing + for (Pair, int[]> glyphid : spawnMap) { + + int[] chance = glyphid.getValue(); + int adjustedChance = (int) (chance[0] + (chance[1] - chance[1] / Math.max(((soot + 1)/3 ), 1))); + if (rand.nextInt(100) <= adjustedChance) { + currentSpawns.add(glyphid.getKey().apply(worldObj)); + } + } + } + return currentSpawns; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + nbt.setBoolean("initialSpawn", initialSpawn); + } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.initialSpawn = nbt.getBoolean("initialSpawn"); } } } diff --git a/src/main/java/com/hbm/config/CommonConfig.java b/src/main/java/com/hbm/config/CommonConfig.java index 7e121b26e..578f98bef 100644 --- a/src/main/java/com/hbm/config/CommonConfig.java +++ b/src/main/java/com/hbm/config/CommonConfig.java @@ -74,7 +74,11 @@ public class CommonConfig { prop.comment = comment; return prop.getString(); } - + public static int[] createConfigIntList(Configuration config, String category, String name, String comment, int[] def){ + Property prop = config.get(category, name, def); + prop.comment = comment; + return prop.getIntList(); + } public static String[] createConfigStringList(Configuration config, String category, String name, String comment) { Property prop = config.get(category, name, new String[] { "PLACEHOLDER" }); prop.comment = comment; diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index 8ce250f40..59f6c9e3f 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -30,14 +30,41 @@ public class MobConfig { public static boolean enableHives = true; public static int hiveSpawn = 256; - public static double scoutThreshold = 0.1; - public static double tier2Threshold = 1; - public static double tier3Threshold = 10; - public static double tier4Threshold = 50; - public static double tier5Threshold = 100; + public static double scoutThreshold = 5; + public static int scoutSwarmSpawnChance = 2; + public static boolean waypointDebug = false; + public static int largeHiveChance = 5; + public static int largeHiveThreshold = 30; + + public static int swarmCooldown = 120; + + public static int baseSwarmSize = 5; + public static double swarmScalingMult = 1.2; + public static int sootStep = 50; + + public static int[] glyphidChance = {50, -40}; + public static int[] brawlerChance = {5, 35}; + public static int[] bombardierChance = {20, -15}; + public static int[] blasterChance = {-15, 40}; + public static int[] behemothChance = {-30, 45}; + public static int[] brendaChance = {-50, 60}; + public static int[] johnsonChance = {-50, 60}; + public static double spawnMax = 50; + public static boolean enableInfestation = true; + public static double baseInfestChance = 5; public static double targetingThreshold = 1; - + + public static boolean rampantMode = false; + public static boolean rampantNaturalScoutSpawn = false; + public static double rampantScoutSpawnThresh = 20; + public static int rampantScoutSpawnChance = 1000; + public static boolean scoutInitialSpawn = false; + public static boolean rampantExtendedTargetting = false; + public static boolean rampantDig = false; + public static boolean rampantGlyphidGuidance = false; + public static double rampantSmokeStackOverride = 0.4; + public static double pollutionMult = 3; public static void loadFromConfig(Configuration config) { @@ -69,12 +96,90 @@ public class MobConfig { enableHives = CommonConfig.createConfigBool(config, CATEGORY, "12.G00_enableHives", "Whether glyphid hives should spawn", true); hiveSpawn = CommonConfig.createConfigInt(config, CATEGORY, "12.G01_hiveSpawn", "The average amount of chunks per hive", 256); - scoutThreshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G02_scoutThreshold", "Minimum amount of soot for scouts to spawn", 0.1); - tier2Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G03_tier2Threshold", "Minimum amount of soot for tier 2 glyphids to spawn", 1); - tier3Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G04_tier3Threshold", "Minimum amount of soot for tier 3 glyphids to spawn", 10); - tier4Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G05_tier4Threshold", "Minimum amount of soot for tier 4 glyphids to spawn", 50); - tier5Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G06_tier5Threshold", "Minimum amount of soot for tier 5 glyphids to spawn", 100); + scoutThreshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G02_scoutThreshold", "Minimum amount of soot for scouts to spawn", 1); spawnMax = CommonConfig.createConfigDouble(config, CATEGORY, "12.G07_spawnMax", "Maximum amount of glyphids being able to exist at once through natural spawning", 50); targetingThreshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G08_targetingThreshold", "Minimum amount of soot required for glyphids' extended targeting range to activate", 1D); + + scoutSwarmSpawnChance = CommonConfig.createConfigInt(config, CATEGORY,"12.G10_scoutSwarmSpawn", "How likely are scouts to spawn in swarms, 1 in x chance format", 2); + + largeHiveChance = CommonConfig.createConfigInt(config, CATEGORY,"12.G11_largeHiveChance", "The chance for a large hive to spawn, formula: 1/x", 5); + largeHiveThreshold = CommonConfig.createConfigInt(config, CATEGORY,"12.G12_largeHiveThreshold", "The soot threshold for a large hive to spawn", 20); + + waypointDebug = CommonConfig.createConfigBool(config, CATEGORY,"12.G13_waypointDebug", "Allows glyphid waypoints to be seen, mainly used for debugging, also useful as an aid against them", false); + + //Infested structures + enableInfestation= CommonConfig.createConfigBool(config, CATEGORY, "12.I01_enableInfestation", "Whether structures infested with glyphids should spawn", true); + baseInfestChance = CommonConfig.createConfigDouble(config, CATEGORY, "12.I02_baseInfestChance", "The chance for infested structures to spawn", 5); + + //Glyphid spawn stuff + config.addCustomCategoryComment(CATEGORY, + "General Glyphid spawn logic configuration\n" + + "\n" + + "The chances work in a simple way:\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" + + "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" + + "And its place will be taken over by another one.\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))"); + + + baseSwarmSize = CommonConfig.createConfigInt(config, CATEGORY, "12.GS01_baseSwarmSize", "The basic, soot-less swarm size", 5); + swarmScalingMult = CommonConfig.createConfigDouble(config, CATEGORY, "12.GS02_swarmScalingMult", "By how much should swarm size scale by per soot amount determined below", 1.2); + sootStep = CommonConfig.createConfigInt(config, CATEGORY, "12.GS03_sootStep", "The soot amount the above multiplier applies to the swarm size", 50); + swarmCooldown = CommonConfig.createConfigInt(config, CATEGORY, "12.GS04_swarmCooldown", "How often do glyphid swarms spawn, in seconds", 120) * 20; + + glyphidChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC01_glyphidChance", "Base Spawn chance and soot modifier for a glyphid grunt", new int[]{50, -45}); + brawlerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC02_brawlerChance", "Base Spawn chance and soot modifier for a glyphid brawler", new int[]{10, 30}); + bombardierChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC03_bombardierChance", "Base Spawn chance and soot modifier for a glyphid bombardier", new int[]{20, -15}); + blasterChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC04_blasterChance", "Base Spawn chance and soot modifier for a glyphid blaster", new int[]{-5, 40}); + behemothChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC05_behemothChance", "Base Spawn chance and soot modifier for a glyphid behemoth", new int[]{-30, 45}); + 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" + + "\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 can dig to waypoints\n" + + "The Glyphids will expand always toward your base\n" + + "Scouts will spawn from the start, making glyphids start expanding off the bat\n" + + "Smokestacks have reduced efficiency, only reducing soot by 40%\n"; + + config.addCustomCategoryComment(CATEGORY,rampantDesc); + + rampantMode = CommonConfig.createConfigBool(config, CATEGORY, "12.R01_rampantMode", "The main rampant mode toggle, enables all other features associated with it", false); + + config.addCustomCategoryComment(CATEGORY, "The individual features of rampant can be used regardless of whether the main rampant toggle is enabled or not"); + + rampantNaturalScoutSpawn = CommonConfig.createConfigBool(config, CATEGORY,"12.R02_rampantScoutSpawn", "Whether scouts should spawn natually in highly polluted chunks", false); + rampantScoutSpawnChance = CommonConfig.createConfigInt(config, CATEGORY, "12.R02.1_rampantScoutSpawnChance", "How much soot is needed for scouts to naturally spawn", 20); + rampantScoutSpawnThresh = CommonConfig.createConfigDouble(config, CATEGORY, "12.R02.2_rampantScoutSpawnThresh", "How often scouts naturally spawn per mob population, 1/x format, the bigger the number, the more uncommon the scouts", 600); + rampantExtendedTargetting = CommonConfig.createConfigBool(config, CATEGORY,"12.R03_rampantExtendedTargeting", "Whether Glyphids should have the extended targetting always enabled", false); + rampantDig = CommonConfig.createConfigBool(config, CATEGORY,"12.R04_rampantDig", "Whether Glyphids should be able to dig to waypoints", false); + rampantGlyphidGuidance = CommonConfig.createConfigBool(config, CATEGORY,"12.R05_rampantGlyphidGuidance", "Whether Glyphids should always expand toward a player's spawnpoint", false); + rampantSmokeStackOverride = CommonConfig.createConfigDouble(config, CATEGORY, "12.R06_rampantSmokeStackOverride", "How much should the smokestack multiply soot by when on rampant mode", 0.4); + scoutInitialSpawn = CommonConfig.createConfigBool(config, CATEGORY,"12.R07_scoutInitialSpawn", "Whether glyphid scouts should be able to spawn on the first swarm of a hive, causes glyphids to expand significantly faster", false); + pollutionMult = CommonConfig.createConfigDouble(config, CATEGORY, "12.R08_pollutionMult", "A multiplier for soot emitted, whether you want to increase or decrease it", 1); + + if(rampantMode){ + rampantNaturalScoutSpawn = true; + rampantExtendedTargetting = true; + rampantDig = true; + rampantGlyphidGuidance = true; + scoutSwarmSpawnChance = 1; + scoutThreshold = 0.1; + RadiationConfig.pollutionSpreadThreshold = 25; + if(pollutionMult == 1) { + pollutionMult = 2; + RadiationConfig.pollutionSpreadEfficiency = 0.2 / pollutionMult; + } + else RadiationConfig.pollutionSpreadEfficiency = 0.1 / pollutionMult; + RadiationConfig.sootFogThreshold *= pollutionMult; + + } } } diff --git a/src/main/java/com/hbm/config/RadiationConfig.java b/src/main/java/com/hbm/config/RadiationConfig.java index 25be90304..11498ab0b 100644 --- a/src/main/java/com/hbm/config/RadiationConfig.java +++ b/src/main/java/com/hbm/config/RadiationConfig.java @@ -31,6 +31,9 @@ public class RadiationConfig { public static double buffMobThreshold = 15D; public static double sootFogThreshold = 35D; public static double sootFogDivisor = 120D; + public static double smokeStackSootMult = 0.8; + public static int pollutionSpreadThreshold = 15; + public static double pollutionSpreadEfficiency = 0.05D; public static void loadFromConfig(Configuration config) { @@ -68,5 +71,8 @@ public class RadiationConfig { buffMobThreshold = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_05_buffMobThreshold", "The amount of soot required to buff naturally spawning mobs", 15D); sootFogThreshold = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_06_sootFogThreshold", "How much soot is required for smog to become visible", 35D); sootFogDivisor = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_07_sootFogDivisor", "The divisor for smog, higher numbers will require more soot for the same smog density", 120D); + smokeStackSootMult = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_08_smokeStackSootMult", "How much does smokestack multiply soot by, with decimal values reducing the soot", 0.8); + pollutionSpreadThreshold = CommonConfig.createConfigInt(config, CATEGORY_POL, "POL_09_pollutionSpreadThreshold", "The amount of soot required for it to be spread to nearby chunks, causes it to concentrate more", 15); + pollutionSpreadEfficiency = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_10_pollutionSpreadEfficiency", "How much soot will be spread to nearby chunks at once (percentage), values higher than 0.05 may cause infinite feedback loop of soot", 0.05); } } diff --git a/src/main/java/com/hbm/entity/EntityMappings.java b/src/main/java/com/hbm/entity/EntityMappings.java index 16a452ba5..4c33cab1f 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -233,7 +233,10 @@ public class EntityMappings { addEntity(TrainCargoTram.class, "entity_ntm_cargo_tram", 250, false); addEntity(TrainCargoTramTrailer.class, "entity_ntm_cargo_tram_trailer", 250, false); addEntity(TrainTunnelBore.class, "entity_ntm_tunnel_bore", 250, false); - + + addEntity(EntityDisperserCanister.class, "entity_disperser", 250, false); + addEntity(EntityWaypoint.class, "entity_waypoint", 250, false); + addMob(EntityCreeperNuclear.class, "entity_mob_nuclear_creeper", 0x204131, 0x75CE00); addMob(EntityCreeperTainted.class, "entity_mob_tainted_creeper", 0x813b9b, 0xd71fdd); addMob(EntityCreeperPhosgene.class, "entity_mob_phosgene_creeper", 0xE3D398, 0xB8A06B); diff --git a/src/main/java/com/hbm/entity/effect/EntityMist.java b/src/main/java/com/hbm/entity/effect/EntityMist.java index ceb2dc014..713ebf06e 100644 --- a/src/main/java/com/hbm/entity/effect/EntityMist.java +++ b/src/main/java/com/hbm/entity/effect/EntityMist.java @@ -2,15 +2,13 @@ package com.hbm.entity.effect; import java.util.List; +import com.hbm.entity.mob.EntityGlyphid; +import com.hbm.entity.projectile.EntityChemical; import com.hbm.extprop.HbmLivingProps; import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; -import com.hbm.inventory.fluid.trait.FT_Corrosive; -import com.hbm.inventory.fluid.trait.FT_Flammable; -import com.hbm.inventory.fluid.trait.FT_Poison; -import com.hbm.inventory.fluid.trait.FT_Toxin; -import com.hbm.inventory.fluid.trait.FT_VentRadiation; +import com.hbm.inventory.fluid.trait.*; import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous; import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Gaseous_ART; import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Liquid; @@ -25,13 +23,16 @@ import com.hbm.util.ContaminationUtil.HazardType; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class EntityMist extends Entity { @@ -40,12 +41,16 @@ public class EntityMist extends Entity { super(world); this.noClip = true; } - + public int maxAge = 150; public EntityMist setArea(float width, float height) { this.dataWatcher.updateObject(11, width); this.dataWatcher.updateObject(12, height); return this; } + public EntityMist setDuration(int duration){ + this.maxAge = duration; + return this; + } @Override protected void entityInit() { @@ -74,7 +79,7 @@ public class EntityMist extends Entity { if(!worldObj.isRemote) { - if(this.ticksExisted > this.getMaxAge()) { + if(this.ticksExisted >= this.getMaxAge()) { this.setDead(); } @@ -128,7 +133,7 @@ public class EntityMist extends Entity { EntityLivingBase living = e instanceof EntityLivingBase ? (EntityLivingBase) e : null; if(type.temperature >= 100) { - EntityDamageUtil.attackEntityFromIgnoreIFrame(e, new DamageSource(ModDamageSource.s_boil), 5F + (type.temperature - 100) * 0.02F); + EntityDamageUtil.attackEntityFromIgnoreIFrame(e, new DamageSource(ModDamageSource.s_boil), 0.2F + (type.temperature - 100) * 0.02F); if(type.temperature >= 500) { e.setFire(10); //afterburn for 10 seconds @@ -136,7 +141,7 @@ public class EntityMist extends Entity { } if(type.temperature < -20) { if(living != null) { //only living things are affected - EntityDamageUtil.attackEntityFromIgnoreIFrame(e, new DamageSource(ModDamageSource.s_cryolator), 5F + (type.temperature + 20) * -0.05F); //5 damage at -20°C with one extra damage every -20°C + EntityDamageUtil.attackEntityFromIgnoreIFrame(e, new DamageSource(ModDamageSource.s_cryolator), 0.2F + (type.temperature + 20) * -0.05F); //5 damage at -20°C with one extra damage every -20°C living.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2)); living.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 100, 4)); } @@ -160,11 +165,11 @@ public class EntityMist extends Entity { if(type.hasTrait(FT_Corrosive.class)) { FT_Corrosive trait = type.getTrait(FT_Corrosive.class); - EntityDamageUtil.attackEntityFromIgnoreIFrame(e, new DamageSource(ModDamageSource.s_acid), trait.getRating() / 20F); if(living != null) { + EntityDamageUtil.attackEntityFromIgnoreIFrame(living, ModDamageSource.acid, trait.getRating() / 60F); for(int i = 0; i < 4; i++) { - ArmorUtil.damageSuit(living, i, trait.getRating() / 5); + ArmorUtil.damageSuit(living, i, trait.getRating() / 50); } } } @@ -191,14 +196,37 @@ public class EntityMist extends Entity { trait.affect(living, intensity); } } + + if(type == Fluids.ENDERJUICE && living != null){ + teleportRandomly(living); + } + + if(type.hasTrait(FT_Pheromone.class)){ + + FT_Pheromone pheromone = type.getTrait(FT_Pheromone.class); + + if(living != null) { + if ((living instanceof EntityGlyphid && pheromone.getType() == 1) || (living instanceof EntityPlayer && pheromone.getType() == 2)) { + int mult = pheromone.getType(); + + living.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, mult * 60 * 20, 1)); + living.addPotionEffect(new PotionEffect(Potion.digSpeed.id, mult * 60 * 20, 1)); + living.addPotionEffect(new PotionEffect(Potion.regeneration.id, mult * 2 * 20, 0)); + living.addPotionEffect(new PotionEffect(Potion.resistance.id, mult * 60 * 20, 0)); + living.addPotionEffect(new PotionEffect(Potion.damageBoost.id, mult * 60 * 20, 1)); + living.addPotionEffect(new PotionEffect(Potion.fireResistance.id, mult * 60 * 20, 0)); + + } + } + } } protected boolean isExtinguishing(FluidType type) { - return this.getStyleFromType(type) == SprayStyle.MIST && this.getType().temperature < 50 && !type.hasTrait(FT_Flammable.class); + return this.getType().temperature < 50 && !type.hasTrait(FT_Flammable.class); } public int getMaxAge() { - return getStyleFromType(this.getType()) == SprayStyle.GAS ? 600 : 150; + return maxAge; } @Override @@ -242,10 +270,76 @@ public class EntityMist extends Entity { return SprayStyle.NULL; } - + public static enum SprayStyle { MIST, //liquids that have been sprayed into a mist GAS, //things that were already gaseous NULL } + + //terribly copy-pasted from EntityChemical.class, whose method was terribly copy-pasted from EntityEnderman.class + //the fun never ends + public void teleportRandomly(Entity e) { + double x = this.posX + (this.rand.nextDouble() - 0.5D) * 64.0D; + double y = this.posY + (double) (this.rand.nextInt(64) - 32); + double z = this.posZ + (this.rand.nextDouble() - 0.5D) * 64.0D; + this.teleportTo(e, x, y, z); + } + + public void teleportTo(Entity e, double x, double y, double z) { + + double targetX = e.posX; + double targetY = e.posY; + double targetZ = e.posZ; + e.posX = x; + e.posY = y; + e.posZ = z; + boolean flag = false; + int i = MathHelper.floor_double(e.posX); + int j = MathHelper.floor_double(e.posY); + int k = MathHelper.floor_double(e.posZ); + + if(e.worldObj.blockExists(i, j, k)) { + boolean flag1 = false; + + while(!flag1 && j > 0) { + Block block = e.worldObj.getBlock(i, j - 1, k); + + if(block.getMaterial().blocksMovement()) { + flag1 = true; + } else { + --e.posY; + --j; + } + } + + if(flag1) { + e.setPosition(e.posX, e.posY, e.posZ); + + if(e.worldObj.getCollidingBoundingBoxes(e, e.boundingBox).isEmpty() && !e.worldObj.isAnyLiquid(e.boundingBox)) { + flag = true; + } + } + } + + if(!flag) { + e.setPosition(targetX, targetY, targetZ); + } else { + short short1 = 128; + + for(int l = 0; l < short1; ++l) { + double d6 = (double) l / ((double) short1 - 1.0D); + float f = (this.rand.nextFloat() - 0.5F) * 0.2F; + float f1 = (this.rand.nextFloat() - 0.5F) * 0.2F; + float f2 = (this.rand.nextFloat() - 0.5F) * 0.2F; + double d7 = targetX + (e.posX - targetX) * d6 + (this.rand.nextDouble() - 0.5D) * (double) e.width * 2.0D; + double d8 = targetY + (e.posY - targetY) * d6 + this.rand.nextDouble() * (double) e.height; + double d9 = targetZ + (e.posZ - targetZ) * d6 + (this.rand.nextDouble() - 0.5D) * (double) e.width * 2.0D; + e.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); + } + + e.worldObj.playSoundEffect(targetX, targetY, targetZ, "mob.endermen.portal", 1.0F, 1.0F); + e.playSound("mob.endermen.portal", 1.0F, 1.0F); + } + } } diff --git a/src/main/java/com/hbm/entity/grenade/EntityDisperserCanister.java b/src/main/java/com/hbm/entity/grenade/EntityDisperserCanister.java new file mode 100644 index 000000000..a3ff8f6f8 --- /dev/null +++ b/src/main/java/com/hbm/entity/grenade/EntityDisperserCanister.java @@ -0,0 +1,76 @@ +package com.hbm.entity.grenade; + +import com.hbm.entity.effect.EntityMist; +import com.hbm.inventory.fluid.FluidType; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.items.weapon.ItemDisperser; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; + +public class EntityDisperserCanister extends EntityGrenadeBase { + public EntityDisperserCanister(World p_i1773_1_) { + super(p_i1773_1_); + } + + public EntityDisperserCanister(World p_i1774_1_, EntityLivingBase p_i1774_2_) { + super(p_i1774_1_, p_i1774_2_); + } + public EntityDisperserCanister(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) { + super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_); + } + + public EntityDisperserCanister setFluid(int id){ + this.dataWatcher.updateObject(12, id); + return this; + } + @Override + protected void entityInit() { + this.dataWatcher.addObject(12, 0); + this.dataWatcher.addObject(13, 0); + } + public EntityDisperserCanister setType(int id){ + this.dataWatcher.updateObject(13, id); + return this; + } + + public FluidType getFluid() { + return Fluids.fromID(this.dataWatcher.getWatchableObjectInt(12)); + } + public Item getType() { + return Item.getItemById(this.dataWatcher.getWatchableObjectInt(13)); + } + @Override + public void explode() { + if (!worldObj.isRemote) { + EntityMist mist = new EntityMist(worldObj); + mist.setType(getFluid()); + mist.setPosition(posX, posY, posZ); + mist.setArea(10, 5); + mist.setDuration(80); + worldObj.spawnEntityInWorld(mist); + } + } + + @Override + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setInteger("fluid", this.dataWatcher.getWatchableObjectInt(12)); + nbt.setInteger("item", this.dataWatcher.getWatchableObjectInt(13)); + } + + @Override + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + this.dataWatcher.updateObject(12, nbt.getInteger("fluid")); + this.dataWatcher.updateObject(13, nbt.getInteger("item")); + + } + + +} + + + diff --git a/src/main/java/com/hbm/entity/logic/EntityWaypoint.java b/src/main/java/com/hbm/entity/logic/EntityWaypoint.java new file mode 100644 index 000000000..87ca34199 --- /dev/null +++ b/src/main/java/com/hbm/entity/logic/EntityWaypoint.java @@ -0,0 +1,139 @@ +package com.hbm.entity.logic; + +import com.hbm.config.MobConfig; +import com.hbm.entity.mob.EntityGlyphid; +import com.hbm.entity.mob.EntityGlyphidNuclear; +import com.hbm.entity.mob.EntityGlyphidScout; +import com.hbm.main.MainRegistry; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; + +import java.util.List; + + +public class EntityWaypoint extends Entity { + public EntityWaypoint(World world) { + super(world); + this.isImmuneToFire = true; + this.noClip = true; + } + @Override + protected void entityInit() { + this.dataWatcher.addObject(10, 0); + //this.dataWatcher.addObject(11, 0); + + } + public int maxAge = 2400; + public int radius = 3; + public boolean highPriority = false; + protected EntityWaypoint additional; + public void setHighPriority(){ + highPriority = true; + } + public int getWaypointType(){ + return this.dataWatcher.getWatchableObjectInt(10); + } + + public void setAdditionalWaypoint(EntityWaypoint waypoint){ + additional = waypoint; + } + + public void setWaypointType(int waypointType) { + this.dataWatcher.updateObject(10, waypointType); + } + boolean hasSpawned = false; + public int getColor(){ + switch(getWaypointType()){ + + case 1: return 0x5FA6E8; + + case 2: + case 3: + return 0x127766; + + default: return 0x566573; + } + } + AxisAlignedBB bb; + @Override + public void onEntityUpdate() { + if (ticksExisted >= maxAge) { + this.setDead(); + } + + bb = AxisAlignedBB.getBoundingBox( + this.posX - radius, + this.posY - radius, + this.posZ - radius, + this.posX + radius, + this.posY + radius, + this.posZ + radius); + + if (!worldObj.isRemote) { + + if (ticksExisted % 40 == 0) { + + List targets = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); + + for (Entity e : targets) { + if (e instanceof EntityGlyphid) { + + EntityGlyphid bug = ((EntityGlyphid) e); + + if (additional != null && !hasSpawned) { + worldObj.spawnEntityInWorld(additional); + hasSpawned = true; + } + + boolean exceptions = bug.getWaypoint() != this + || e instanceof EntityGlyphidScout + || e instanceof EntityGlyphidNuclear; + + if(!exceptions) + bug.setCurrentTask(getWaypointType(), additional); + + if (getWaypointType() == 2) { + if (e instanceof EntityGlyphidScout) + setDead(); + } else { + setDead(); + } + + } + } + } + } else if(MobConfig.waypointDebug) { + + double x = bb.minX + (rand.nextDouble() - 0.5) * (bb.maxX - bb.minX); + double y = bb.minY + rand.nextDouble() * (bb.maxY - bb.minY); + double z = bb.minZ + (rand.nextDouble() - 0.5) * (bb.maxZ - bb.minZ); + + NBTTagCompound fx = new NBTTagCompound(); + fx.setString("type", "tower"); + fx.setFloat("lift", 0.5F); + fx.setFloat("base", 0.75F); + fx.setFloat("max", 2F); + fx.setInteger("life", 50 + worldObj.rand.nextInt(10)); + fx.setInteger("color", getColor()); + fx.setDouble("posX", x); + fx.setDouble("posY", y); + fx.setDouble("posZ", z); + MainRegistry.proxy.effectNT(fx); + } + + } + + + @Override + protected void readEntityFromNBT(NBTTagCompound nbt) { + this.setWaypointType(nbt.getInteger("type")); + } + + @Override + protected void writeEntityToNBT(NBTTagCompound nbt) { + nbt.setInteger("type", getWaypointType()); + } +} diff --git a/src/main/java/com/hbm/entity/mob/EntityCreeperPhosgene.java b/src/main/java/com/hbm/entity/mob/EntityCreeperPhosgene.java index dc6015870..c3636fa8d 100644 --- a/src/main/java/com/hbm/entity/mob/EntityCreeperPhosgene.java +++ b/src/main/java/com/hbm/entity/mob/EntityCreeperPhosgene.java @@ -37,6 +37,7 @@ public class EntityCreeperPhosgene extends EntityCreeper { mist.setType(Fluids.PHOSGENE); mist.setPosition(posX, posY, posZ); mist.setArea(10, 5); + mist.setDuration(150); worldObj.spawnEntityInWorld(mist); } } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 599b66f6a..5699f060f 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -3,29 +3,75 @@ 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; import com.hbm.items.ModItems; import com.hbm.lib.ModDamageSource; import com.hbm.main.ResourceManager; +import com.hbm.potion.HbmPotion; +import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + +import net.minecraft.util.*; + import net.minecraft.potion.Potion; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; + import net.minecraft.world.World; +import javax.annotation.Nullable; + public class EntityGlyphid extends EntityMob { + //I might have overdone it a little bit + + public boolean hasHome = false; + public int homeX; + public int homeY; + public int homeZ; + protected int currentTask = 0; + + //both of those below are used for digging, so the glyphid remembers what it was doing + protected int previousTask; + protected EntityWaypoint previousWaypoint; + public int taskX; + public int taskY; + public int taskZ; + + //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 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; + EntityWaypoint taskWaypoint = null; public EntityGlyphid(World world) { super(world); /*this.tasks.addTask(0, new EntityAISwimming(this)); @@ -38,11 +84,11 @@ public class EntityGlyphid extends EntityMob { this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));*/ this.setSize(1.75F, 1F); } - + public ResourceLocation getSkin() { return ResourceManager.glyphid_tex; } - + public double getScale() { return 1.0D; } @@ -61,102 +107,241 @@ public class EntityGlyphid extends EntityMob { this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D); } - + + @Override + public void onUpdate() { + super.onUpdate(); + + if(!worldObj.isRemote) { + if(!hasHome) { + homeX = (int) posX; + homeY = (int) posY; + homeZ = (int) posZ; + hasHome = true; + } + + if(this.isPotionActive(Potion.blindness)) { + onBlinded(); + } + + if(getCurrentTask() == follow){ + + //incase the waypoint somehow doesn't exist and it got this task anyway + if(isAtDestination() && taskX == none) { + setCurrentTask(none, 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()) { + swingItem(); + + ExplosionVNT vnt = new ExplosionVNT(worldObj, taskX, taskY + 2, taskZ, blastSize, this); + vnt.setBlockAllocator(new BlockAllocatorGlyphidDig(blastResToDig)); + vnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop()); + vnt.setEntityProcessor(null); + vnt.setPlayerProcessor(null); + vnt.explode(); + + this.setCurrentTask(previousTask, previousWaypoint); + } + + this.setBesideClimbableBlock(isCollidedHorizontally); + + if(ticksExisted % 100 == 0) { + this.swingItem(); + } + } + } + + @Override protected void dropFewItems(boolean byPlayer, int looting) { - if(rand.nextInt(3) == 0) this.entityDropItem(new ItemStack(ModItems.glyphid_meat, 1 + rand.nextInt(2) + looting), 0F); + 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); } @Override protected Entity findPlayerToAttack() { if(this.isPotionActive(Potion.blindness)) return null; - EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, useExtendedTargeting() ? 128D : 16D); - return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null; + + EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, useExtendedTargeting() && getCurrentTask() != 0 ? 128D : 16D); + return entityplayer != null && (MobConfig.rampantExtendedTargetting || canEntityBeSeen(entityplayer)) ? entityplayer : null; + } + + @Override + protected void updateWanderPath() { + if(getCurrentTask() == none) { + super.updateWanderPath(); + } } @Override protected void updateEntityActionState() { super.updateEntityActionState(); - - if(this.isPotionActive(Potion.blindness)) { - this.entityToAttack = null; - this.setPathToEntity(null); - } else { - - // hell yeah!! - if(useExtendedTargeting() && this.entityToAttack != null && !this.hasPath()) { - this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, false, true)); + + if(!this.isPotionActive(Potion.blindness)) { + if (!this.hasPath()) { + + // hell yeah!! + if (useExtendedTargeting() && this.entityToAttack != null) { + this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, true, true)); + } else if (getCurrentTask() != none) { + + this.worldObj.theProfiler.startSection("stroll"); + + if (!isAtDestination()) { + + if (taskWaypoint != null) { + + taskX = (int) taskWaypoint.posX; + taskY = (int) taskWaypoint.posY; + taskZ = (int) taskWaypoint.posZ; + + if (taskWaypoint.highPriority) { + setTarget(taskWaypoint); + } + + } + + if (taskX != none) { + if(MobConfig.rampantDig) { + + MovingObjectPosition obstacle = findWaypointObstruction(); + if (getScale() >= 1 && getCurrentTask() != dig && obstacle != null) { + digToWaypoint(obstacle); + } else { + 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)); + } + + } else { + 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)); + } + } + } + this.worldObj.theProfiler.endSection(); + + } } } } - + + + public void onBlinded(){ + this.entityToAttack = null; + this.setPathToEntity(null); + fleeingTick = 80; + + if(getScale() >= 1.25){ + if(ticksExisted % 20 == 0) { + for (int i = 0; i < 16; i++) { + float angle = (float) Math.toRadians(360D / 16 * i); + Vec3 rot = Vec3.createVectorHelper(0, 0, 4); + rot.rotateAroundY(angle); + Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY + 1, this.posZ); + 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 == mop.typeOfHit.BLOCK) { + + Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); + + 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); + } + + } + } + } + } + } + public boolean useExtendedTargeting() { - return PollutionHandler.getPollution(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), PollutionType.SOOT) >= MobConfig.targetingThreshold; + return MobConfig.rampantExtendedTargetting || PollutionHandler.getPollution(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), PollutionType.SOOT) >= MobConfig.targetingThreshold; } @Override protected boolean canDespawn() { - return entityToAttack == null; + return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == none; } - + @Override public boolean attackEntityFrom(DamageSource source, float amount) { - + if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote && !source.isFireDamage() && !source.getDamageType().equals(ModDamageSource.s_cryolator)) { byte armor = this.dataWatcher.getWatchableObjectByte(17); - + if(armor != 0) { //if at least one bit of armor is present - + if(amount < getDamageThreshold()) return false; - - int chance = getArmorBreakChance(amount); //chances of armor being broken off - if(this.rand.nextInt(chance) == 0 && amount > 1) { + + //chances of armor being broken off + if(amount > 1 && isArmorBroken(amount)) { breakOffArmor(); amount *= 0.25F; } - + amount -= getDamageThreshold(); if(amount < 0) return true; } - + amount = this.calculateDamage(amount); } - - if(source.isFireDamage()) amount *= 4F; - + + if(source.isFireDamage()) { + //you might be thinking, why would fire damage be nerfed? + //thing is, it bypasses glyphid chitin, making it unbelievably powerful, so this was the most reasonable solution + amount *= 0.7F; + } else if(source.getDamageType().equals("player")) { + amount *= 1.5F; + } else if(source == ModDamageSource.acid || source.equals(new DamageSource(ModDamageSource.s_acid))){ + amount = 0; + } + + if(this.isPotionActive(HbmPotion.phosphorus.getId())){ + amount *= 1.5F; + } + return super.attackEntityFrom(source, amount); } - - public int getArmorBreakChance(float amount) { - return amount < 10 ? 5 : amount < 20 ? 3 : 2; + + public boolean isArmorBroken(float amount) { + return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.6, 2), 100); } - + public float calculateDamage(float amount) { byte armor = this.dataWatcher.getWatchableObjectByte(17); int divisor = 1; - + for(int i = 0; i < 5; i++) { if((armor & (1 << i)) > 0) { divisor++; } } - + amount /= divisor; - + return amount; } - + public float getDamageThreshold() { return 0.5F; } - + public void breakOffArmor() { byte armor = this.dataWatcher.getWatchableObjectByte(17); List indices = Arrays.asList(0, 1, 2, 3, 4); Collections.shuffle(indices); - + for(Integer i : indices) { byte bit = (byte) (1 << i); if((armor & bit) > 0) { @@ -169,26 +354,6 @@ public class EntityGlyphid extends EntityMob { } } - @Override - public boolean attackEntityAsMob(Entity victum) { - if(this.isSwingInProgress) return false; - this.swingItem(); - return super.attackEntityAsMob(victum); - } - - @Override - public void onUpdate() { - super.onUpdate(); - - if(!this.worldObj.isRemote) { - this.setBesideClimbableBlock(this.isCollidedHorizontally); - - if(worldObj.getTotalWorldTime() % 200 == 0) { - this.swingItem(); - } - } - } - @Override protected void updateArmSwingProgress() { int i = this.swingDuration(); @@ -206,19 +371,19 @@ public class EntityGlyphid extends EntityMob { this.swingProgress = (float) this.swingProgressInt / (float) i; } - + public int swingDuration() { return 15; } @Override public void setInWeb() { } - + @Override public boolean isOnLadder() { return this.isBesideClimbableBlock(); } - + public boolean isBesideClimbableBlock() { return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; } @@ -234,21 +399,214 @@ public class EntityGlyphid extends EntityMob { this.dataWatcher.updateObject(16, Byte.valueOf(watchable)); } - + + @Override + public boolean attackEntityAsMob(Entity victum) { + if(this.isSwingInProgress) return false; + this.swingItem(); + return super.attackEntityAsMob(victum); + } + + @Override public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.ARTHROPOD; } + /// TASK SYSTEM START /// + public int getCurrentTask(){ + return currentTask; + } + + public EntityWaypoint getWaypoint(){ + return taskWaypoint; + } + + /** + * Sets a new task for the glyphid to do, a waypoint alongside with that task, and refreshes their waypoint coordinates + * @param task The task the glyphid is to do, refer to carryOutTask() + * @param waypoint The waypoint for the task, can be null + */ + public void setCurrentTask(int task, @Nullable EntityWaypoint waypoint){ + currentTask = task; + taskWaypoint = waypoint; + if (taskWaypoint != null) { + + taskX = (int) taskWaypoint.posX; + taskY = (int) taskWaypoint.posY; + taskZ = (int) taskWaypoint.posZ; + + if (taskWaypoint.highPriority) { + this.entityToAttack = null; + this.setPathToEntity(null); + } + + } + carryOutTask(); + } + + /** + * Handles the task system, used mainly for things that only need to be done once, such as setting targets + */ + public void carryOutTask(){ + int task = getCurrentTask(); + + switch(task){ + + //call for reinforcements + case comm: if(taskWaypoint != null){ + communicate(follow, taskWaypoint); + setCurrentTask(follow, taskWaypoint); + } break; + + //expand the hive, used by the scout + //case 2: expandHive(null); + + //retreat + case reinforcements: + + if (!worldObj.isRemote && taskWaypoint == null) { + + //Then, Come back later + EntityWaypoint additional = new EntityWaypoint(worldObj); + additional.setLocationAndAngles(posX, posY, posZ, 0 , 0); + + //First, go home and get reinforcements + EntityWaypoint home = new EntityWaypoint(worldObj); + home.setWaypointType(comm); + home.setAdditionalWaypoint(additional); + home.setHighPriority(); + home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); + worldObj.spawnEntityInWorld(home); + + this.taskWaypoint = home; + communicate(follow, home); + setCurrentTask(follow, taskWaypoint); + + break; + } + + break; + + //the fourth task (case 4) is to just follow the waypoint path + //fifth task is used only in the scout and big man johnson, for terraforming + + //dig + case dig: + shouldDig = true; + break; + + default: break; + + } + + } + + public void communicate(int task, @Nullable EntityWaypoint waypoint) { + int radius = waypoint != null ? waypoint.radius : 4; + + AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( + this.posX - radius, + this.posY - radius, + this.posZ - radius, + this.posX + radius, + this.posY + radius, + this.posZ + radius); + + List bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); + for (Entity e: bugs){ + if(e instanceof EntityGlyphid && !(e instanceof EntityGlyphidScout)){ + if(((EntityGlyphid) e).getCurrentTask() != task){ + ((EntityGlyphid) e).setCurrentTask(task, waypoint); + } + } + } + } + + /** 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(){ + return false; + } + + public boolean isAtDestination() { + int destinationRadius = taskWaypoint != null ? (int) Math.pow(taskWaypoint.radius, 2) : 25; + + return this.getDistanceSq(taskX, taskY, taskZ) <= destinationRadius; + } + ///TASK SYSTEM END + + ///DIGGING SYSTEM START + + /** Handles the special digging system, used in Rampant mode due to high potential for destroyed bases**/ + public MovingObjectPosition findWaypointObstruction(){ + Vec3 bugVec = Vec3.createVectorHelper(posX, posY + getEyeHeight(), posZ); + Vec3 waypointVec = Vec3.createVectorHelper(taskX, taskY, taskZ); + //incomplete forge docs my beloved + MovingObjectPosition obstruction = worldObj.func_147447_a(bugVec, waypointVec, false, true, false); + if(obstruction != null){ + Block blockHit = worldObj.getBlock(obstruction.blockX, obstruction.blockY, obstruction.blockZ); + if(blockHit.getExplosionResistance(null) <= blastResToDig){ + return obstruction; + } + } + return null; + } + + public void digToWaypoint(MovingObjectPosition obstacle){ + + EntityWaypoint target = new EntityWaypoint(worldObj); + target.setLocationAndAngles(obstacle.blockX, obstacle.blockY, obstacle.blockZ, 0 , 0); + target.radius = 5; + worldObj.spawnEntityInWorld(target); + + previousTask = getCurrentTask(); + previousWaypoint = getWaypoint(); + + setCurrentTask(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); + + } + ///DIGGING END + @Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(17)); + + nbt.setBoolean("hasHome", hasHome); + nbt.setInteger("homeX", homeX); + nbt.setInteger("homeY", homeY); + nbt.setInteger("homeZ", homeZ); + + nbt.setInteger("taskX", taskX); + nbt.setInteger("taskY", taskY); + nbt.setInteger("taskZ", taskZ); + + nbt.setInteger("task", currentTask); } @Override public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); this.dataWatcher.updateObject(17, nbt.getByte("armor")); + + this.hasHome = nbt.getBoolean("hasHome"); + this.homeX = nbt.getInteger("homeX"); + this.homeY = nbt.getInteger("homeY"); + this.homeZ = nbt.getInteger("homeZ"); + + this.taskX = nbt.getInteger("taskX"); + this.taskY = nbt.getInteger("taskY"); + this.taskZ = nbt.getInteger("taskZ"); + + 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 bf3215059..e042626c2 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java @@ -1,16 +1,30 @@ 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; +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 { public EntityGlyphidBehemoth(World world) { super(world); - this.setSize(2.25F, 1.25F); + this.setSize(2.5F, 1.5F); } @Override @@ -26,16 +40,78 @@ public class EntityGlyphidBehemoth extends EntityGlyphid { @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(130D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(25D); } + public int timer = 120; + int breathTime = 0; @Override - public int getArmorBreakChance(float amount) { - return amount < 20 ? 10 : amount < 100 ? 5 : amount > 200 ? 1 : 3; + public void onUpdate(){ + super.onUpdate(); + Entity e = this.getEntityToAttack(); + if (e == null) { + timer = 120; + breathTime = 0; + } else { + if (breathTime > 0) { + if(!isSwingInProgress){ + this.swingItem(); + } + acidAttack(); + rotationYaw = prevRotationYaw; + breathTime--; + } else if (--timer <= 0) { + breathTime = 120; + timer = 120; + } + } + + } + @Override + public boolean attackEntityAsMob(Entity victum) { + return super.attackEntityAsMob(victum); } + @Override + public void onDeath(DamageSource source) { + super.onDeath(source); + if (!worldObj.isRemote) { + EntityMist mist = new EntityMist(worldObj); + mist.setType(Fluids.ACID); + mist.setPosition(posX, posY, posZ); + mist.setArea(10, 4); + mist.setDuration(120); + worldObj.spawnEntityInWorld(mist); + } + } + + + public void acidAttack(){ + if (!worldObj.isRemote && entityToAttack instanceof EntityLivingBase) { + this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 20, 6)); + EntityChemical chem = new EntityChemical(worldObj, this); + + chem.setFluid(Fluids.ACID); + worldObj.spawnEntityInWorld(chem); + } + } + + @Override + protected void dropFewItems(boolean byPlayer, int looting) { + this.entityDropItem(new ItemStack(ModItems.glyphid_gland, 1, Fluids.SULFURIC_ACID.getID()), 1); + super.dropFewItems(byPlayer, looting); + } + @Override + public boolean isArmorBroken(float amount) { + // amount < 5 ? 5 : amount < 10 ? 3 : 2; + return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.15, 2), 100); + } + @Override + public int swingDuration() { + return 100; + } @Override public float calculateDamage(float amount) { @@ -44,7 +120,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid { for(int i = 0; i < 5; i++) { if((armor & (1 << i)) > 0) { - divisor += 3; + divisor += 4; } } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java index 5e922ab49..4c2e649a8 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java @@ -32,8 +32,8 @@ public class EntityGlyphidBlaster extends EntityGlyphidBombardier { } @Override - public int getArmorBreakChance(float amount) { - return amount < 10 ? 10 : amount < 25 ? 5 : amount > 100 ? 1 : 3; + public boolean isArmorBroken(float amount) { + return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.25, 2), 100); } @Override @@ -70,7 +70,7 @@ public class EntityGlyphidBlaster extends EntityGlyphidBombardier { @Override public float getSpreadMult() { - return 0.75F; + return 0.5F; } @Override diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java index 61750f0ee..3b385e363 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java @@ -4,6 +4,8 @@ import com.hbm.entity.projectile.EntityAcidBomb; import com.hbm.main.ResourceManager; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -23,22 +25,26 @@ public class EntityGlyphidBombardier extends EntityGlyphid { protected double lastY; protected double lastZ; + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D); + + } @Override public void onUpdate() { super.onUpdate(); + Entity e = this.getEntityToAttack(); + if(!this.worldObj.isRemote && e instanceof EntityLivingBase) { - if(!this.worldObj.isRemote) { - - Entity e = this.getEntityToAttack(); - - if(this.ticksExisted % 20 == 0 && e != null) { + if(this.ticksExisted % 20 == 0) { this.lastTarget = e; this.lastX = e.posX; this.lastY = e.posY; this.lastZ = e.posZ; } - if(this.ticksExisted % 20 == 1 && e != null) { + if(this.ticksExisted % 20 == 1) { boolean topAttack = rand.nextBoolean(); @@ -72,6 +78,7 @@ public class EntityGlyphidBombardier extends EntityGlyphid { for(int i = 0; i < getBombCount(); i++) { EntityAcidBomb bomb = new EntityAcidBomb(worldObj, posX, posY + 1, posZ); + bomb.setThrower(this); bomb.setThrowableHeading(fireVec.xCoord, fireVec.yCoord, fireVec.zCoord, (float) v0, i * getSpreadMult()); bomb.damage = getBombDamage(); worldObj.spawnEntityInWorld(bomb); diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java index 749230a42..48d274667 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrawler.java @@ -32,19 +32,19 @@ public class EntityGlyphidBrawler extends EntityGlyphid { } @Override - public int getArmorBreakChance(float amount) { - return amount < 10 ? 10 : amount < 25 ? 5 : amount > 100 ? 1 : 3; + public boolean isArmorBroken(float amount) { + return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.25, 2), 100); } @Override public float calculateDamage(float amount) { byte armor = this.dataWatcher.getWatchableObjectByte(17); - int divisor = 1; + float divisor = 1; for(int i = 0; i < 5; i++) { if((armor & (1 << i)) > 0) { - divisor += 2; + divisor += 3; } } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java index bdce3e7bc..be4486456 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java @@ -1,10 +1,16 @@ 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; @@ -30,13 +36,14 @@ public class EntityGlyphidBrenda extends EntityGlyphid { protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.2D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D); } @Override - public int getArmorBreakChance(float amount) { - return amount < 25 ? 100 : amount > 1000 ? 1 : 10; + 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); } @Override @@ -62,20 +69,27 @@ public class EntityGlyphidBrenda extends EntityGlyphid { } @Override - public void setDead() { + public void onDeath(DamageSource source) { + super.onDeath(source); if(!this.worldObj.isRemote && this.getHealth() <= 0.0F) { + EntityMist mist = new EntityMist(worldObj); + mist.setType(Fluids.PHEROMONE); + mist.setPosition(posX, posY, posZ); + mist.setArea(14, 6); + mist.setDuration(80); + worldObj.spawnEntityInWorld(mist); for(int i = 0; i < 12; ++i) { EntityGlyphid glyphid = new EntityGlyphid(worldObj); glyphid.setLocationAndAngles(this.posX, this.posY + 0.5D, this.posZ, rand.nextFloat() * 360.0F, 0.0F); - glyphid.addPotionEffect(new PotionEffect(Potion.resistance.id, 5 * 60 * 20, 2)); - glyphid.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 5 * 60 * 20, 0)); - glyphid.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 5 * 60 * 20, 4)); - glyphid.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 5 * 60 * 20, 19)); this.worldObj.spawnEntityInWorld(glyphid); glyphid.moveEntity(rand.nextGaussian(), 0, rand.nextGaussian()); } } - - super.setDead(); } + @Override + protected void dropFewItems(boolean byPlayer, int looting) { + super.dropFewItems(byPlayer, looting); + if(rand.nextInt(3) == 0) this.entityDropItem(new ItemStack(ModItems.glyphid_gland, 1, Fluids.PHEROMONE.getID()), 1); + } + } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java index 62a3ae9a6..bb617e2b0 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java @@ -1,27 +1,36 @@ 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; 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; import com.hbm.packet.PacketDispatcher; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import javax.annotation.Nullable; +import java.util.List; + public class EntityGlyphidNuclear extends EntityGlyphid { public int deathTicks; - public EntityGlyphidNuclear(World world) { super(world); this.setSize(2.5F, 1.75F); @@ -38,17 +47,60 @@ public class EntityGlyphidNuclear extends EntityGlyphid { return 2D; } + @Override + public void onUpdate() { + super.onUpdate(); + if (ticksExisted % 20 == 0) { + if (isAtDestination() && getCurrentTask() == follow) { + setCurrentTask(none, null); + } + + if(getCurrentTask() == expand && getAITarget() == null){ + this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10 * 20, 3)); + } + + if (getCurrentTask() == terraform) { + this.setHealth(0); + } + + } + } + + @Override + public void communicate(int task, @Nullable EntityWaypoint waypoint) { + int radius = waypoint != null ? waypoint.radius : 4; + + AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( + this.posX - radius, + this.posY - radius, + this.posZ - radius, + this.posX + radius, + this.posY + radius, + this.posZ + radius); + + List bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); + for (Entity e: bugs){ + if(e instanceof EntityGlyphidScout){ + if(((EntityGlyphid) e).getCurrentTask() != task){ + ((EntityGlyphid) e).setCurrentTask(task, waypoint); + } + } + } + } + + @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(50D); } @Override - public int getArmorBreakChance(float amount) { - return amount < 25 ? 100 : amount > 1000 ? 1 : 10; + 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); } @Override @@ -73,20 +125,44 @@ public class EntityGlyphidNuclear extends EntityGlyphid { return 10F; } + public boolean hasWaypoint = false; @Override protected void onDeathUpdate() { ++this.deathTicks; + if(!hasWaypoint) { + communicate(reinforcements, null); + hasWaypoint = true; + } + if(deathTicks == 90){ + int radius = 8; + AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( + this.posX - radius, + this.posY - radius, + this.posZ - radius, + this.posX + radius, + this.posY + radius, + this.posZ + radius); + + List bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); + for (Entity e: bugs){ + if(e instanceof EntityGlyphid){ + addPotionEffect(new PotionEffect(Potion.field_76434_w.id, 20, 6)); + addPotionEffect(new PotionEffect(Potion.fireResistance.id, 15 * 20, 1)); + } + } + } if(this.deathTicks == 100) { if(!worldObj.isRemote) { + ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 25, this); vnt.setBlockAllocator(new BlockAllocatorStandard(24)); vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorDebris(ModBlocks.volcanic_lava_block, 0)).setNoDrop()); - vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(1.5F)); + vnt.setEntityProcessor(new EntityProcessorStandard()); vnt.setPlayerProcessor(new PlayerProcessorStandard()); vnt.explode(); - + worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F); NBTTagCompound data = new NBTTagCompound(); diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java index 181156e09..c1a24ad99 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java @@ -1,36 +1,47 @@ package com.hbm.entity.mob; import com.hbm.blocks.ModBlocks; +import com.hbm.config.MobConfig; +import com.hbm.entity.logic.EntityWaypoint; +import com.hbm.handler.pollution.PollutionHandler; import com.hbm.main.ResourceManager; import com.hbm.world.feature.GlyphidHive; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.*; import net.minecraft.world.World; -public class EntityGlyphidScout extends EntityGlyphid { - - public boolean hasHome = false; - public double homeX; - public double homeY; - public double homeZ; +import javax.annotation.Nullable; +import java.util.List; +public class EntityGlyphidScout extends EntityGlyphid { + + boolean hasTarget = false; + int timer; + int scoutingRange = 45; + int minDistanceToHive = 8; + boolean useLargeHive = false; + float largeHiveChance = MobConfig.largeHiveChance; public EntityGlyphidScout(World world) { super(world); this.setSize(1.25F, 0.75F); } - - @Override - public float getDamageThreshold() { - return 0.0F; - } + //extreme measures for anti-scout bullying + @Override + public boolean attackEntityAsMob(Entity victum) { + if(super.attackEntityAsMob(victum) && victum instanceof EntityLivingBase){ + ((EntityLivingBase)victum).addPotionEffect(new PotionEffect(Potion.poison.id, 10 * 20, 3)); + return true; + } + return false; + } @Override public ResourceLocation getSkin() { return ResourceManager.glyphid_scout_tex; @@ -42,116 +53,264 @@ public class EntityGlyphidScout extends EntityGlyphid { } @Override - public int getArmorBreakChance(float amount) { - return 1; + public boolean isArmorBroken(float amount) { + return this.rand.nextInt(100) <= Math.min(Math.pow(amount, 2), 100); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16D); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D); } - @Override - protected boolean canDespawn() { + public void onUpdate() { + + super.onUpdate(); + + if((getCurrentTask() != expand || getCurrentTask() != terraform) && taskWaypoint == null) { + + if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){ + if(!hasTarget) { + Vec3 dirVec = playerBaseDirFinder( + Vec3.createVectorHelper(posX, posY, posZ), + PollutionHandler.targetCoords); + + EntityWaypoint target = new EntityWaypoint(worldObj); + target.setLocationAndAngles(dirVec.xCoord, dirVec.yCoord, dirVec.zCoord, 0, 0); + target.maxAge = 300; + target.radius = 6; + worldObj.spawnEntityInWorld(target); + hasTarget = true; + + setCurrentTask(1, target); + } + + if(super.isAtDestination()) { + setCurrentTask(2, null) ; + hasTarget = false; + } + + } else { + setCurrentTask(2, null); + } + + } + + if(getCurrentTask() == expand || getCurrentTask() == 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); + } + + //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)); + hasTarget = true; + } + } + + if (getCurrentTask() == terraform && super.isAtDestination() && doubleCheckHive()) { + communicate(terraform, taskWaypoint); + } + + if (ticksExisted % 10 == 0 && isAtDestination()) { + timer++; + + if (!worldObj.isRemote && doubleCheckHive()) { + if(timer == 1) { + + EntityWaypoint additional = new EntityWaypoint(worldObj); + additional.setLocationAndAngles(posX, posY, posZ, 0, 0); + additional.setWaypointType(none); + + //First, go home and get reinforcements + EntityWaypoint home = new EntityWaypoint(worldObj); + home.setWaypointType(comm); + home.setAdditionalWaypoint(additional); + home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); + home.maxAge = 1200; + home.radius = 6; + + worldObj.spawnEntityInWorld(home); + + this.taskWaypoint = home; + this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10)); + communicate(comm, taskWaypoint); + + } else if (timer >= 5) { + + worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false); + GlyphidHive.generateBigGround(worldObj, + (int) Math.floor(posX), + (int) Math.floor(posY), + (int) Math.floor(posZ), rand, true); + this.setDead(); + + } else { + communicate(follow, taskWaypoint); + } + } + } + } + } + public boolean doubleCheckHive(){ + 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); + Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY + 1, this.posZ); + 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) { + + Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); + + if (block == ModBlocks.glyphid_base) { + setCurrentTask(none ,null); + hasTarget = false; + return false; + } + + } + } return true; } @Override - public void onUpdate() { - super.onUpdate(); - - if(!worldObj.isRemote) { - - if(!this.hasHome) { - this.homeX = posX; - this.homeY = posY; - this.homeZ = posZ; - this.hasHome = true; - } - - if(rand.nextInt(20) == 0) fleeingTick = 2; + public boolean isAtDestination() { + return this.getCurrentTask() == expand && super.isAtDestination(); + } - if(this.ticksExisted > 0 && this.ticksExisted % 1200 == 0 && Vec3.createVectorHelper(posX - homeX, posY - homeY, posZ - homeZ).lengthVector() > 8) { - - Block b = worldObj.getBlock((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ)); - - int accuracy = 16; - for(int i = 0; i < accuracy; i++) { - float angle = (float) Math.toRadians(360D / accuracy * i); - Vec3 rot = Vec3.createVectorHelper(0, 0, 16); - rot.rotateAroundY(angle); - Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY + 1, this.posZ); - Vec3 nextPos = Vec3.createVectorHelper(this.posX + rot.xCoord, this.posY + 1, this.posZ + rot.zCoord); - MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos); + public boolean findJohnson(){ + int radius = 8; + + AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( + this.posX - radius, + this.posY - radius, + this.posZ - radius, + this.posX + radius, + this.posY + radius, + this.posZ + radius); + + List bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); + for (Entity e: bugs){ + if(e instanceof EntityGlyphidNuclear){ + return true; + } + } + return false; + } + + @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); + + 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(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(); + + nest.setLocationAndAngles(nestX, nestY, nestZ, 0, 0); + worldObj.spawnEntityInWorld(nest); + + taskWaypoint = nest; + + //updates the task coordinates + setCurrentTask(getCurrentTask(), taskWaypoint); + communicate(expand, taskWaypoint); + } + return true; + } + return false; + } + + + @Override + public void carryOutTask() { + if (!worldObj.isRemote && taskWaypoint == null) { + switch(getCurrentTask()){ + case reinforcements: + this.removePotionEffect(Potion.moveSlowdown.id); + this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 20, 4)); + + //then, come back later + EntityWaypoint additional = new EntityWaypoint(worldObj); + additional.setLocationAndAngles(posX, posY, posZ, 0, 0); + additional.setWaypointType(0); - if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { - - Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); - - if(block == ModBlocks.glyphid_base) { - return; - } - } - } - - if(b.getMaterial() != Material.air && b.isNormalCube() && b != ModBlocks.glyphid_base) { - this.setDead(); - worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false); - GlyphidHive.generate(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rand); - } + //First, go home and get reinforcements + EntityWaypoint home = new EntityWaypoint(worldObj); + home.setWaypointType(2); + home.setAdditionalWaypoint(additional); + home.setHighPriority(); + home.radius = 6; + home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); + worldObj.spawnEntityInWorld(home); + + communicate(4, home); + break; + + //terraforming task, only used if a big man johnson is near the scout + case terraform: + scoutingRange = 60; + minDistanceToHive = 20; } } - } + super.carryOutTask(); + } @Override - protected void updateWanderPath() { - this.worldObj.theProfiler.startSection("stroll"); - boolean flag = false; - int pathX = -1; - int pathY = -1; - int pathZ = -1; - float maxWeight = -99999.0F; - - for(int l = 0; l < 5; ++l) { - int x = MathHelper.floor_double(this.posX + (double) this.rand.nextInt(25) - 12.0D); - int y = MathHelper.floor_double(this.posY + (double) this.rand.nextInt(11) - 5.0D); - int z = MathHelper.floor_double(this.posZ + (double) this.rand.nextInt(25) - 12.0D); - float weight = this.getBlockPathWeight(x, y, z); - - if(weight > maxWeight) { - maxWeight = weight; - pathX = x; - pathY = y; - pathZ = z; - flag = true; - } - } - - if(flag) { - this.setPathToEntity(this.worldObj.getEntityPathToXYZ(this, pathX, pathY, pathZ, 10.0F, true, false, false, true)); - } - - this.worldObj.theProfiler.endSection(); + public boolean useExtendedTargeting() { + return false; } - @Override - public void writeEntityToNBT(NBTTagCompound nbt) { - super.writeEntityToNBT(nbt); - nbt.setBoolean("hasHome", hasHome); - nbt.setDouble("homeX", homeX); - nbt.setDouble("homeY", homeY); - nbt.setDouble("homeZ", homeZ); + ///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 + * @return An adjusted direction vector, to be added into the bug's current position for it to path in the required direction**/ + public static Vec3 playerBaseDirFinder(Vec3 currentLocation, Vec3 target){ + Vec3 dirVec = currentLocation.subtract(target).normalize(); + return Vec3.createVectorHelper( + currentLocation.xCoord + dirVec.xCoord * 10, + currentLocation.yCoord + dirVec.yCoord * 10, + currentLocation.zCoord + dirVec.zCoord * 10 + ); } - @Override - public void readEntityFromNBT(NBTTagCompound nbt) { - super.readEntityFromNBT(nbt); - this.hasHome = nbt.getBoolean("hasHome"); - this.homeX = nbt.getDouble("homeX"); - this.homeY = nbt.getDouble("homeY"); - this.homeZ = nbt.getDouble("homeZ"); - } } diff --git a/src/main/java/com/hbm/entity/pathfinder/PathFinderUtils.java b/src/main/java/com/hbm/entity/pathfinder/PathFinderUtils.java index 9d5b2f36c..fc4064646 100644 --- a/src/main/java/com/hbm/entity/pathfinder/PathFinderUtils.java +++ b/src/main/java/com/hbm/entity/pathfinder/PathFinderUtils.java @@ -59,4 +59,54 @@ public class PathFinderUtils { world.theProfiler.endSection(); return pathentity; } + + public static PathEntity getPathEntityToCoordPartial(World world, Entity fromEntity, int posX, int posY, int posZ, float maxDist, boolean allowDoors, boolean allowBlocked, boolean allowWater, boolean canDrown) { + world.theProfiler.startSection("pathfind"); + int startX = MathHelper.floor_double(fromEntity.posX); + int startY = MathHelper.floor_double(fromEntity.posY + 1.0D); + int startZ = MathHelper.floor_double(fromEntity.posZ); + int maxDistEff = (int) (maxDist + 16.0F); + int minX = startX - maxDistEff; + int minY = startY - maxDistEff; + int minZ = startZ - maxDistEff; + int maxX = startX + maxDistEff; + int maxY = startY + maxDistEff; + int maxZ = startZ + maxDistEff; + ChunkCache chunkcache = new ChunkCache(world, minX, minY, minZ, maxX, maxY, maxZ, 0); + + Vec3 vec = Vec3.createVectorHelper(posX - fromEntity.posX, posY - fromEntity.posY, posZ - fromEntity.posZ); + vec = vec.normalize(); + vec.xCoord *= maxDist; + vec.yCoord *= maxDist; + vec.zCoord *= maxDist; + + int x = (int) Math.floor(fromEntity.posX + vec.xCoord); + int y = (int) Math.floor(fromEntity.posY + vec.yCoord); + int z = (int) Math.floor(fromEntity.posZ + vec.zCoord); + + //this part will adjust the end of the path so it's actually on the ground, it being unreachable causes mobs to slow down + boolean solid = false; + + for(int i = y; i > y - 10; i--) { + if(!world.getBlock(x, i, z).getMaterial().blocksMovement() && world.getBlock(x, i - 1, z).isNormalCube()) { + solid = true; + y = i; + break; + } + + } + + if(!solid) for(int i = y + 10; i > y; i--) { + if(!world.getBlock(x, i, z).getMaterial().blocksMovement() && world.getBlock(x, i - 1, z).isNormalCube()) { + solid = true; + y = i; + break; + } + } + + //PathEntity pathentity = (new PathFinder(chunkcache, allowDoors, allowBlocked, allowWater, canDrown)).createEntityPathTo(fromEntity, toEntity, maxDist); + PathEntity pathentity = (new PathFinder(chunkcache, allowDoors, allowBlocked, allowWater, canDrown)).createEntityPathTo(fromEntity, x, y, z, maxDist); + world.theProfiler.endSection(); + return pathentity; + } } diff --git a/src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java b/src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java index 8a688df2d..dd928b885 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java +++ b/src/main/java/com/hbm/entity/projectile/EntityAcidBomb.java @@ -4,6 +4,7 @@ import com.hbm.entity.mob.EntityGlyphid; import com.hbm.lib.ModDamageSource; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EntityDamageSourceIndirect; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; @@ -27,7 +28,7 @@ public class EntityAcidBomb extends EntityThrowableInterp { if(mop.typeOfHit == mop.typeOfHit.ENTITY) { if(!(mop.entityHit instanceof EntityGlyphid)) { - mop.entityHit.attackEntityFrom(ModDamageSource.acid, damage); + mop.entityHit.attackEntityFrom(new EntityDamageSourceIndirect(ModDamageSource.s_acid, this, thrower), damage); this.setDead(); } } diff --git a/src/main/java/com/hbm/entity/projectile/EntityChemical.java b/src/main/java/com/hbm/entity/projectile/EntityChemical.java index 3eb72cddc..b6119b8c8 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityChemical.java +++ b/src/main/java/com/hbm/entity/projectile/EntityChemical.java @@ -4,16 +4,13 @@ import java.awt.Color; import java.util.List; import com.hbm.blocks.ModBlocks; +import com.hbm.entity.mob.EntityGlyphid; +import com.hbm.entity.mob.EntityGlyphidBehemoth; import com.hbm.extprop.HbmLivingProps; import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; -import com.hbm.inventory.fluid.trait.FT_Combustible; -import com.hbm.inventory.fluid.trait.FT_Corrosive; -import com.hbm.inventory.fluid.trait.FT_Flammable; -import com.hbm.inventory.fluid.trait.FT_Poison; -import com.hbm.inventory.fluid.trait.FT_Toxin; -import com.hbm.inventory.fluid.trait.FT_VentRadiation; +import com.hbm.inventory.fluid.trait.*; import com.hbm.lib.ModDamageSource; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IRepairable; @@ -43,6 +40,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; + public class EntityChemical extends EntityThrowableNT { /* @@ -211,6 +209,12 @@ public class EntityChemical extends EntityThrowableNT { HbmLivingProps.setOil(living, 300); //doused in oil for 15 seconds } } + if(type.hasTrait(Fluids.DELICIOUS.getClass())) { + if(living != null && living.isEntityAlive()) { + living.heal(2F * (float) intensity); + } + } + } if(this.isExtinguishing()) { @@ -219,7 +223,7 @@ public class EntityChemical extends EntityThrowableNT { if(style == ChemicalStyle.BURNING) { FT_Combustible trait = type.getTrait(FT_Combustible.class); - EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_flamethrower), 2F + (trait != null ? (trait.getCombustionEnergy() / 100_000F) : 0)); + EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_flamethrower), 0.2F + (trait != null ? (trait.getCombustionEnergy() / 100_000F) : 0)); e.setFire(5); } @@ -229,17 +233,17 @@ public class EntityChemical extends EntityThrowableNT { float heat = Math.max(flammable != null ? flammable.getHeatEnergy() / 50_000F : 0, combustible != null ? combustible.getCombustionEnergy() / 100_000F : 0); heat *= intensity; - EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_flamethrower), (2F + heat) * (float) intensity); + EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_flamethrower), (0.2F + heat) * (float) intensity); e.setFire((int) Math.ceil(5 * intensity)); } if(type.hasTrait(FT_Corrosive.class)) { FT_Corrosive trait = type.getTrait(FT_Corrosive.class); - EntityDamageUtil.attackEntityFromIgnoreIFrame(e, getDamage(ModDamageSource.s_acid), trait.getRating() / 50F); - + if(living != null) { + EntityDamageUtil.attackEntityFromIgnoreIFrame(living, getDamage(ModDamageSource.s_acid), trait.getRating() / 50F); for(int i = 0; i < 4; i++) { - ArmorUtil.damageSuit(living, i, (int) Math.ceil(trait.getRating() / 50)); + ArmorUtil.damageSuit(living, i, trait.getRating() / 40); } } } @@ -267,6 +271,26 @@ public class EntityChemical extends EntityThrowableNT { trait.affect(living, intensity); } } + + if(type.hasTrait(FT_Pheromone.class)){ + + FT_Pheromone pheromone = type.getTrait(FT_Pheromone.class); + + if(living != null) { + living.addPotionEffect(new PotionEffect(Potion.resistance.id, 2 * 60 * 20, 2)); + living.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 5 * 60 * 20, 1)); + living.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2 * 60 * 20, 4)); + + if (living instanceof EntityGlyphid && pheromone.getType() == 1) { + living.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 5 * 60 * 20, 4)); + living.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 60 * 20, 0)); + living.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 60 * 20, 19)); + + } else if (living instanceof EntityPlayer && pheromone.getType() == 2) { + living.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 2 * 60 * 20, 2)); + } + } + } if(type == Fluids.XPJUICE) { @@ -301,14 +325,14 @@ public class EntityChemical extends EntityThrowableNT { } //terribly copy-pasted from EntityEnderman.class - protected boolean teleportRandomly(Entity e) { + public boolean teleportRandomly(Entity e) { double x = this.posX + (this.rand.nextDouble() - 0.5D) * 64.0D; double y = this.posY + (double) (this.rand.nextInt(64) - 32); double z = this.posZ + (this.rand.nextDouble() - 0.5D) * 64.0D; return this.teleportTo(e, x, y, z); } - protected boolean teleportTo(Entity e, double x, double y, double z) { + public boolean teleportTo(Entity e, double x, double y, double z) { double targetX = e.posX; double targetY = e.posY; @@ -387,7 +411,7 @@ public class EntityChemical extends EntityThrowableNT { FT_VentRadiation trait = type.getTrait(FT_VentRadiation.class); ChunkRadiationManager.proxy.incrementRad(worldObj, mop.blockX, mop.blockY, mop.blockZ, trait.getRadPerMB() * 5); } - + ChemicalStyle style = getStyle(); if(style == ChemicalStyle.BURNING || style == ChemicalStyle.GASFLAME) { @@ -401,6 +425,18 @@ public class EntityChemical extends EntityThrowableNT { } } } + + if(style == ChemicalStyle.BURNING || style == ChemicalStyle.GASFLAME) { + + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + + Block fire = type == Fluids.BALEFIRE ? ModBlocks.balefire : Blocks.fire; + + if(worldObj.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).isAir(worldObj, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) { + worldObj.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, fire); + } + } + } if(this.isExtinguishing()) { diff --git a/src/main/java/com/hbm/explosion/vanillant/standard/BlockAllocatorGlyphidDig.java b/src/main/java/com/hbm/explosion/vanillant/standard/BlockAllocatorGlyphidDig.java new file mode 100644 index 000000000..7837c81f2 --- /dev/null +++ b/src/main/java/com/hbm/explosion/vanillant/standard/BlockAllocatorGlyphidDig.java @@ -0,0 +1,90 @@ +package com.hbm.explosion.vanillant.standard; + +import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.generic.BlockGlyphidSpawner; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.interfaces.IBlockAllocator; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; + +import java.util.HashSet; + +public class BlockAllocatorGlyphidDig implements IBlockAllocator { + + protected double maximum; + protected int resolution; + + public BlockAllocatorGlyphidDig(double maximum) { + this(maximum, 16); + } + + public BlockAllocatorGlyphidDig(double maximum, int resolution) { + this.resolution = resolution; + this.maximum = maximum; + } + + @Override + public HashSet allocate(ExplosionVNT explosion, World world, double x, double y, double z, float size) { + + HashSet affectedBlocks = new HashSet(); + + for(int i = 0; i < this.resolution; ++i) { + for(int j = 0; j < this.resolution; ++j) { + for(int k = 0; k < this.resolution; ++k) { + + if(i == 0 || i == this.resolution - 1 || j == 0 || j == this.resolution - 1 || k == 0 || k == this.resolution - 1) { + + double d0 = (double) ((float) i / ((float) this.resolution - 1.0F) * 2.0F - 1.0F); + double d1 = (double) ((float) j / ((float) this.resolution - 1.0F) * 2.0F - 1.0F); + double d2 = (double) ((float) k / ((float) this.resolution - 1.0F) * 2.0F - 1.0F); + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + + d0 /= d3; + d1 /= d3; + d2 /= d3; + + double currentX = x; + double currentY = y; + double currentZ = z; + + double dist = 0; + + for(float stepSize = 0.3F; dist <= explosion.size;) { + + double deltaX = currentX - x; + double deltaY = currentY - y; + double deltaZ = currentZ - z; + dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ); + + int blockX = MathHelper.floor_double(currentX); + int blockY = MathHelper.floor_double(currentY); + int blockZ = MathHelper.floor_double(currentZ); + + Block block = world.getBlock(blockX, blockY, blockZ); + + if(block.getMaterial() != Material.air) { + float blockResistance = explosion.exploder != null ? explosion.exploder.func_145772_a(explosion.compat, world, blockX, blockY, blockZ, block) : block.getExplosionResistance(explosion.exploder, world, blockX, blockY, blockZ, x, y, z); + if(this.maximum < blockResistance || block == ModBlocks.glyphid_spawner) { + break; + } + } + + if(explosion.exploder == null || explosion.exploder.func_145774_a(explosion.compat, world, blockX, blockY, blockZ, block, explosion.size)) { + affectedBlocks.add(new ChunkPosition(blockX, blockY, blockZ)); + } + + currentX += d0 * (double) stepSize; + currentY += d1 * (double) stepSize; + currentZ += d2 * (double) stepSize; + } + } + } + } + } + + return affectedBlocks; + } +} diff --git a/src/main/java/com/hbm/handler/guncfg/Gun12GaugeFactory.java b/src/main/java/com/hbm/handler/guncfg/Gun12GaugeFactory.java index 424deacfc..0a31c1634 100644 --- a/src/main/java/com/hbm/handler/guncfg/Gun12GaugeFactory.java +++ b/src/main/java/com/hbm/handler/guncfg/Gun12GaugeFactory.java @@ -107,7 +107,7 @@ public class Gun12GaugeFactory { config.comment.add("\"Here, I have a more suitable gun for you. You'll need it - Catch!\""); config.comment.add("Alt-fire with Mouse 2 (Right-click) to fire 2 shells at once"); - config.config = HbmCollection.g12; + config.config = HbmCollection.g12hs; config.animations.put(AnimType.CYCLE, new BusAnimation() .addBus("SPAS_RECOIL_TRANSLATE", new BusAnimationSequence() diff --git a/src/main/java/com/hbm/handler/pollution/PollutionHandler.java b/src/main/java/com/hbm/handler/pollution/PollutionHandler.java index 4ff3b70c1..9255062ef 100644 --- a/src/main/java/com/hbm/handler/pollution/PollutionHandler.java +++ b/src/main/java/com/hbm/handler/pollution/PollutionHandler.java @@ -8,13 +8,16 @@ import java.util.Locale; import java.util.Map.Entry; import java.util.UUID; +import com.hbm.config.MobConfig; import com.hbm.config.RadiationConfig; +import com.hbm.entity.mob.EntityGlyphidScout; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.relauncher.Side; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.monster.IMob; @@ -22,10 +25,12 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.event.entity.living.LivingSpawnEvent; +import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; import net.minecraftforge.event.world.WorldEvent; public class PollutionHandler { @@ -37,7 +42,8 @@ public class PollutionHandler { public static final float SOOT_PER_SECOND = 1F / 25F; /** Baserate of heavy metal generation, balanced around the soot values of combustion engines */ public static final float HEAVY_METAL_PER_SECOND = 1F / 50F; - + public static Vec3 targetCoords; + /////////////////////// /// UTILITY METHODS /// /////////////////////// @@ -53,7 +59,7 @@ public class PollutionHandler { data = new PollutionData(); ppw.pollution.put(pos, data); } - data.pollution[type.ordinal()] = MathHelper.clamp_float(data.pollution[type.ordinal()] + amount, 0F, 10_000F); + data.pollution[type.ordinal()] = MathHelper.clamp_float((float) (data.pollution[type.ordinal()] + amount * MobConfig.pollutionMult), 0F, 10_000F); } public static void decrementPollution(World world, int x, int y, int z, PollutionType type, float amount) { @@ -173,7 +179,9 @@ public class PollutionHandler { public void updateSystem(TickEvent.ServerTickEvent event) { if(event.side == Side.SERVER && event.phase == Phase.END) { - + + int spreadThreshold = RadiationConfig.pollutionSpreadThreshold; + double spreadEff = RadiationConfig.pollutionSpreadEfficiency; eggTimer++; if(eggTimer < 60) return; eggTimer = 0; @@ -192,11 +200,11 @@ public class PollutionHandler { int P = PollutionType.POISON.ordinal(); /* CALCULATION */ - if(data.pollution[S] > 15) { - pollutionForNeightbors[S] = data.pollution[S] * 0.05F; - data.pollution[S] *= 0.8F; + if(data.pollution[S] > spreadThreshold) { + pollutionForNeightbors[S] = (float) (data.pollution[S] * spreadEff); + data.pollution[S] *= 1-spreadEff*4; } else { - data.pollution[S] *= 0.99F; + data.pollution[S] *= 0.8; } data.pollution[H] *= 0.9995F; @@ -334,4 +342,34 @@ public class PollutionHandler { } } } + ///RAMPANT MODE STUFFS/// + + @SubscribeEvent + public void rampantTargetSetter(PlayerSleepInBedEvent event){ + if (MobConfig.rampantGlyphidGuidance) targetCoords = Vec3.createVectorHelper(event.x, event.y, event.z); + } + + @SubscribeEvent + public void rampantScoutPopulator(WorldEvent.PotentialSpawns event){ + //yell at me if this vertical formatting hurts your brain + if(MobConfig.rampantNaturalScoutSpawn + && !event.world.isRemote + && event.world.provider.dimensionId == 0 + && event.type == EnumCreatureType.monster + && event.world.canBlockSeeTheSky(event.x, event.y, event.z)) { + + if (event.world.rand.nextInt(MobConfig.rampantScoutSpawnChance) == 0) { + + float soot = PollutionHandler.getPollution(event.world, event.x, event.y, event.z, PollutionType.SOOT); + + if (soot >= MobConfig.rampantScoutSpawnThresh) { + EntityGlyphidScout scout = new EntityGlyphidScout(event.world); + scout.setLocationAndAngles(event.x, event.y, event.z, event.world.rand.nextFloat() * 360.0F, 0.0F); + event.world.spawnEntityInWorld(scout); + } + } + } + + } + } diff --git a/src/main/java/com/hbm/inventory/FluidContainerRegistry.java b/src/main/java/com/hbm/inventory/FluidContainerRegistry.java index f6f3d2971..5033ee2a4 100644 --- a/src/main/java/com/hbm/inventory/FluidContainerRegistry.java +++ b/src/main/java/com/hbm/inventory/FluidContainerRegistry.java @@ -68,9 +68,14 @@ public class FluidContainerRegistry { if(type.getContainer(CD_Gastank.class) != null) FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.gas_full, 1, id), new ItemStack(ModItems.gas_empty), type, 1000)); if(type.hasNoContainer()) continue; + + if(type.isDispersable()){ + FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.disperser_canister, 1 , i), new ItemStack(ModItems.disperser_canister_empty), Fluids.fromID(i), 2000)); + FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.glyphid_gland, 1 , i), new ItemStack(ModItems.glyphid_gland_empty), Fluids.fromID(i), 4000)); + } FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_tank_lead_full, 1, id), new ItemStack(ModItems.fluid_tank_lead_empty), type, 1000)); - + if(type.needsLeadContainer()) continue; FluidContainerRegistry.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_tank_full, 1, id), new ItemStack(ModItems.fluid_tank_empty), type, 1000)); diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index a64fdb6eb..a25849cd1 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -98,6 +98,8 @@ public class OreDictManager { public static final String KEY_CIRCUIT_BISMUTH = "circuitVersatile"; + public static final String KEY_GLYPHID_MEAT = "glyphidMeat"; + /* * MATERIALS */ @@ -300,6 +302,8 @@ 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() { @@ -504,7 +508,13 @@ public class OreDictManager { */ OreDictionary.registerOre(KEY_CIRCUIT_BISMUTH, circuit_bismuth); OreDictionary.registerOre(KEY_CIRCUIT_BISMUTH, circuit_arsenic); - + + /* + * GLYPHID M E A T + */ + OreDictionary.registerOre(KEY_GLYPHID_MEAT, new ItemStack(glyphid_meat)); + OreDictionary.registerOre(KEY_GLYPHID_MEAT, new ItemStack(glyphid_meat_grilled)); + for(NTMMaterial mat : Mats.orderedList) { if(mat.smeltable == SmeltingBehavior.SMELTABLE) { if(mat.shapes.contains(MaterialShapes.CASTPLATE)) for(String name : mat.names) OreDictionary.registerOre(MaterialShapes.CASTPLATE.name() + name, new ItemStack(ModItems.plate_cast, 1, mat.id)); diff --git a/src/main/java/com/hbm/inventory/fluid/FluidType.java b/src/main/java/com/hbm/inventory/fluid/FluidType.java index d6fa4d759..728c0bad2 100644 --- a/src/main/java/com/hbm/inventory/fluid/FluidType.java +++ b/src/main/java/com/hbm/inventory/fluid/FluidType.java @@ -171,6 +171,9 @@ public class FluidType { public boolean needsLeadContainer() { return this.traits.containsKey(FT_LeadContainer.class); } + public boolean isDispersable() { + return !(this.traits.containsKey(FT_Amat.class) || this.traits.containsKey(FT_NoContainer.class) || this.traits.containsKey(FT_Viscous.class)); + } /** * Called when the tile entity is broken, effectively voiding the fluids. diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index 5ca1341f6..4c83847b2 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -118,6 +118,9 @@ public class Fluids { public static FluidType SOLVENT; //oranic solvent in fact public static FluidType BLOOD; //BLOOD ORB! BLOOD ORB! BLOOD ORB! public static FluidType BLOOD_HOT; + + public static FluidType PHEROMONE; + public static FluidType PHEROMONE_M; public static FluidType SYNGAS; public static FluidType OXYHYDROGEN; public static FluidType RADIOSOLVENT; //DCM-ish made by wacky radio cracking @@ -182,7 +185,7 @@ public class Fluids { public static final FT_NoID NOID = new FT_NoID(); public static final FT_Delicious DELICIOUS = new FT_Delicious(); public static final FT_Leaded LEADED = new FT_Leaded(); - + public static void init() { // ##### ##### ##### ##### ## # ##### # # ##### ## # ##### @@ -282,7 +285,7 @@ public class Fluids { SEEDSLURRY = new FluidType("SEEDSLURRY", 0x7CC35E, 0, 0, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0x7CC35E)).addTraits(LIQUID, VISCOUS); NITRIC_ACID = new FluidType("NITRIC_ACID", 0xBB7A1E, 3, 0, 2, EnumSymbol.OXIDIZER).addTraits(LIQUID, new FT_Corrosive(60)); SOLVENT = new FluidType("SOLVENT", 0xE4E3EF, 2, 3, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0xE4E3EF)).addTraits(LIQUID, new FT_Corrosive(30)); - BLOOD = new FluidType("BLOOD", 0xB22424, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS); + BLOOD = new FluidType("BLOOD", 0xB22424, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, DELICIOUS); BLOOD_HOT = new FluidType("BLOOD_HOT", 0xF22419, 3, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS).setTemp(666); //it's funny because it's the satan number SYNGAS = new FluidType("SYNGAS", 0x131313, 1, 4, 2, EnumSymbol.NONE).addContainers(new CD_Gastank(0xFFFFFF, 0x131313)).addTraits(GASEOUS); OXYHYDROGEN = new FluidType("OXYHYDROGEN", 0x483FC1, 0, 4, 2, EnumSymbol.NONE).addTraits(GASEOUS); @@ -325,11 +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(130, "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)); // ^ ^ ^ ^ ^ ^ ^ ^ //ADD NEW FLUIDS HERE @@ -486,7 +490,10 @@ public class Fluids { metaOrder.add(SMOKE); metaOrder.add(SMOKE_LEADED); metaOrder.add(SMOKE_POISON); - + + //bug meth + metaOrder.add(PHEROMONE); + metaOrder.add(PHEROMONE_M); for(FluidType custom : customFluids) metaOrder.add(custom); CHLORINE.addTraits(new FT_Toxin().addEntry(new ToxinDirectDamage(ModDamageSource.cloud, 2F, 20, HazardClass.GAS_CHLORINE, false))); diff --git a/src/main/java/com/hbm/inventory/fluid/trait/FT_Pheromone.java b/src/main/java/com/hbm/inventory/fluid/trait/FT_Pheromone.java new file mode 100644 index 000000000..4ebfc8e5c --- /dev/null +++ b/src/main/java/com/hbm/inventory/fluid/trait/FT_Pheromone.java @@ -0,0 +1,43 @@ +package com.hbm.inventory.fluid.trait; + +import com.google.gson.JsonObject; +import com.google.gson.stream.JsonWriter; +import net.minecraft.util.EnumChatFormatting; + + +import java.io.IOException; +import java.util.List; + +public class FT_Pheromone extends FluidTrait{ + + public int type; + + public FT_Pheromone(int type){ + this.type = type; + } + + public int getType() { + return type; + } + + @Override + public void addInfo(List info) { + + if (type == 1) { + info.add(EnumChatFormatting.AQUA + "[Glyphid Pheromones]"); + } else { + info.add(EnumChatFormatting.BLUE + "[Modified Pheromones]"); + } + + } + @Override + public void serializeJSON(JsonWriter writer) throws IOException { + writer.name("type").value(type); + } + + @Override + public void deserializeJSON(JsonObject obj) { + this.type = obj.get("type").getAsInt(); + } + +} diff --git a/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java b/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java index ff2522d09..de7ddc591 100644 --- a/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java +++ b/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java @@ -35,6 +35,7 @@ public abstract class FluidTrait { traitNameMap.put("leadcontainer", FT_LeadContainer.class); traitNameMap.put("delicious", FT_Delicious.class); traitNameMap.put("leaded", FT_Leaded.class); + traitNameMap.put("pheromone", FT_Pheromone.class); traitNameMap.put("noid", FT_NoID.class); traitNameMap.put("nocontainer", FT_NoContainer.class); } diff --git a/src/main/java/com/hbm/inventory/fluid/trait/FluidTraitSimple.java b/src/main/java/com/hbm/inventory/fluid/trait/FluidTraitSimple.java index d282cea42..f62cd456e 100644 --- a/src/main/java/com/hbm/inventory/fluid/trait/FluidTraitSimple.java +++ b/src/main/java/com/hbm/inventory/fluid/trait/FluidTraitSimple.java @@ -49,7 +49,7 @@ public class FluidTraitSimple { info.add(EnumChatFormatting.DARK_RED + "[Requires hazardous material tank to hold]"); } } - + public static class FT_Delicious extends FluidTrait { @Override public void addInfoHidden(List info) { info.add(EnumChatFormatting.DARK_GREEN + "[Delicious]"); diff --git a/src/main/java/com/hbm/inventory/recipes/ChemplantRecipes.java b/src/main/java/com/hbm/inventory/recipes/ChemplantRecipes.java index f3639536b..f14b4bd10 100644 --- a/src/main/java/com/hbm/inventory/recipes/ChemplantRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/ChemplantRecipes.java @@ -21,6 +21,7 @@ import com.hbm.inventory.recipes.loader.SerializableRecipe; import com.hbm.items.ModItems; import com.hbm.main.MainRegistry; +import cpw.mods.fml.common.Mod; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -401,6 +402,7 @@ public class ChemplantRecipes extends SerializableRecipe { recipes.add(new ChemRecipe(101, "CC_CENTRIFUGE", 200) .inputFluids(new FluidStack(Fluids.CHLOROCALCITE_CLEANED, 500), new FluidStack(Fluids.SULFURIC_ACID, 8_000)) .outputFluids(new FluidStack(Fluids.POTASSIUM_CHLORIDE, 250), new FluidStack(Fluids.CALCIUM_CHLORIDE, 250))); + recipes.add(new ChemRecipe(102, "THORIUM_SALT", 60) .inputFluids(new FluidStack(Fluids.THORIUM_SALT_DEPLETED, 16_000)) .inputItems(new OreDictStack(TH232.nugget(), 2)) @@ -408,6 +410,14 @@ public class ChemplantRecipes extends SerializableRecipe { .outputItems( new ItemStack(ModItems.nugget_u233, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1))); + + recipes.add(new ChemRecipe(103, "MEAT_PROCESSING", 200) + .inputItems(new OreDictStack(KEY_GLYPHID_MEAT, 3)) + .inputFluids(new FluidStack(Fluids.SULFURIC_ACID, 1000)) + .outputItems(new ItemStack(ModItems.sulfur, 4), + new ItemStack(ModItems.niter, 3)) + .outputFluids(new FluidStack(Fluids.SALIENT, 250))); + } public static void registerFuelProcessing() { diff --git a/src/main/java/com/hbm/inventory/recipes/LiquefactionRecipes.java b/src/main/java/com/hbm/inventory/recipes/LiquefactionRecipes.java index ee093f541..3af3808a7 100644 --- a/src/main/java/com/hbm/inventory/recipes/LiquefactionRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/LiquefactionRecipes.java @@ -59,6 +59,7 @@ public class LiquefactionRecipes extends SerializableRecipe { recipes.put(new ComparableStack(ModBlocks.plant_flower, 1, 3), new FluidStack(150, Fluids.ETHANOL)); recipes.put(new ComparableStack(ModBlocks.plant_flower, 1, 4), new FluidStack(50, Fluids.ETHANOL)); recipes.put(new ComparableStack(ModItems.biomass), new FluidStack(125, Fluids.BIOGAS)); + recipes.put(new ComparableStack(ModItems.glyphid_gland_empty), new FluidStack(2000, Fluids.BIOGAS)); recipes.put(new ComparableStack(Items.fish, 1, OreDictionary.WILDCARD_VALUE), new FluidStack(100, Fluids.FISHOIL)); recipes.put(new ComparableStack(Blocks.double_plant, 1, 0), new FluidStack(100, Fluids.SUNFLOWEROIL)); diff --git a/src/main/java/com/hbm/inventory/recipes/MixerRecipes.java b/src/main/java/com/hbm/inventory/recipes/MixerRecipes.java index 15bf9a25e..fe7b40217 100644 --- a/src/main/java/com/hbm/inventory/recipes/MixerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/MixerRecipes.java @@ -83,6 +83,8 @@ public class MixerRecipes extends SerializableRecipe { register(Fluids.CHLOROCALCITE_SOLUTION, new MixerRecipe(500, 50).setStack1(new FluidStack(Fluids.WATER, 250)).setStack2(new FluidStack(Fluids.NITRIC_ACID, 250)).setSolid(new OreDictStack(CHLOROCALCITE.dust()))); register(Fluids.CHLOROCALCITE_MIX, new MixerRecipe(1000, 50).setStack1(new FluidStack(Fluids.CHLOROCALCITE_SOLUTION, 500)).setStack2(new FluidStack(Fluids.SULFURIC_ACID, 500)).setSolid(new ComparableStack(ModItems.powder_flux))); + register(Fluids.PHEROMONE_M, new MixerRecipe(2000, 10).setStack1(new FluidStack(Fluids.PHEROMONE, 1500)).setStack2(new FluidStack(Fluids.BLOOD, 500)).setSolid(new ComparableStack(ModItems.pill_herbal))); + } public static void register(FluidType type, MixerRecipe... rec) { diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 211768119..826915238 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -936,6 +936,11 @@ public class ModItems { public static Item fluid_barrel_empty; public static Item fluid_barrel_infinite; + public static Item disperser_canister; + public static Item disperser_canister_empty; + public static Item glyphid_gland; + public static Item glyphid_gland_empty; + public static Item syringe_empty; public static Item syringe_antidote; public static Item syringe_poison; @@ -4644,6 +4649,13 @@ public class ModItems { fluid_barrel_full = new ItemFluidTank().setUnlocalizedName("fluid_barrel_full").setContainerItem(ModItems.fluid_barrel_empty).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel"); fluid_barrel_empty = new Item().setUnlocalizedName("fluid_barrel_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel"); fluid_barrel_infinite = new ItemInfiniteFluid(null, 1_000_000_000).setUnlocalizedName("fluid_barrel_infinite").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel_infinite"); + + disperser_canister = new ItemDisperser().setUnlocalizedName("disperser_canister").setContainerItem(ModItems.disperser_canister_empty).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":disperser_canister"); + disperser_canister_empty = new Item().setUnlocalizedName("disperser_canister_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":disperser_canister"); + + glyphid_gland = new ItemDisperser().setUnlocalizedName("glyphid_gland").setContainerItem(ModItems.glyphid_gland_empty).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":glyphid_gland"); + glyphid_gland_empty = new Item().setUnlocalizedName("glyphid_gland_empty").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":glyphid_gland"); + siren_track = new ItemCassette().setUnlocalizedName("siren_track").setMaxStackSize(1).setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":cassette"); fluid_duct = new ItemFluidDuct().setUnlocalizedName("fluid_duct").setCreativeTab(MainRegistry.templateTab).setTextureName(RefStrings.MODID + ":duct"); @@ -6365,7 +6377,14 @@ public class ModItems { GameRegistry.registerItem(fluid_barrel_empty, fluid_barrel_empty.getUnlocalizedName()); GameRegistry.registerItem(fluid_barrel_full, fluid_barrel_full.getUnlocalizedName()); GameRegistry.registerItem(fluid_barrel_infinite, fluid_barrel_infinite.getUnlocalizedName()); - + + //Disperser Canister + GameRegistry.registerItem(disperser_canister_empty, disperser_canister_empty.getUnlocalizedName()); + GameRegistry.registerItem(disperser_canister, disperser_canister.getUnlocalizedName()); + + GameRegistry.registerItem(glyphid_gland_empty, glyphid_gland_empty.getUnlocalizedName()); + GameRegistry.registerItem(glyphid_gland, glyphid_gland.getUnlocalizedName()); + //Batteries GameRegistry.registerItem(battery_generic, battery_generic.getUnlocalizedName()); GameRegistry.registerItem(battery_red_cell, battery_red_cell.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/machine/ItemFluidTank.java b/src/main/java/com/hbm/items/machine/ItemFluidTank.java index f4c0a3551..ce7a2cd0d 100644 --- a/src/main/java/com/hbm/items/machine/ItemFluidTank.java +++ b/src/main/java/com/hbm/items/machine/ItemFluidTank.java @@ -15,7 +15,7 @@ import net.minecraft.util.StatCollector; public class ItemFluidTank extends Item { - IIcon overlayIcon; + protected IIcon overlayIcon; public ItemFluidTank() { this.setHasSubtypes(true); diff --git a/src/main/java/com/hbm/items/weapon/ItemDisperser.java b/src/main/java/com/hbm/items/weapon/ItemDisperser.java new file mode 100644 index 000000000..9971ee3e7 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/ItemDisperser.java @@ -0,0 +1,76 @@ +package com.hbm.items.weapon; + +import com.hbm.entity.grenade.EntityDisperserCanister; +import com.hbm.inventory.fluid.FluidType; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemFluidTank; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +import java.util.List; + +public class ItemDisperser extends ItemFluidTank { + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + + if (!player.capabilities.isCreativeMode) { + --stack.stackSize; + } + + world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!world.isRemote) { + + EntityDisperserCanister canister = new EntityDisperserCanister(world, player); + + canister.setType(Item.getIdFromItem(this)); + canister.setFluid(stack.getItemDamage()); + world.spawnEntityInWorld(canister); + + } + + return stack; + } + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List list) { + + FluidType[] order = Fluids.getInNiceOrder(); + + for(int i = 1; i < order.length; ++i) { + FluidType type = order[i]; + int id = type.getID(); + if(type.isDispersable() && this == ModItems.disperser_canister) { + list.add(new ItemStack(item, 1, id)); + } else if (type == Fluids.PHEROMONE || type == Fluids.SULFURIC_ACID && this == ModItems.glyphid_gland) { + list.add(new ItemStack(item, 1, id)); + } + + } + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + + String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); + String s1 = ("" + StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getUnlocalizedName())).trim(); + + s = this == ModItems.glyphid_gland ? s1 + " " + s : s + " " + s1 ; + return s; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister p_94581_1_) { + super.registerIcons(p_94581_1_); + this.overlayIcon = this == ModItems.disperser_canister ? p_94581_1_.registerIcon("hbm:disperser_canister_overlay") : p_94581_1_.registerIcon("hbm:fluid_identifier_overlay"); + } +} diff --git a/src/main/java/com/hbm/lib/HbmWorldGen.java b/src/main/java/com/hbm/lib/HbmWorldGen.java index d8019a7ea..ea38eed02 100644 --- a/src/main/java/com/hbm/lib/HbmWorldGen.java +++ b/src/main/java/com/hbm/lib/HbmWorldGen.java @@ -18,20 +18,7 @@ import com.hbm.tileentity.machine.storage.TileEntitySafe; import com.hbm.tileentity.machine.storage.TileEntitySoyuzCapsule; import com.hbm.util.LootGenerator; import com.hbm.util.WeightedRandomGeneric; -import com.hbm.world.dungeon.AncientTomb; -import com.hbm.world.dungeon.Antenna; -import com.hbm.world.dungeon.ArcticVault; -import com.hbm.world.dungeon.Barrel; -import com.hbm.world.dungeon.CrashedVertibird; -import com.hbm.world.dungeon.DesertAtom001; -import com.hbm.world.dungeon.Factory; -import com.hbm.world.dungeon.LibraryDungeon; -import com.hbm.world.dungeon.Radio01; -import com.hbm.world.dungeon.Relay; -import com.hbm.world.dungeon.Satellite; -import com.hbm.world.dungeon.Silo; -import com.hbm.world.dungeon.Spaceship; -import com.hbm.world.dungeon.Vertibird; +import com.hbm.world.dungeon.*; import com.hbm.world.feature.BedrockOre; import com.hbm.world.feature.BedrockOre.BedrockOreDefinition; import com.hbm.world.feature.DepthDeposit; @@ -242,7 +229,7 @@ public class HbmWorldGen implements IWorldGenerator { int x = i + rand.nextInt(16) + 8; int z = j + rand.nextInt(16) + 8; int y = world.getHeightValue(x, z); - if(world.getBlock(x, y - 1, z).isNormalCube()) GlyphidHive.generate(world, x, y, z, rand); + if(world.getBlock(x, y - 1, z).isNormalCube()) GlyphidHive.generateBigGround(world, x, y, z, rand, false); } if(biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) { @@ -365,6 +352,7 @@ public class HbmWorldGen implements IWorldGenerator { new Dud().generate(world, rand, x, y, z); } + if(WorldConfig.spaceshipStructure > 0 && rand.nextInt(WorldConfig.spaceshipStructure) == 0) { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); @@ -372,7 +360,6 @@ public class HbmWorldGen implements IWorldGenerator { new Spaceship().generate(world, rand, x, y, z); } - if(WorldConfig.barrelStructure > 0 && biome.temperature >= 1.5F && !biome.canSpawnLightningBolt() && rand.nextInt(WorldConfig.barrelStructure) == 0) { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); diff --git a/src/main/java/com/hbm/lib/ModDamageSource.java b/src/main/java/com/hbm/lib/ModDamageSource.java index a477d929c..1fe20cf1c 100644 --- a/src/main/java/com/hbm/lib/ModDamageSource.java +++ b/src/main/java/com/hbm/lib/ModDamageSource.java @@ -16,7 +16,7 @@ public class ModDamageSource extends DamageSource { public static DamageSource nuclearBlast = (new DamageSource("nuclearBlast")).setExplosion(); public static DamageSource mudPoisoning = (new DamageSource("mudPoisoning")).setDamageBypassesArmor(); - public static DamageSource acid = (new DamageSource("acid")).setDamageBypassesArmor(); + public static DamageSource acid = (new DamageSource("acid")); //.setDamageBypassesArmor(); public static DamageSource euthanizedSelf = (new DamageSource("euthanizedSelf")).setDamageBypassesArmor(); public static DamageSource euthanizedSelf2 = (new DamageSource("euthanizedSelf2")).setDamageBypassesArmor(); public static DamageSource tauBlast = (new DamageSource("tauBlast")).setDamageBypassesArmor(); @@ -53,6 +53,7 @@ public class ModDamageSource extends DamageSource { public static DamageSource vacuum = (new DamageSource("vacuum")).setDamageIsAbsolute().setDamageBypassesArmor(); public static DamageSource overdose = (new DamageSource("overdose")).setDamageIsAbsolute().setDamageBypassesArmor(); public static DamageSource microwave = (new DamageSource("microwave")).setDamageIsAbsolute().setDamageBypassesArmor(); + public static DamageSource nitan = (new DamageSource("nitan")).setDamageIsAbsolute().setDamageBypassesArmor().setDamageAllowedInCreativeMode();; public static final String s_bullet = "revolverBullet"; public static final String s_emplacer = "chopperBullet"; diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 2a8e88ddb..ad1a4a00b 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()); @@ -613,6 +613,7 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerEntityRenderingHandler(EntitySawblade.class, new RenderSawblade()); RenderingRegistry.registerEntityRenderingHandler(EntityChemical.class, new RenderChemical()); RenderingRegistry.registerEntityRenderingHandler(EntityMist.class, new RenderMist()); + RenderingRegistry.registerEntityRenderingHandler(EntityWaypoint.class, new RenderMist()); RenderingRegistry.registerEntityRenderingHandler(EntityAcidBomb.class, new RenderSnowball(Items.slime_ball)); //grenades RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeGeneric.class, new RenderSnowball(ModItems.grenade_generic)); @@ -660,6 +661,7 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeDynamite.class, new RenderSnowball(ModItems.stick_dynamite)); RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeBouncyGeneric.class, new RenderGenericGrenade()); RenderingRegistry.registerEntityRenderingHandler(EntityGrenadeImpactGeneric.class, new RenderGenericGrenade()); + RenderingRegistry.registerEntityRenderingHandler(EntityDisperserCanister.class, new RenderGenericGrenade()); //missiles RenderingRegistry.registerEntityRenderingHandler(EntityTestMissile.class, new RenderTestMissile()); RenderingRegistry.registerEntityRenderingHandler(EntityMissileCustom.class, new RenderMissileCustom()); diff --git a/src/main/java/com/hbm/render/entity/projectile/RenderGenericGrenade.java b/src/main/java/com/hbm/render/entity/projectile/RenderGenericGrenade.java index cca75e72d..01ff7f5c7 100644 --- a/src/main/java/com/hbm/render/entity/projectile/RenderGenericGrenade.java +++ b/src/main/java/com/hbm/render/entity/projectile/RenderGenericGrenade.java @@ -1,5 +1,7 @@ package com.hbm.render.entity.projectile; +import com.hbm.entity.grenade.EntityDisperserCanister; +import net.minecraft.item.Item; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -16,10 +18,14 @@ public class RenderGenericGrenade extends Render { @Override public void doRender(Entity entity, double x, double y, double z, float f0, float f1) { - - IGenericGrenade grenade = (IGenericGrenade) entity; - - IIcon iicon = grenade.getGrenade().getIconFromDamage(0); + IIcon iicon; + if(entity instanceof EntityDisperserCanister){ + EntityDisperserCanister canister = (EntityDisperserCanister) entity; + iicon = canister.getType().getIconFromDamage(canister.getFluid().getID()); + } else { + IGenericGrenade grenade = (IGenericGrenade) entity; + iicon = grenade.getGrenade().getIconFromDamage(0); + } if(iicon != null) { GL11.glPushMatrix(); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyBrick.java b/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyBrick.java index 5a95b31ac..c237c9be9 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyBrick.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyBrick.java @@ -1,5 +1,7 @@ package com.hbm.tileentity.machine; + +import com.hbm.config.MobConfig; import com.hbm.main.MainRegistry; import cpw.mods.fml.relauncher.Side; @@ -29,7 +31,7 @@ public class TileEntityChimneyBrick extends TileEntityChimneyBase { @Override public double getPollutionMod() { - return 0.25D; + return MobConfig.rampantMode ? MobConfig.rampantSmokeStackOverride : 0.25D; } AxisAlignedBB bb = null; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyIndustrial.java b/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyIndustrial.java index f5a79dce4..80006caf3 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyIndustrial.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityChimneyIndustrial.java @@ -1,5 +1,6 @@ package com.hbm.tileentity.machine; +import com.hbm.config.MobConfig; import com.hbm.main.MainRegistry; import cpw.mods.fml.relauncher.Side; @@ -29,7 +30,7 @@ public class TileEntityChimneyIndustrial extends TileEntityChimneyBase { @Override public double getPollutionMod() { - return 0.1D; + return MobConfig.rampantMode ? MobConfig.rampantSmokeStackOverride/2 : 0.1D; } @Override diff --git a/src/main/java/com/hbm/world/feature/GlyphidHive.java b/src/main/java/com/hbm/world/feature/GlyphidHive.java index 5c60e3ff2..f7c83e76f 100644 --- a/src/main/java/com/hbm/world/feature/GlyphidHive.java +++ b/src/main/java/com/hbm/world/feature/GlyphidHive.java @@ -4,12 +4,14 @@ 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; public class GlyphidHive { - public static final int[][][] schematic = new int[][][] { + public static final int[][][] schematicBigGround = new int[][][] { { {0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, @@ -38,38 +40,38 @@ public class GlyphidHive { }, { {0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,4,4,4,0,0,0,0}, + {0,0,0,0,3,3,3,0,0,0,0}, {0,0,0,1,1,9,1,1,0,0,0}, {0,0,1,1,9,9,9,1,1,0,0}, - {0,3,1,9,9,9,9,9,1,5,0}, - {0,3,9,9,9,9,9,9,9,5,0}, - {0,3,1,9,9,9,9,9,1,5,0}, + {0,3,1,9,9,9,9,9,1,2,0}, + {0,3,9,9,9,9,9,9,9,2,0}, + {0,3,1,9,9,9,9,9,1,2,0}, {0,0,1,1,9,9,9,1,1,0,0}, {0,0,0,1,1,9,1,1,0,0,0}, {0,0,0,0,2,2,2,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, }, { - {0,0,0,0,0,4,0,0,0,0,0}, - {0,0,0,0,4,4,4,0,0,0,0}, - {0,0,0,1,4,9,4,1,0,0,0}, + {0,0,0,0,0,3,0,0,0,0,0}, + {0,0,0,0,3,3,3,0,0,0,0}, + {0,0,0,1,3,9,3,1,0,0,0}, {0,0,1,1,9,9,9,1,1,0,0}, - {0,3,3,9,9,9,9,9,5,5,0}, - {3,3,9,9,9,9,9,9,9,5,5}, - {0,3,3,9,9,9,9,9,5,5,0}, + {0,3,3,9,9,9,9,9,2,2,0}, + {3,3,9,9,9,9,9,9,9,2,2}, + {0,3,3,9,9,9,9,9,2,2,0}, {0,0,1,1,9,9,9,1,1,0,0}, {0,0,0,1,2,9,2,1,0,0,0}, {0,0,0,0,2,2,2,0,0,0,0}, {0,0,0,0,0,2,0,0,0,0,0}, }, { - {0,0,0,0,4,4,4,0,0,0,0}, - {0,0,0,1,4,4,4,1,0,0,0}, - {0,0,1,1,4,9,4,1,1,0,0}, + {0,0,0,0,3,3,3,0,0,0,0}, + {0,0,0,1,3,3,3,1,0,0,0}, + {0,0,1,1,3,9,3,1,1,0,0}, {0,1,1,1,9,9,0,1,1,1,0}, - {3,3,3,9,9,9,9,9,5,5,5}, - {3,3,9,9,9,9,9,9,9,5,5}, - {3,3,3,9,9,9,9,9,5,5,5}, + {3,3,3,9,9,9,9,9,2,2,2}, + {3,3,9,9,9,9,9,9,9,2,2}, + {3,3,3,9,9,9,9,9,2,2,2}, {0,1,1,1,9,9,9,1,1,1,0}, {0,0,1,1,2,9,2,1,1,0,0}, {0,0,0,1,2,2,2,1,0,0,0}, @@ -102,21 +104,21 @@ public class GlyphidHive { {0,0,0,0,0,0,0,0,0,0,0}, } }; - - public static void generate(World world, int x, int y, int z, Random rand) { + public static void generateBigGround(World world, int x, int y, int z, Random rand, boolean openDesign) { - int orientation = rand.nextInt(4) + 2; + int orientation = rand.nextInt(2) + 2; for(int i = 0; i < 11; i++) { for(int j = 0; j < 7; j++) { for(int k = 0; k < 11; k++) { - int block = schematic[6 - j][i][k]; - - if(block == 1 || (block != orientation && block > 1 && block < 6)) { + int block = schematicBigGround[6 - j][i][k]; + + boolean hasWall = !openDesign && (block != orientation && block > 1 && block < 6); + + if(block == 1 || hasWall) { world.setBlock(x + i - 5, y + j - 2, z + k - 5, ModBlocks.glyphid_base); - } - if(block == 9) { + } else if (block != 0) { world.setBlock(x + i - 5, y + j - 2, z + k - 5, Blocks.air); } } @@ -124,5 +126,8 @@ public class GlyphidHive { } world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner); + } + } + diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index db2b9677f..44f03fd5b 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -577,6 +577,7 @@ chem.KEVLAR=Kevlar Compound Production chem.LPG=Petroleum Gas Liquefaction chem.LUBRICANT=Lubricant Mixing chem.METH=Methamphetamine Synthesis +chem.MEAT_PROCESSING=Glyphid Meat Mineral Extraction chem.NITAN=NITAN Super Fuel Mixing chem.NITRIC_ACID=Nitric Acid Production chem.OIL_SAND=Tar Sand Extraction @@ -1353,6 +1354,8 @@ hbmfluid.pain=Pandemonium(III)tantalite Solution hbmfluid.petroil=Petroil hbmfluid.petroil_leaded=Leaded Petroil hbmfluid.petroleum=Petroleum Gas +hbmfluid.pheromone=Booster Pheromone +hbmfluid.pheromone_m=Modified Booster Pheromone hbmfluid.phosgene=Phosgene hbmfluid.plasma_bf=Balefire Plasma hbmfluid.plasma_dh3=Deuterium-Helium-3 Plasma @@ -1400,6 +1403,9 @@ hbmfluid.woodoil=Wood Oil hbmfluid.xenon=Xenon Gas hbmfluid.xpjuice=Experience Juice hbmfluid.xylene=BTX + + + hbmpseudofluid.none=Empty hbmpseudofluid.heuf6=Highly Enriched UF6 hbmpseudofluid.meuf6=Medium Enriched UF6 @@ -2610,6 +2616,13 @@ 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 @@ -4874,7 +4887,9 @@ 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 diff --git a/src/main/resources/assets/hbm/textures/gui/fluids/pheromone.png b/src/main/resources/assets/hbm/textures/gui/fluids/pheromone.png new file mode 100644 index 000000000..8517917d8 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/gui/fluids/pheromone.png differ diff --git a/src/main/resources/assets/hbm/textures/gui/fluids/pheromone_m.png b/src/main/resources/assets/hbm/textures/gui/fluids/pheromone_m.png new file mode 100644 index 000000000..b82a63ab3 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/gui/fluids/pheromone_m.png differ diff --git a/src/main/resources/assets/hbm/textures/items/chem_icon_MEAT_PROCESSING.png b/src/main/resources/assets/hbm/textures/items/chem_icon_MEAT_PROCESSING.png new file mode 100644 index 000000000..44f694ed7 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/chem_icon_MEAT_PROCESSING.png differ diff --git a/src/main/resources/assets/hbm/textures/items/disperser_canister.png b/src/main/resources/assets/hbm/textures/items/disperser_canister.png new file mode 100644 index 000000000..4a5653488 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/disperser_canister.png differ diff --git a/src/main/resources/assets/hbm/textures/items/disperser_canister_overlay.png b/src/main/resources/assets/hbm/textures/items/disperser_canister_overlay.png new file mode 100644 index 000000000..2fdf3d941 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/disperser_canister_overlay.png differ diff --git a/src/main/resources/assets/hbm/textures/items/glyphid_gland.png b/src/main/resources/assets/hbm/textures/items/glyphid_gland.png new file mode 100644 index 000000000..0b1a48e6f Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/glyphid_gland.png differ