From 0d33363eaf8f9b136208cd85b4f62ba095d01b71 Mon Sep 17 00:00:00 2001 From: 70000hp <105080577+70000hp@users.noreply.github.com> Date: Thu, 7 Dec 2023 19:50:07 -0500 Subject: [PATCH 01/10] an unspeakably large commit Contains the whole fucking glyphid PR. ill tell why later --- .../blocks/generic/BlockGlyphidSpawner.java | 125 +++-- .../java/com/hbm/config/CommonConfig.java | 6 +- src/main/java/com/hbm/config/MobConfig.java | 128 ++++- .../java/com/hbm/config/RadiationConfig.java | 6 + .../java/com/hbm/entity/EntityMappings.java | 5 +- .../com/hbm/entity/effect/EntityMist.java | 124 ++++- .../grenade/EntityDisperserCanister.java | 76 +++ .../com/hbm/entity/logic/EntityWaypoint.java | 139 +++++ .../hbm/entity/mob/EntityCreeperPhosgene.java | 1 + .../com/hbm/entity/mob/EntityGlyphid.java | 476 +++++++++++++++--- .../hbm/entity/mob/EntityGlyphidBehemoth.java | 86 +++- .../hbm/entity/mob/EntityGlyphidBlaster.java | 6 +- .../entity/mob/EntityGlyphidBombardier.java | 19 +- .../hbm/entity/mob/EntityGlyphidBrawler.java | 8 +- .../hbm/entity/mob/EntityGlyphidBrenda.java | 34 +- .../hbm/entity/mob/EntityGlyphidNuclear.java | 88 +++- .../hbm/entity/mob/EntityGlyphidScout.java | 369 ++++++++++---- .../entity/pathfinder/PathFinderUtils.java | 50 ++ .../hbm/entity/projectile/EntityAcidBomb.java | 3 +- .../hbm/entity/projectile/EntityChemical.java | 64 ++- .../standard/BlockAllocatorGlyphidDig.java | 90 ++++ .../handler/pollution/PollutionHandler.java | 52 +- .../hbm/inventory/FluidContainerRegistry.java | 4 +- .../com/hbm/inventory/OreDictManager.java | 12 +- .../com/hbm/inventory/fluid/FluidType.java | 3 + .../java/com/hbm/inventory/fluid/Fluids.java | 22 +- .../inventory/fluid/trait/FT_Pheromone.java | 43 ++ .../hbm/inventory/fluid/trait/FluidTrait.java | 2 + .../fluid/trait/FluidTraitSimple.java | 6 +- .../inventory/recipes/ChemplantRecipes.java | 10 + .../recipes/LiquefactionRecipes.java | 1 + .../hbm/inventory/recipes/MixerRecipes.java | 2 + src/main/java/com/hbm/items/ModItems.java | 21 +- .../com/hbm/items/machine/ItemFluidTank.java | 2 +- .../com/hbm/items/weapon/ItemDisperser.java | 76 +++ src/main/java/com/hbm/lib/HbmWorldGen.java | 19 +- .../java/com/hbm/lib/ModDamageSource.java | 3 +- src/main/java/com/hbm/main/ClientProxy.java | 4 +- .../projectile/RenderGenericGrenade.java | 14 +- .../machine/TileEntityChimneyBrick.java | 4 +- .../machine/TileEntityChimneyIndustrial.java | 3 +- .../com/hbm/world/feature/GlyphidHive.java | 55 +- src/main/resources/assets/hbm/lang/en_US.lang | 36 +- .../hbm/textures/gui/fluids/pheromone.png | Bin 0 -> 423 bytes .../hbm/textures/gui/fluids/pheromone_m.png | Bin 0 -> 423 bytes .../items/chem_icon_MEAT_PROCESSING.png | Bin 0 -> 326 bytes .../hbm/textures/items/disperser_canister.png | Bin 0 -> 376 bytes .../items/disperser_canister_overlay.png | Bin 0 -> 202 bytes .../hbm/textures/items/glyphid_gland.png | Bin 0 -> 339 bytes 49 files changed, 1949 insertions(+), 348 deletions(-) create mode 100644 src/main/java/com/hbm/entity/grenade/EntityDisperserCanister.java create mode 100644 src/main/java/com/hbm/entity/logic/EntityWaypoint.java create mode 100644 src/main/java/com/hbm/explosion/vanillant/standard/BlockAllocatorGlyphidDig.java create mode 100644 src/main/java/com/hbm/inventory/fluid/trait/FT_Pheromone.java create mode 100644 src/main/java/com/hbm/items/weapon/ItemDisperser.java create mode 100644 src/main/resources/assets/hbm/textures/gui/fluids/pheromone.png create mode 100644 src/main/resources/assets/hbm/textures/gui/fluids/pheromone_m.png create mode 100644 src/main/resources/assets/hbm/textures/items/chem_icon_MEAT_PROCESSING.png create mode 100644 src/main/resources/assets/hbm/textures/items/disperser_canister.png create mode 100644 src/main/resources/assets/hbm/textures/items/disperser_canister_overlay.png create mode 100644 src/main/resources/assets/hbm/textures/items/glyphid_gland.png 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..81724a61b 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,91 @@ 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); + + //TODO: Disable this before release + 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 18d585624..1cd6a73d1 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -232,7 +232,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..8537520b2 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,39 @@ 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) { + living.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 1)); + living.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2 * 60 * 20, 1)); + living.addPotionEffect(new PotionEffect(Potion.regeneration.id, 2 * 20, 0)); + + if (living instanceof EntityGlyphid && pheromone.getType() == 1) { + living.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 0)); + living.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 60 * 20, 1)); + living.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 60 * 20, 0)); + + } else if (living instanceof EntityPlayer && pheromone.getType() == 2) { + living.addPotionEffect(new PotionEffect(Potion.resistance.id, 2 * 60 * 20, 0)); + living.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 2 * 60 * 20, 1)); + } + } + } } 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 +272,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..157e21a89 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -3,29 +3,66 @@ 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; + + EntityWaypoint taskWaypoint = null; public EntityGlyphid(World world) { super(world); /*this.tasks.addTask(0, new EntityAISwimming(this)); @@ -38,11 +75,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 +98,240 @@ 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() == 4){ + + //incase the waypoint somehow doesn't exist and it got this task anyway + if(isAtDestination() && taskX == 0) { + setCurrentTask(0, null); + } + //the task cannot be 6 outside of rampant, so this is a non issue p much + } else if (getCurrentTask() == 6 && 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() == 0) { + 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() != 0) { + 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 != 0) { + if(MobConfig.rampantDig) { + + MovingObjectPosition obstacle = findWaypointObstruction(); + if (getScale() >= 1 && getCurrentTask() != 6 && 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() == 0; } - + @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 +344,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 +361,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 +389,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 1: if(taskWaypoint != null){ + communicate(4, taskWaypoint); + setCurrentTask(4, taskWaypoint); + } break; + + //expand the hive, used by the scout + //case 2: expandHive(null); + + //retreat + case 3: + + 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(1); + home.setAdditionalWaypoint(additional); + home.setHighPriority(); + home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); + worldObj.spawnEntityInWorld(home); + + this.taskWaypoint = home; + communicate(4, home); + setCurrentTask(4, 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 6: + 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(6, 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(6, 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..179a56d54 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() == 4) { + setCurrentTask(0, null); + } + + if(getCurrentTask() == 2 && getAITarget() == null){ + this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10 * 20, 3)); + } + + if (getCurrentTask() == 5) { + 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(3, 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..8c9e5db93 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() != 2 || getCurrentTask() != 5) && 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() == 2 || getCurrentTask() == 5) { + + 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() == 5 && super.isAtDestination() && doubleCheckHive()) { + communicate(5, 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(0); + + //First, go home and get reinforcements + EntityWaypoint home = new EntityWaypoint(worldObj); + home.setWaypointType(1); + 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(1, 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(4, 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(0 ,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() == 2 && 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(2, taskWaypoint); + } + return true; + } + return false; + } + + + @Override + public void carryOutTask() { + if (!worldObj.isRemote && taskWaypoint == null) { + switch(getCurrentTask()){ + case 3: + 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 5: + 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/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..ce44b7eb3 100644 --- a/src/main/java/com/hbm/inventory/FluidContainerRegistry.java +++ b/src/main/java/com/hbm/inventory/FluidContainerRegistry.java @@ -69,8 +69,10 @@ public class FluidContainerRegistry { if(type.hasNoContainer()) continue; + 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..853a8d2d1 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_NoDispersable.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..61768d294 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,8 @@ 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 final FT_NoDispersable NO_DISPERSE= new FT_NoDispersable(); public static void init() { // ##### ##### ##### ##### ## # ##### # # ##### ## # ##### @@ -231,8 +235,8 @@ public class Fluids { PUF6 = new FluidType("PUF6", 0x4C4C4C, 4, 0, 4, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(0.1F), new FT_Corrosive(15), GASEOUS); SAS3 = new FluidType("SAS3", 0x4ffffc, 5, 0, 4, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(1F), new FT_Corrosive(30), LIQUID); SCHRABIDIC = new FluidType("SCHRABIDIC", 0x006B6B, 5, 0, 5, EnumSymbol.ACID).addTraits(new FT_VentRadiation(1F), new FT_Corrosive(75), new FT_Poison(true, 2), LIQUID); - AMAT = new FluidType("AMAT", 0x010101, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS); - ASCHRAB = new FluidType("ASCHRAB", 0xb50000, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS); + AMAT = new FluidType("AMAT", 0x010101, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS, NO_DISPERSE); + ASCHRAB = new FluidType("ASCHRAB", 0xb50000, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS, NO_DISPERSE); ACID = new FluidType("ACID", 0xfff7aa, 3, 0, 3, EnumSymbol.OXIDIZER).addTraits(new FT_Corrosive(40), LIQUID); WATZ = new FluidType("WATZ", 0x86653E, 4, 0, 3, EnumSymbol.ACID).addTraits(new FT_Corrosive(60), new FT_VentRadiation(0.1F), LIQUID, VISCOUS); CRYOGEL = new FluidType("CRYOGEL", 0x32ffff, 2, 0, 0, EnumSymbol.CROYGENIC).setTemp(-170).addTraits(LIQUID, VISCOUS); @@ -282,7 +286,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 +329,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 +491,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..dd25601c7 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,8 @@ 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("nodisperse", FT_NoDispersable.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..27628d32a 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,11 @@ public class FluidTraitSimple { info.add(EnumChatFormatting.DARK_RED + "[Requires hazardous material tank to hold]"); } } - + public static class FT_NoDispersable extends FluidTrait { + @Override public void addInfo(List info) { + info.add(EnumChatFormatting.DARK_RED + "[Cannot be thrown from Disperser Canister]"); + } + } 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 6f74b43d8..6d4a7f299 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -935,6 +935,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; @@ -4639,6 +4644,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"); @@ -6359,7 +6371,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 b970e1474..a36f143e1 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 f6aad2998..c09e495eb 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 @@ -846,6 +847,7 @@ death.attack.mku=%1$s died from unknown causes. death.attack.monoxide=%1$s forgot to change the batteries in their carbon monoxide detector. death.attack.mudPoisoning=%1$s died in poisonous mud. death.attack.nuclearBlast=%1$s was blown away by a nuclear explosion. +death.attack.nitan=%1$s was consumed by taint. death.attack.overdose=%1$s overdosed and asphyxiated. death.attack.pc=%1$s was reduced to a puddle in the pink cloud. death.attack.plasma=%1$s was immolated by %2$s. @@ -951,6 +953,7 @@ desc.item.ammo.pro_explosive=+ Explosive desc.item.ammo.pro_fallout=+ Fallout desc.item.ammo.pro_fit_357=+ Fits every .357 model desc.item.ammo.pro_flames=+ Increased flame count +desc.item.ammo.pro_flash=+ ow my eyes desc.item.ammo.pro_gravity=+ Decreased gravity desc.item.ammo.pro_heavy_damage=+ Highly increased damage desc.item.ammo.pro_incendiary=+ Incendiary @@ -1118,6 +1121,7 @@ gun.make.MANN=Open Mann Co. gun.make.MAXIM=Hiram Maxim gun.make.METRO=Metro Gunsmiths gun.make.MWT=MWT Prototype Labs +gun.make.MORITA=Morita Company gun.make.NAWS=Kayarm Industries gun.make.ERFURT=Erfurter Maschinenfabrik Geipel gun.make.NONE=- @@ -1404,6 +1408,10 @@ hbmfluid.woodoil=Wood Oil hbmfluid.xenon=Xenon Gas hbmfluid.xpjuice=Experience Juice hbmfluid.xylene=BTX +hbmfluid.caulk=Quick-Hardening Caulk +hbmfluid.pheromone=Booster Pheromone +hbmfluid.pheromone_m=Modified Booster Pheromone + hbmpseudofluid.none=Empty hbmpseudofluid.heuf6=Highly Enriched UF6 hbmpseudofluid.meuf6=Medium Enriched UF6 @@ -1580,6 +1588,9 @@ item.ammo_44_star.name=.44 Magnum Bullet (Starmetal) item.ammo_45.name=.45 ACP Bullet item.ammo_45_ap.name=.45 ACP Bullet (AP) item.ammo_45_du.name=.45 ACP Bullet (DU) +item.ammo_45_drum.name=.45 ACP 100 Round Drum +item.ammo_45_drum_ap.name=.45 ACP 100 Round Drum (AP) +item.ammo_45_drum_du.name=.45 ACP 100 Round Drum (DU) item.ammo_4gauge.name=4 Gauge Buckshot item.ammo_4gauge_balefire.name=23mm Balefire Grenade item.ammo_4gauge_canister.name=23mm Rocket (Canister Shot) @@ -1592,6 +1603,8 @@ item.ammo_4gauge_semtex.name=23mm Mining Charge item.ammo_4gauge_sleek.name=4 Gauge Buckshot (IF-R&D) item.ammo_4gauge_slug.name=4 Gauge Solid Steel Slug item.ammo_4gauge_titan.name=4 Gauge Quacker Round +item.ammo_4gauge_flash1.name=4 Gauge Hviezda Round +item.ammo_4gauge_flash2.name=4 Gauge Hviezda-S Round item.ammo_4gauge_vampire.name=4 Gauge Wooden Stake Shell item.ammo_4gauge_void.name=4 Gauge Void Shell item.ammo_50ae.name=.50 AE Round @@ -2487,6 +2500,8 @@ item.flame_politics.desc=Donald Duck will build the wall! item.flame_pony.name=Painting of a Cartoon Pony item.flame_pony.desc=Yellow horse beats blue horse, that's a proven fact! item.flask_infusion.shield.name=Shield Infusion +item.flask_infusion.nitan.name=NITAN© Ambrosia +item.flask_infusion.nitan.desc=Painkiller for medical and recreational use only. item.fleija_core.name=F.L.E.I.J.A. Uranium 235 Charge item.fleija_igniter.name=Pulse Igniter item.fleija_kit.name=F.L.E.I.J.A. Kit @@ -2614,6 +2629,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 @@ -2671,6 +2693,7 @@ item.gun_lacunae_ammo.name=5mm Round (LEGACY) item.gun_lever_action.name=Mare's Leg (Original) item.gun_lever_action_ammo.name=12x74 Buckshot (LEGACY) item.gun_lever_action_dark.name=Mare's Leg (Dark) +item.gun_lever_action_akimbo.name=Mare's Leg (Dusk) item.gun_lever_action_sonata.name=Flipped Mare's Leg item.gun_lever_action_sonata_2.name=§cSonata's Microphone§r item.gun_lunatic_marksman.name=Lunatic Sniper Rifle @@ -2679,6 +2702,8 @@ item.gun_minigun.name=CZ53 Personal Minigun item.gun_mirv.name=M42 Nuclear Catapult "Experimental MIRV" item.gun_mirv_ammo.name=Eightfold MIRV (LEGACY) item.gun_moist_nugget.name=Mosin-Nagant +item.gun_morita.name=Morita Assault Rifle +item.gun_morita_carbine.name=Morita Carbine item.gun_mp.name=Pacifist's Machine Gun item.gun_mp40.name=Submachine Gun item.gun_mp40_ammo.name=Submachine Gun Round (LEGACY) @@ -2729,6 +2754,7 @@ item.gun_super_shotgun.name=Super Shotgun item.gun_super_shotgun.desc=It's super broken! item.gun_supershotgun.name=Super Shotgun item.gun_thompson.name=Thompson Submachine Gun +item.gun_typewriter.name=The Chicago Typewriter item.gun_uac_pistol.name=UAC .45 Pistol item.gun_uboinik.name=Uboinik item.gun_uboinik_ammo.name=12x70 Buckshot (LEGACY) @@ -3197,6 +3223,7 @@ item.mp_warhead_15_n2.name=Size 15 N² Mine item.mp_warhead_15_nuclear.name=Size 15 Nuclear Warhead item.mp_warhead_15_nuclear_mimi.name=Size 15 Mimi-chan's Head item.mp_warhead_15_nuclear_shark.name=Size 15 Nuclear Warhead +item.mp_warhead_15_mirv.name=Size 15 MIRV Warhead item.mp_warhead_15_turbine.name=Size 15 Jet Engine item.mucho_mango.name=AriZona Mucho Mango item.multi_kit.name=Multi Purpose Bomb Kit @@ -4271,7 +4298,7 @@ item.warhead_incendiary_large.name=Large Incendiary Warhead item.warhead_incendiary_medium.name=Medium Incendiary Warhead item.warhead_incendiary_small.name=Small Incendiary Warhead item.warhead_mirv.name=Thermonuclear Warhead -item.warhead_mirvlet.name=MIRV +item.warhead_mirvlet.name=Compact Nuclear Warhead item.warhead_nuclear.name=Nuclear Warhead item.warhead_thermo_endo.name=Endothermic Warhead item.warhead_thermo_exo.name=Exothermic Warhead @@ -4369,6 +4396,7 @@ potion.hbm_radiation=Contaminated potion.hbm_radx=Rad-X potion.hbm_stability=Stability potion.hbm_taint=Tainted +potion.hbm_nitan=Ambrosia potion.hbm_telekinesis=! ! ! radar.clearMap=Clear Map @@ -4861,7 +4889,12 @@ tile.door_office.name=Office Door tile.ducrete.name=Ducrete Tile tile.ducrete_stairs.name=Ducrete Tile Stairs tile.ducrete_smooth.name=Ducrete + +tile.concrete_debris.name=Concrete Debris +tile.ducrete_debris.name=Ducrete Debris + 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 @@ -4954,6 +4987,7 @@ tile.glass_quartz.name=Quartz Glass tile.glass_trinitite.name=Trinity Glass tile.glass_uranium.name=Uranium Glass tile.glyphid_base.name=Glyphid Hive Block +tile.glyphid_support.name=Glyphid Hive Support Block tile.glyphid_spawner.name=Glyphid Hive Spawner tile.gneiss_brick.name=Schist Brick tile.gneiss_chiseled.name=Chiseled Schist 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 0000000000000000000000000000000000000000..8517917d84533de3b5217a1acaf6867d04c4d4ae GIT binary patch literal 423 zcmV;Y0a*TtP)Px#1ZP1_K>z@;j|==^1poj5a!^cEMPsV$V5jLhg~w>G@nx*; zS)k%{yZv&x`$>?}YO(Wnz5jc{|4xrj{3UZv+egT;8i|9{5+Z?^bt zwDw=7=s<_bLyF9L!T)Ej@Kv1NM~=`>me@>_)lHPvfyn=Ys1E-C000SaNLh0L01m?d z01m?e$8V@)0002KNklzirr*>x(&DlVo*#a#V;DJns_xGAa+A0s`enL0CdCdU(nD-EFm zldecu*MaChHZx#9YWXaMkppXSr_z?&J+kF5Jcg>U?7Z)u=H?i`X*y{b9>Ipm|E&ES{*Px#1ZP1_K>z@;j|==^1poj5a!^cEMN-qcPtdnU$F57vvp~V9F|wI0u9a8Vzf{${ zNXf8cd{u$zC^{WHn*NWzot99qddK&aPio7R`6y3000SaNLh0L01m?d z01m?e$8V@)0002KNklzirr*>x(&DlVo*#a#V;DJns_xGAa+A0s`enL0CdCdU(nD-EFm zldecu*MaChHZx#9YWXaMkppXSr_z?&J+kF5Jcg>U?7Z)u=H?i`X*y{b9>Ipm|E&ES{*NS%G}Z0G|+7?|P@O1>O~#3WN>#o3_^^uZl`q5gD^MP&H64du@_Qg076cSjVoW zv{kV&O9Lx66$JNri|B&v*{Rmh3#5cgg8YL2V*rLtwRbpx(wqezk;M!Qe1}1p@p%4< z6rfz5;L{CK3`{*bZ+PzS zt4;p#@iDt|*zGg_|4Yu4n6fV}b;AFDoU53a4*0pUD=be>Nio<{{k`wu)6>&=m{z~%jvftP0!EI zZ{}^_I(TqRYdM- T=T*-Kh8BaTtDnm{r-UW|A}N;B literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..2fdf3d9419511af0d49b291a3a4d4f413c184177 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|>0G|-oqeqYa|NsBqy?a1`Y3JSxg4C4+`2_<78631$egX113p^r=85sEX zgD|57Yp@DX(A?9-F+?MHZI2-zg8>H<p5_~d n1sA4TF690l!uI=>ZHGtWNv5kQnbP0l+XkKRR}&> literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..0b1a48e6f533324bd8028b67403ec9f99d30caf7 GIT binary patch literal 339 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBufiR<}hF1en@P(&~V~B-+vP8iFj-`POtJYqt7x??=b~qcS zUS8Yn_VtOO>`WG_6}?XnwquVZ z_%T1QHSzLAasLA*9>p6bSm1l5^d4C6{i1#5{)q?g_tyuA z$uVqVoULo{;8|*`V*f)XZO%*$ZsD3AUztxGVr=-A&UEv^)8yudT)x$^JKipcVB~(p zq|lnC=T_kQ%)!iqCxtPDgU?_Q&&~d-LrFaL|NkZK`1w%wu=?c;wPTXGExBz*2N{mI fi%aJ;G%_+MnfR|cq3xam^fQB}tDnm{r-UW|{xp19 literal 0 HcmV?d00001 From ab9f5432a5da397d0ede3295fe73b922eaa1378b Mon Sep 17 00:00:00 2001 From: 70000hp <105080577+70000hp@users.noreply.github.com> Date: Fri, 8 Dec 2023 18:54:15 -0500 Subject: [PATCH 02/10] made the tasks comprehensible --- .../com/hbm/entity/mob/EntityGlyphid.java | 48 +++++++++++-------- .../hbm/entity/mob/EntityGlyphidNuclear.java | 10 ++-- .../hbm/entity/mob/EntityGlyphidScout.java | 26 +++++----- 3 files changed, 47 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 157e21a89..5699f060f 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -62,6 +62,15 @@ public class EntityGlyphid extends EntityMob { 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); @@ -115,14 +124,14 @@ public class EntityGlyphid extends EntityMob { onBlinded(); } - if(getCurrentTask() == 4){ + if(getCurrentTask() == follow){ //incase the waypoint somehow doesn't exist and it got this task anyway - if(isAtDestination() && taskX == 0) { - setCurrentTask(0, null); + 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() == 6 && ticksExisted % 20 == 0 && isAtDestination()) { + } else if (getCurrentTask() == dig && ticksExisted % 20 == 0 && isAtDestination()) { swingItem(); ExplosionVNT vnt = new ExplosionVNT(worldObj, taskX, taskY + 2, taskZ, blastSize, this); @@ -161,7 +170,7 @@ public class EntityGlyphid extends EntityMob { @Override protected void updateWanderPath() { - if(getCurrentTask() == 0) { + if(getCurrentTask() == none) { super.updateWanderPath(); } } @@ -176,7 +185,8 @@ public class EntityGlyphid extends EntityMob { // hell yeah!! if (useExtendedTargeting() && this.entityToAttack != null) { this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, true, true)); - } else if (getCurrentTask() != 0) { + } else if (getCurrentTask() != none) { + this.worldObj.theProfiler.startSection("stroll"); if (!isAtDestination()) { @@ -193,11 +203,11 @@ public class EntityGlyphid extends EntityMob { } - if (taskX != 0) { + if (taskX != none) { if(MobConfig.rampantDig) { MovingObjectPosition obstacle = findWaypointObstruction(); - if (getScale() >= 1 && getCurrentTask() != 6 && obstacle != null) { + if (getScale() >= 1 && getCurrentTask() != dig && obstacle != null) { digToWaypoint(obstacle); } else { Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ); @@ -260,7 +270,7 @@ public class EntityGlyphid extends EntityMob { @Override protected boolean canDespawn() { - return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == 0; + return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == none; } @Override @@ -444,16 +454,16 @@ public class EntityGlyphid extends EntityMob { switch(task){ //call for reinforcements - case 1: if(taskWaypoint != null){ - communicate(4, taskWaypoint); - setCurrentTask(4, taskWaypoint); + 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 3: + case reinforcements: if (!worldObj.isRemote && taskWaypoint == null) { @@ -463,15 +473,15 @@ public class EntityGlyphid extends EntityMob { //First, go home and get reinforcements EntityWaypoint home = new EntityWaypoint(worldObj); - home.setWaypointType(1); + home.setWaypointType(comm); home.setAdditionalWaypoint(additional); home.setHighPriority(); home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); worldObj.spawnEntityInWorld(home); this.taskWaypoint = home; - communicate(4, home); - setCurrentTask(4, taskWaypoint); + communicate(follow, home); + setCurrentTask(follow, taskWaypoint); break; } @@ -482,7 +492,7 @@ public class EntityGlyphid extends EntityMob { //fifth task is used only in the scout and big man johnson, for terraforming //dig - case 6: + case dig: shouldDig = true; break; @@ -554,13 +564,13 @@ public class EntityGlyphid extends EntityMob { previousTask = getCurrentTask(); previousWaypoint = getWaypoint(); - setCurrentTask(6, target); + 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(6, target); + communicate(dig, target); } ///DIGGING END diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java index 179a56d54..bb617e2b0 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java @@ -51,15 +51,15 @@ public class EntityGlyphidNuclear extends EntityGlyphid { public void onUpdate() { super.onUpdate(); if (ticksExisted % 20 == 0) { - if (isAtDestination() && getCurrentTask() == 4) { - setCurrentTask(0, null); + if (isAtDestination() && getCurrentTask() == follow) { + setCurrentTask(none, null); } - if(getCurrentTask() == 2 && getAITarget() == null){ + if(getCurrentTask() == expand && getAITarget() == null){ this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10 * 20, 3)); } - if (getCurrentTask() == 5) { + if (getCurrentTask() == terraform) { this.setHealth(0); } @@ -131,7 +131,7 @@ public class EntityGlyphidNuclear extends EntityGlyphid { ++this.deathTicks; if(!hasWaypoint) { - communicate(3, null); + communicate(reinforcements, null); hasWaypoint = true; } if(deathTicks == 90){ diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java index 8c9e5db93..c1a24ad99 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java @@ -69,7 +69,7 @@ public class EntityGlyphidScout extends EntityGlyphid { super.onUpdate(); - if((getCurrentTask() != 2 || getCurrentTask() != 5) && taskWaypoint == null) { + if((getCurrentTask() != expand || getCurrentTask() != terraform) && taskWaypoint == null) { if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){ if(!hasTarget) { @@ -98,7 +98,7 @@ public class EntityGlyphidScout extends EntityGlyphid { } - if(getCurrentTask() == 2 || getCurrentTask() == 5) { + 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 @@ -123,8 +123,8 @@ public class EntityGlyphidScout extends EntityGlyphid { } } - if (getCurrentTask() == 5 && super.isAtDestination() && doubleCheckHive()) { - communicate(5, taskWaypoint); + if (getCurrentTask() == terraform && super.isAtDestination() && doubleCheckHive()) { + communicate(terraform, taskWaypoint); } if (ticksExisted % 10 == 0 && isAtDestination()) { @@ -135,11 +135,11 @@ public class EntityGlyphidScout extends EntityGlyphid { EntityWaypoint additional = new EntityWaypoint(worldObj); additional.setLocationAndAngles(posX, posY, posZ, 0, 0); - additional.setWaypointType(0); + additional.setWaypointType(none); //First, go home and get reinforcements EntityWaypoint home = new EntityWaypoint(worldObj); - home.setWaypointType(1); + home.setWaypointType(comm); home.setAdditionalWaypoint(additional); home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); home.maxAge = 1200; @@ -149,7 +149,7 @@ public class EntityGlyphidScout extends EntityGlyphid { this.taskWaypoint = home; this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10)); - communicate(1, taskWaypoint); + communicate(comm, taskWaypoint); } else if (timer >= 5) { @@ -161,7 +161,7 @@ public class EntityGlyphidScout extends EntityGlyphid { this.setDead(); } else { - communicate(4, taskWaypoint); + communicate(follow, taskWaypoint); } } } @@ -182,7 +182,7 @@ public class EntityGlyphidScout extends EntityGlyphid { Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); if (block == ModBlocks.glyphid_base) { - setCurrentTask(0 ,null); + setCurrentTask(none ,null); hasTarget = false; return false; } @@ -194,7 +194,7 @@ public class EntityGlyphidScout extends EntityGlyphid { @Override public boolean isAtDestination() { - return this.getCurrentTask() == 2 && super.isAtDestination(); + return this.getCurrentTask() == expand && super.isAtDestination(); } public boolean findJohnson(){ @@ -252,7 +252,7 @@ public class EntityGlyphidScout extends EntityGlyphid { //updates the task coordinates setCurrentTask(getCurrentTask(), taskWaypoint); - communicate(2, taskWaypoint); + communicate(expand, taskWaypoint); } return true; } @@ -264,7 +264,7 @@ public class EntityGlyphidScout extends EntityGlyphid { public void carryOutTask() { if (!worldObj.isRemote && taskWaypoint == null) { switch(getCurrentTask()){ - case 3: + case reinforcements: this.removePotionEffect(Potion.moveSlowdown.id); this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 20, 4)); @@ -286,7 +286,7 @@ public class EntityGlyphidScout extends EntityGlyphid { break; //terraforming task, only used if a big man johnson is near the scout - case 5: + case terraform: scoutingRange = 60; minDistanceToHive = 20; } From 897308cb7f97ac405fc21b05911a0c1777aed2e1 Mon Sep 17 00:00:00 2001 From: 70000hp <105080577+70000hp@users.noreply.github.com> Date: Fri, 8 Dec 2023 19:35:02 -0500 Subject: [PATCH 03/10] e --- src/main/java/com/hbm/config/MobConfig.java | 1 - .../java/com/hbm/entity/effect/EntityMist.java | 18 ++++++++---------- .../hbm/handler/guncfg/Gun12GaugeFactory.java | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index 81724a61b..59f6c9e3f 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -151,7 +151,6 @@ public class MobConfig { config.addCustomCategoryComment(CATEGORY,rampantDesc); - //TODO: Disable this before release 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"); diff --git a/src/main/java/com/hbm/entity/effect/EntityMist.java b/src/main/java/com/hbm/entity/effect/EntityMist.java index 8537520b2..713ebf06e 100644 --- a/src/main/java/com/hbm/entity/effect/EntityMist.java +++ b/src/main/java/com/hbm/entity/effect/EntityMist.java @@ -206,18 +206,16 @@ public class EntityMist extends Entity { FT_Pheromone pheromone = type.getTrait(FT_Pheromone.class); if(living != null) { - living.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 1)); - living.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 2 * 60 * 20, 1)); - living.addPotionEffect(new PotionEffect(Potion.regeneration.id, 2 * 20, 0)); + if ((living instanceof EntityGlyphid && pheromone.getType() == 1) || (living instanceof EntityPlayer && pheromone.getType() == 2)) { + int mult = pheromone.getType(); - if (living instanceof EntityGlyphid && pheromone.getType() == 1) { - living.addPotionEffect(new PotionEffect(Potion.resistance.id, 60 * 20, 0)); - living.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 60 * 20, 1)); - living.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 60 * 20, 0)); + 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)); - } else if (living instanceof EntityPlayer && pheromone.getType() == 2) { - living.addPotionEffect(new PotionEffect(Potion.resistance.id, 2 * 60 * 20, 0)); - living.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 2 * 60 * 20, 1)); } } } 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() From 4a72e201cf95c9ac50d46a35da981881776d4fb2 Mon Sep 17 00:00:00 2001 From: 70000hp <105080577+70000hp@users.noreply.github.com> Date: Mon, 11 Dec 2023 18:58:34 -0500 Subject: [PATCH 04/10] removed unused lang, removed No_Disperse --- .../hbm/inventory/FluidContainerRegistry.java | 7 +++-- .../com/hbm/inventory/fluid/FluidType.java | 2 +- .../java/com/hbm/inventory/fluid/Fluids.java | 5 ++-- .../hbm/inventory/fluid/trait/FluidTrait.java | 1 - .../fluid/trait/FluidTraitSimple.java | 6 +--- src/main/resources/assets/hbm/lang/en_US.lang | 29 ++++--------------- 6 files changed, 14 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/hbm/inventory/FluidContainerRegistry.java b/src/main/java/com/hbm/inventory/FluidContainerRegistry.java index ce44b7eb3..5033ee2a4 100644 --- a/src/main/java/com/hbm/inventory/FluidContainerRegistry.java +++ b/src/main/java/com/hbm/inventory/FluidContainerRegistry.java @@ -68,9 +68,12 @@ 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.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; diff --git a/src/main/java/com/hbm/inventory/fluid/FluidType.java b/src/main/java/com/hbm/inventory/fluid/FluidType.java index 853a8d2d1..728c0bad2 100644 --- a/src/main/java/com/hbm/inventory/fluid/FluidType.java +++ b/src/main/java/com/hbm/inventory/fluid/FluidType.java @@ -172,7 +172,7 @@ public class FluidType { return this.traits.containsKey(FT_LeadContainer.class); } public boolean isDispersable() { - return !(this.traits.containsKey(FT_NoDispersable.class)); + return !(this.traits.containsKey(FT_Amat.class) || this.traits.containsKey(FT_NoContainer.class) || this.traits.containsKey(FT_Viscous.class)); } /** diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index 61768d294..4c83847b2 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -186,7 +186,6 @@ public class Fluids { public static final FT_Delicious DELICIOUS = new FT_Delicious(); public static final FT_Leaded LEADED = new FT_Leaded(); - public static final FT_NoDispersable NO_DISPERSE= new FT_NoDispersable(); public static void init() { // ##### ##### ##### ##### ## # ##### # # ##### ## # ##### @@ -235,8 +234,8 @@ public class Fluids { PUF6 = new FluidType("PUF6", 0x4C4C4C, 4, 0, 4, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(0.1F), new FT_Corrosive(15), GASEOUS); SAS3 = new FluidType("SAS3", 0x4ffffc, 5, 0, 4, EnumSymbol.RADIATION).addTraits(new FT_VentRadiation(1F), new FT_Corrosive(30), LIQUID); SCHRABIDIC = new FluidType("SCHRABIDIC", 0x006B6B, 5, 0, 5, EnumSymbol.ACID).addTraits(new FT_VentRadiation(1F), new FT_Corrosive(75), new FT_Poison(true, 2), LIQUID); - AMAT = new FluidType("AMAT", 0x010101, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS, NO_DISPERSE); - ASCHRAB = new FluidType("ASCHRAB", 0xb50000, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS, NO_DISPERSE); + AMAT = new FluidType("AMAT", 0x010101, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS); + ASCHRAB = new FluidType("ASCHRAB", 0xb50000, 5, 0, 5, EnumSymbol.ANTIMATTER).addTraits(ANTI, GASEOUS); ACID = new FluidType("ACID", 0xfff7aa, 3, 0, 3, EnumSymbol.OXIDIZER).addTraits(new FT_Corrosive(40), LIQUID); WATZ = new FluidType("WATZ", 0x86653E, 4, 0, 3, EnumSymbol.ACID).addTraits(new FT_Corrosive(60), new FT_VentRadiation(0.1F), LIQUID, VISCOUS); CRYOGEL = new FluidType("CRYOGEL", 0x32ffff, 2, 0, 0, EnumSymbol.CROYGENIC).setTemp(-170).addTraits(LIQUID, VISCOUS); 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 dd25601c7..de7ddc591 100644 --- a/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java +++ b/src/main/java/com/hbm/inventory/fluid/trait/FluidTrait.java @@ -36,7 +36,6 @@ public abstract class FluidTrait { traitNameMap.put("delicious", FT_Delicious.class); traitNameMap.put("leaded", FT_Leaded.class); traitNameMap.put("pheromone", FT_Pheromone.class); - traitNameMap.put("nodisperse", FT_NoDispersable.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 27628d32a..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,11 +49,7 @@ public class FluidTraitSimple { info.add(EnumChatFormatting.DARK_RED + "[Requires hazardous material tank to hold]"); } } - public static class FT_NoDispersable extends FluidTrait { - @Override public void addInfo(List info) { - info.add(EnumChatFormatting.DARK_RED + "[Cannot be thrown from Disperser Canister]"); - } - } + public static class FT_Delicious extends FluidTrait { @Override public void addInfoHidden(List info) { info.add(EnumChatFormatting.DARK_GREEN + "[Delicious]"); diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index c09e495eb..033f2cf5a 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -847,7 +847,6 @@ death.attack.mku=%1$s died from unknown causes. death.attack.monoxide=%1$s forgot to change the batteries in their carbon monoxide detector. death.attack.mudPoisoning=%1$s died in poisonous mud. death.attack.nuclearBlast=%1$s was blown away by a nuclear explosion. -death.attack.nitan=%1$s was consumed by taint. death.attack.overdose=%1$s overdosed and asphyxiated. death.attack.pc=%1$s was reduced to a puddle in the pink cloud. death.attack.plasma=%1$s was immolated by %2$s. @@ -953,7 +952,6 @@ desc.item.ammo.pro_explosive=+ Explosive desc.item.ammo.pro_fallout=+ Fallout desc.item.ammo.pro_fit_357=+ Fits every .357 model desc.item.ammo.pro_flames=+ Increased flame count -desc.item.ammo.pro_flash=+ ow my eyes desc.item.ammo.pro_gravity=+ Decreased gravity desc.item.ammo.pro_heavy_damage=+ Highly increased damage desc.item.ammo.pro_incendiary=+ Incendiary @@ -1121,7 +1119,6 @@ gun.make.MANN=Open Mann Co. gun.make.MAXIM=Hiram Maxim gun.make.METRO=Metro Gunsmiths gun.make.MWT=MWT Prototype Labs -gun.make.MORITA=Morita Company gun.make.NAWS=Kayarm Industries gun.make.ERFURT=Erfurter Maschinenfabrik Geipel gun.make.NONE=- @@ -1361,6 +1358,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 @@ -1408,9 +1407,8 @@ hbmfluid.woodoil=Wood Oil hbmfluid.xenon=Xenon Gas hbmfluid.xpjuice=Experience Juice hbmfluid.xylene=BTX -hbmfluid.caulk=Quick-Hardening Caulk -hbmfluid.pheromone=Booster Pheromone -hbmfluid.pheromone_m=Modified Booster Pheromone + + hbmpseudofluid.none=Empty hbmpseudofluid.heuf6=Highly Enriched UF6 @@ -1588,9 +1586,6 @@ item.ammo_44_star.name=.44 Magnum Bullet (Starmetal) item.ammo_45.name=.45 ACP Bullet item.ammo_45_ap.name=.45 ACP Bullet (AP) item.ammo_45_du.name=.45 ACP Bullet (DU) -item.ammo_45_drum.name=.45 ACP 100 Round Drum -item.ammo_45_drum_ap.name=.45 ACP 100 Round Drum (AP) -item.ammo_45_drum_du.name=.45 ACP 100 Round Drum (DU) item.ammo_4gauge.name=4 Gauge Buckshot item.ammo_4gauge_balefire.name=23mm Balefire Grenade item.ammo_4gauge_canister.name=23mm Rocket (Canister Shot) @@ -1603,8 +1598,6 @@ item.ammo_4gauge_semtex.name=23mm Mining Charge item.ammo_4gauge_sleek.name=4 Gauge Buckshot (IF-R&D) item.ammo_4gauge_slug.name=4 Gauge Solid Steel Slug item.ammo_4gauge_titan.name=4 Gauge Quacker Round -item.ammo_4gauge_flash1.name=4 Gauge Hviezda Round -item.ammo_4gauge_flash2.name=4 Gauge Hviezda-S Round item.ammo_4gauge_vampire.name=4 Gauge Wooden Stake Shell item.ammo_4gauge_void.name=4 Gauge Void Shell item.ammo_50ae.name=.50 AE Round @@ -2500,8 +2493,6 @@ item.flame_politics.desc=Donald Duck will build the wall! item.flame_pony.name=Painting of a Cartoon Pony item.flame_pony.desc=Yellow horse beats blue horse, that's a proven fact! item.flask_infusion.shield.name=Shield Infusion -item.flask_infusion.nitan.name=NITAN© Ambrosia -item.flask_infusion.nitan.desc=Painkiller for medical and recreational use only. item.fleija_core.name=F.L.E.I.J.A. Uranium 235 Charge item.fleija_igniter.name=Pulse Igniter item.fleija_kit.name=F.L.E.I.J.A. Kit @@ -2693,7 +2684,6 @@ item.gun_lacunae_ammo.name=5mm Round (LEGACY) item.gun_lever_action.name=Mare's Leg (Original) item.gun_lever_action_ammo.name=12x74 Buckshot (LEGACY) item.gun_lever_action_dark.name=Mare's Leg (Dark) -item.gun_lever_action_akimbo.name=Mare's Leg (Dusk) item.gun_lever_action_sonata.name=Flipped Mare's Leg item.gun_lever_action_sonata_2.name=§cSonata's Microphone§r item.gun_lunatic_marksman.name=Lunatic Sniper Rifle @@ -2702,8 +2692,6 @@ item.gun_minigun.name=CZ53 Personal Minigun item.gun_mirv.name=M42 Nuclear Catapult "Experimental MIRV" item.gun_mirv_ammo.name=Eightfold MIRV (LEGACY) item.gun_moist_nugget.name=Mosin-Nagant -item.gun_morita.name=Morita Assault Rifle -item.gun_morita_carbine.name=Morita Carbine item.gun_mp.name=Pacifist's Machine Gun item.gun_mp40.name=Submachine Gun item.gun_mp40_ammo.name=Submachine Gun Round (LEGACY) @@ -2754,7 +2742,6 @@ item.gun_super_shotgun.name=Super Shotgun item.gun_super_shotgun.desc=It's super broken! item.gun_supershotgun.name=Super Shotgun item.gun_thompson.name=Thompson Submachine Gun -item.gun_typewriter.name=The Chicago Typewriter item.gun_uac_pistol.name=UAC .45 Pistol item.gun_uboinik.name=Uboinik item.gun_uboinik_ammo.name=12x70 Buckshot (LEGACY) @@ -3223,7 +3210,6 @@ item.mp_warhead_15_n2.name=Size 15 N² Mine item.mp_warhead_15_nuclear.name=Size 15 Nuclear Warhead item.mp_warhead_15_nuclear_mimi.name=Size 15 Mimi-chan's Head item.mp_warhead_15_nuclear_shark.name=Size 15 Nuclear Warhead -item.mp_warhead_15_mirv.name=Size 15 MIRV Warhead item.mp_warhead_15_turbine.name=Size 15 Jet Engine item.mucho_mango.name=AriZona Mucho Mango item.multi_kit.name=Multi Purpose Bomb Kit @@ -4298,7 +4284,7 @@ item.warhead_incendiary_large.name=Large Incendiary Warhead item.warhead_incendiary_medium.name=Medium Incendiary Warhead item.warhead_incendiary_small.name=Small Incendiary Warhead item.warhead_mirv.name=Thermonuclear Warhead -item.warhead_mirvlet.name=Compact Nuclear Warhead +item.warhead_mirvlet.name=MIRV item.warhead_nuclear.name=Nuclear Warhead item.warhead_thermo_endo.name=Endothermic Warhead item.warhead_thermo_exo.name=Exothermic Warhead @@ -4396,7 +4382,6 @@ potion.hbm_radiation=Contaminated potion.hbm_radx=Rad-X potion.hbm_stability=Stability potion.hbm_taint=Tainted -potion.hbm_nitan=Ambrosia potion.hbm_telekinesis=! ! ! radar.clearMap=Clear Map @@ -4890,9 +4875,6 @@ tile.ducrete.name=Ducrete Tile tile.ducrete_stairs.name=Ducrete Tile Stairs tile.ducrete_smooth.name=Ducrete -tile.concrete_debris.name=Concrete Debris -tile.ducrete_debris.name=Ducrete Debris - tile.ducrete_smooth_stairs.name=Ducrete Stairs tile.dummy_block.name=Dummy Block @@ -4987,7 +4969,6 @@ tile.glass_quartz.name=Quartz Glass tile.glass_trinitite.name=Trinity Glass tile.glass_uranium.name=Uranium Glass tile.glyphid_base.name=Glyphid Hive Block -tile.glyphid_support.name=Glyphid Hive Support Block tile.glyphid_spawner.name=Glyphid Hive Spawner tile.gneiss_brick.name=Schist Brick tile.gneiss_chiseled.name=Chiseled Schist From 8a59eb9dbc8f59721c39ff4875ea2db2668bd7fb Mon Sep 17 00:00:00 2001 From: Boblet Date: Wed, 13 Dec 2023 11:08:01 +0100 Subject: [PATCH 05/10] initial cleanup --- src/main/java/com/hbm/config/MobConfig.java | 10 +- .../com/hbm/entity/mob/EntityGlyphid.java | 98 ++++++------- .../hbm/entity/mob/EntityGlyphidBehemoth.java | 6 +- .../hbm/entity/mob/EntityGlyphidBrenda.java | 3 - .../hbm/entity/mob/EntityGlyphidNuclear.java | 19 ++- .../hbm/entity/mob/EntityGlyphidScout.java | 138 +++++++++--------- .../com/hbm/inventory/OreDictManager.java | 1 - .../java/com/hbm/inventory/fluid/Fluids.java | 4 +- src/main/java/com/hbm/main/ClientProxy.java | 2 +- .../com/hbm/world/feature/GlyphidHive.java | 2 - src/main/resources/assets/hbm/lang/en_US.lang | 9 +- 11 files changed, 133 insertions(+), 159 deletions(-) diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index 59f6c9e3f..19d515b5a 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -39,7 +39,7 @@ public class MobConfig { public static int swarmCooldown = 120; public static int baseSwarmSize = 5; - public static double swarmScalingMult = 1.2; + public static double swarmScalingMult = 1.2; public static int sootStep = 50; public static int[] glyphidChance = {50, -40}; @@ -119,10 +119,10 @@ public class MobConfig { + "The base chance is the stock chance of the bug to spawn within a swarm, unaffected by soot\n" + "As soot increases, the spawn rate of the bug increases until it reaches a limit determined by the modifier\n" + "If the default chance is negative, the mob will not spawn by default, and the lower it is,\n" - + "The longer it takes for the modifier to make it positive\n" - + "If the Modifier is negative, the bug will spawn less often in swarms,\n" + + "The longer it takes for the modifier to make it positive\n" + + "If the Modifier is negative, the bug will spawn less often in swarms,\n" + "And its place will be taken over by another one.\n" - + "\n" + + "\n" + "The formula for glyphid spawning chance is: (chance + (modifier - modifier / (soot/10)))" + "The formula for glyphid swarm scaling is: (baseSwarmSize * Math.max(swarmScalingMult * soot/sootStep, 1))"); @@ -140,7 +140,7 @@ public class MobConfig { brendaChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC06_brendaChance", "Base Spawn chance and soot modifier for a glyphid brenda", new int[]{-50, 60}); johnsonChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC07_johnsonChance", "Base Spawn chance and soot modifier for Big Man Johnson", new int[]{-50, 60}); - String rampantDesc = "Rampant Mode changes glyphid behavior and spawning to be more aggressive, changes include:\n" + String rampantDesc = "Rampant Mode changes glyphid behavior and spawning to be more aggressive, changes include:\n" + "\n" + "Glyphid Scouts will naturally spawn alongside normal mobs if soot levels are above a certain threshold\n" + "Glyphids will always have the extended targetting enabled\n" diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 5699f060f..11b26b439 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -3,15 +3,12 @@ package com.hbm.entity.mob; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Objects; import com.hbm.blocks.ModBlocks; -import com.hbm.blocks.generic.BlockGlyphidSpawner; import com.hbm.config.MobConfig; import com.hbm.entity.logic.EntityWaypoint; import com.hbm.entity.pathfinder.PathFinderUtils; import com.hbm.explosion.vanillant.ExplosionVNT; -import com.hbm.explosion.vanillant.interfaces.IExplosionSFX; import com.hbm.explosion.vanillant.standard.*; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; @@ -59,29 +56,30 @@ public class EntityGlyphid extends EntityMob { //used for digging, bigger glyphids have a longer reach public int blastSize = Math.min((int) (3 * (getScale()))/2, 5); - public int blastResToDig = Math.min((int) (50 * (getScale() * 2)), 150); + public int blastResToDig = Math.min((int) (50 * (getScale() * 2)), 150); public boolean shouldDig; // Tasks - public static final int none = 0; - public static final int comm = 1; - public static final int expand = 2; - public static final int reinforcements = 3; - public static final int follow = 4; - public static final int terraform = 5; - public static final int dig = 6; + /** Idle state, only makes glpyhids wander around randomly */ + public static final int TASK_IDLE = 0; + /** Causes the glyphid to walk to the waypoint, then communicate the FOLLOW task to nearby glyphids */ + public static final int TASK_RETREAT_FOR_REINFORCEMENTS = 1; + /** Task used by scouts, if the waypoint is reached it will construct a new hive */ + public static final int TASK_BUILD_HIVE = 2; + /** Creates a waypoint at the home position and then immediately initiates the RETREAT_FOR_REINFORCEMENTS task */ + public static final int TASK_INITIATE_RETREAT = 3; + /** Will simply walk to the waypoint and enter IDLE once it is reached */ + public static final int TASK_FOLLOW = 4; + /** Causes nuclear glyphids to immediately self-destruct, also signaling nearby scouts to retreat */ + public static final int TASK_TERRAFORM = 5; + /** Id any task other than IDLE is interrupted by an obstacle, initiates digging behavior which is also communicated to nearby glyohids */ + public static final int TASK_DIG = 6; + EntityWaypoint taskWaypoint = null; + public EntityGlyphid(World world) { super(world); - /*this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); - this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - this.tasks.addTask(8, new EntityAILookIdle(this)); - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));*/ this.setSize(1.75F, 1F); } @@ -124,14 +122,14 @@ public class EntityGlyphid extends EntityMob { onBlinded(); } - if(getCurrentTask() == follow){ + if(getCurrentTask() == TASK_FOLLOW){ //incase the waypoint somehow doesn't exist and it got this task anyway - if(isAtDestination() && taskX == none) { - setCurrentTask(none, null); + if(isAtDestination() && taskX == TASK_IDLE) { + setCurrentTask(TASK_IDLE, null); } //the task cannot be 6 outside of rampant, so this is a non issue p much - } else if (getCurrentTask() == dig && ticksExisted % 20 == 0 && isAtDestination()) { + } else if (getCurrentTask() == TASK_DIG && ticksExisted % 20 == 0 && isAtDestination()) { swingItem(); ExplosionVNT vnt = new ExplosionVNT(worldObj, taskX, taskY + 2, taskZ, blastSize, this); @@ -156,8 +154,8 @@ public class EntityGlyphid extends EntityMob { @Override protected void dropFewItems(boolean byPlayer, int looting) { super.dropFewItems(byPlayer, looting); - Item drop = isBurning() ? ModItems.glyphid_meat_grilled : ModItems.glyphid_meat; - if(rand.nextInt(2) == 0) this.entityDropItem(new ItemStack(drop, ((int)getScale()*2) + looting), 0F); + Item drop = isBurning() ? ModItems.glyphid_meat_grilled : ModItems.glyphid_meat; + if(rand.nextInt(2) == 0) this.entityDropItem(new ItemStack(drop, ((int) getScale() * 2) + looting), 0F); } @Override @@ -170,7 +168,7 @@ public class EntityGlyphid extends EntityMob { @Override protected void updateWanderPath() { - if(getCurrentTask() == none) { + if(getCurrentTask() == TASK_IDLE) { super.updateWanderPath(); } } @@ -185,7 +183,7 @@ public class EntityGlyphid extends EntityMob { // hell yeah!! if (useExtendedTargeting() && this.entityToAttack != null) { this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, true, true)); - } else if (getCurrentTask() != none) { + } else if (getCurrentTask() != TASK_IDLE) { this.worldObj.theProfiler.startSection("stroll"); @@ -203,11 +201,11 @@ public class EntityGlyphid extends EntityMob { } - if (taskX != none) { - if(MobConfig.rampantDig) { + if (taskX != TASK_IDLE) { + if(MobConfig.rampantDig) { MovingObjectPosition obstacle = findWaypointObstruction(); - if (getScale() >= 1 && getCurrentTask() != dig && obstacle != null) { + if (getScale() >= 1 && getCurrentTask() != TASK_DIG && obstacle != null) { digToWaypoint(obstacle); } else { Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ); @@ -222,19 +220,18 @@ public class EntityGlyphid extends EntityMob { } } } + this.worldObj.theProfiler.endSection(); - } } } - } public void onBlinded(){ this.entityToAttack = null; this.setPathToEntity(null); - fleeingTick = 80; + this.fleeingTick = 80; if(getScale() >= 1.25){ if(ticksExisted % 20 == 0) { @@ -253,8 +250,6 @@ public class EntityGlyphid extends EntityMob { if (block == ModBlocks.lantern) { rotationYaw = 360F / 16 * i; swingItem(); - //this function is incredibly useful for breaking blocks naturally but obfuscated - //jesus fucking christ who the fuck runs forge? worldObj.func_147480_a(mop.blockX, mop.blockY, mop.blockZ, false); } @@ -270,7 +265,7 @@ public class EntityGlyphid extends EntityMob { @Override protected boolean canDespawn() { - return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == none; + return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == TASK_IDLE; } @Override @@ -454,16 +449,16 @@ public class EntityGlyphid extends EntityMob { switch(task){ //call for reinforcements - case comm: if(taskWaypoint != null){ - communicate(follow, taskWaypoint); - setCurrentTask(follow, taskWaypoint); + case TASK_RETREAT_FOR_REINFORCEMENTS: if(taskWaypoint != null){ + communicate(TASK_FOLLOW, taskWaypoint); + setCurrentTask(TASK_FOLLOW, taskWaypoint); } break; //expand the hive, used by the scout //case 2: expandHive(null); //retreat - case reinforcements: + case TASK_INITIATE_RETREAT: if (!worldObj.isRemote && taskWaypoint == null) { @@ -473,15 +468,15 @@ public class EntityGlyphid extends EntityMob { //First, go home and get reinforcements EntityWaypoint home = new EntityWaypoint(worldObj); - home.setWaypointType(comm); + home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS); home.setAdditionalWaypoint(additional); home.setHighPriority(); home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); worldObj.spawnEntityInWorld(home); this.taskWaypoint = home; - communicate(follow, home); - setCurrentTask(follow, taskWaypoint); + communicate(TASK_FOLLOW, home); + setCurrentTask(TASK_FOLLOW, taskWaypoint); break; } @@ -492,7 +487,7 @@ public class EntityGlyphid extends EntityMob { //fifth task is used only in the scout and big man johnson, for terraforming //dig - case dig: + case TASK_DIG: shouldDig = true; break; @@ -502,7 +497,8 @@ public class EntityGlyphid extends EntityMob { } - public void communicate(int task, @Nullable EntityWaypoint waypoint) { + /** Copies tasks and waypoint to nearby glyphids. Does not work on glyphid scouts */ + public void communicate(int task, @Nullable EntityWaypoint waypoint) { int radius = waypoint != null ? waypoint.radius : 4; AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( @@ -523,7 +519,7 @@ public class EntityGlyphid extends EntityMob { } } - /** What each type of glyphid does when it is time to expand the hive. + /** What each type of glyphid does when it is time to expand the hive. * @return Whether it has expanded successfully or not * **/ public boolean expandHive(){ @@ -532,10 +528,9 @@ public class EntityGlyphid extends EntityMob { public boolean isAtDestination() { int destinationRadius = taskWaypoint != null ? (int) Math.pow(taskWaypoint.radius, 2) : 25; - return this.getDistanceSq(taskX, taskY, taskZ) <= destinationRadius; } - ///TASK SYSTEM END + ///TASK SYSTEM END ///DIGGING SYSTEM START @@ -564,17 +559,17 @@ public class EntityGlyphid extends EntityMob { previousTask = getCurrentTask(); previousWaypoint = getWaypoint(); - setCurrentTask(dig, target); + setCurrentTask(TASK_DIG, target); Vec3 vec = Vec3.createVectorHelper(posX, posY, posZ); int maxDist = (int) (Math.sqrt(vec.squareDistanceTo(taskX, taskY, taskZ)) * 1.2); this.setPathToEntity(PathFinderUtils.getPathEntityToCoordPartial(worldObj, this, taskX, taskY, taskZ, maxDist, true, false, true, true)); - communicate(dig, target); + communicate(TASK_DIG, target); } ///DIGGING END - + @Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); @@ -608,5 +603,4 @@ public class EntityGlyphid extends EntityMob { this.currentTask = nbt.getInteger("task"); } - } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java index e042626c2..fbc138cde 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java @@ -2,8 +2,6 @@ package com.hbm.entity.mob; import com.hbm.entity.effect.EntityMist; import com.hbm.entity.projectile.EntityChemical; -import com.hbm.inventory.FluidContainerRegistry; -import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.main.ResourceManager; @@ -11,14 +9,12 @@ import com.hbm.main.ResourceManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraftforge.fluids.Fluid; public class EntityGlyphidBehemoth extends EntityGlyphid { @@ -100,7 +96,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid { @Override protected void dropFewItems(boolean byPlayer, int looting) { - this.entityDropItem(new ItemStack(ModItems.glyphid_gland, 1, Fluids.SULFURIC_ACID.getID()), 1); + this.entityDropItem(new ItemStack(ModItems.glyphid_gland, 1, Fluids.SULFURIC_ACID.getID()), 1); super.dropFewItems(byPlayer, looting); } @Override diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java index be4486456..33926bbde 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java @@ -1,15 +1,12 @@ package com.hbm.entity.mob; import com.hbm.entity.effect.EntityMist; -import com.hbm.inventory.FluidContainerRegistry; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.main.ResourceManager; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java index bb617e2b0..d98a13edd 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java @@ -1,7 +1,6 @@ package com.hbm.entity.mob; import com.hbm.blocks.ModBlocks; -import com.hbm.entity.effect.EntityMist; import com.hbm.entity.logic.EntityWaypoint; import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; @@ -9,7 +8,6 @@ import com.hbm.explosion.vanillant.standard.BlockMutatorDebris; import com.hbm.explosion.vanillant.standard.BlockProcessorStandard; import com.hbm.explosion.vanillant.standard.EntityProcessorStandard; import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; -import com.hbm.inventory.fluid.Fluids; import com.hbm.main.MainRegistry; import com.hbm.main.ResourceManager; import com.hbm.packet.AuxParticlePacketNT; @@ -50,22 +48,22 @@ public class EntityGlyphidNuclear extends EntityGlyphid { @Override public void onUpdate() { super.onUpdate(); - if (ticksExisted % 20 == 0) { - if (isAtDestination() && getCurrentTask() == follow) { - setCurrentTask(none, null); + if(ticksExisted % 20 == 0) { + if(isAtDestination() && getCurrentTask() == TASK_FOLLOW) { + setCurrentTask(TASK_IDLE, null); } - if(getCurrentTask() == expand && getAITarget() == null){ + if(getCurrentTask() == TASK_BUILD_HIVE && getAITarget() == null) { this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10 * 20, 3)); } - if (getCurrentTask() == terraform) { + if(getCurrentTask() == TASK_TERRAFORM) { this.setHealth(0); } - } } + /** Communicates only with glyphid scouts, unlike the super implementation which does the opposite */ @Override public void communicate(int task, @Nullable EntityWaypoint waypoint) { int radius = waypoint != null ? waypoint.radius : 4; @@ -99,7 +97,6 @@ public class EntityGlyphidNuclear extends EntityGlyphid { @Override public boolean isArmorBroken(float amount) { - // amount < 5 ? 5 : amount < 10 ? 3 : 2; return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.12, 2), 100); } @@ -131,9 +128,11 @@ public class EntityGlyphidNuclear extends EntityGlyphid { ++this.deathTicks; if(!hasWaypoint) { - communicate(reinforcements, null); + // effectively causes neighboring EntityGlyphidScout to retreat + communicate(TASK_INITIATE_RETREAT, null); hasWaypoint = true; } + if(deathTicks == 90){ int radius = 8; AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java index c1a24ad99..1ceaf824c 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java @@ -17,7 +17,6 @@ import net.minecraft.potion.PotionEffect; import net.minecraft.util.*; import net.minecraft.world.World; -import javax.annotation.Nullable; import java.util.List; public class EntityGlyphidScout extends EntityGlyphid { @@ -28,6 +27,7 @@ public class EntityGlyphidScout extends EntityGlyphid { int minDistanceToHive = 8; boolean useLargeHive = false; float largeHiveChance = MobConfig.largeHiveChance; + public EntityGlyphidScout(World world) { super(world); this.setSize(1.25F, 0.75F); @@ -42,6 +42,7 @@ public class EntityGlyphidScout extends EntityGlyphid { } return false; } + @Override public ResourceLocation getSkin() { return ResourceManager.glyphid_scout_tex; @@ -64,14 +65,14 @@ public class EntityGlyphidScout extends EntityGlyphid { this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D); } + @Override public void onUpdate() { - super.onUpdate(); - if((getCurrentTask() != expand || getCurrentTask() != terraform) && taskWaypoint == null) { + if((getCurrentTask() != TASK_BUILD_HIVE || getCurrentTask() != TASK_TERRAFORM) && taskWaypoint == null) { - if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){ + if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){ if(!hasTarget) { Vec3 dirVec = playerBaseDirFinder( Vec3.createVectorHelper(posX, posY, posZ), @@ -84,62 +85,51 @@ public class EntityGlyphidScout extends EntityGlyphid { worldObj.spawnEntityInWorld(target); hasTarget = true; - setCurrentTask(1, target); + setCurrentTask(TASK_RETREAT_FOR_REINFORCEMENTS, target); } if(super.isAtDestination()) { - setCurrentTask(2, null) ; + setCurrentTask(TASK_BUILD_HIVE, null) ; hasTarget = false; } } else { - setCurrentTask(2, null); + setCurrentTask(TASK_BUILD_HIVE, null); } } - if(getCurrentTask() == expand || getCurrentTask() == terraform) { + if(getCurrentTask() == TASK_BUILD_HIVE || getCurrentTask() == TASK_TERRAFORM) { if(!worldObj.isRemote && !hasTarget) { //Check for whether a big man johnson is nearby, this makes the scout switch into its terraforming task - if(scoutingRange != 60 && findJohnson()){ - setCurrentTask(5, null); + if(scoutingRange != 60 && hasNuclearGlyphidNearby()){ + setCurrentTask(TASK_TERRAFORM, null); } - //Placeholder for a more advanced hive design - /* - if(PollutionHandler.getPollution(worldObj, - (int) posX, - (int) posY, - (int) posZ, PollutionHandler.PollutionType.SOOT) >= MobConfig.largeHiveThreshold){ - - useLargeHive = true; - this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 3)); - }*/ - - if (expandHive()){ - this.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 180*20, 1)); + if(expandHive()) { + this.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 180 * 20, 1)); hasTarget = true; } } - if (getCurrentTask() == terraform && super.isAtDestination() && doubleCheckHive()) { - communicate(terraform, taskWaypoint); + if (getCurrentTask() == TASK_TERRAFORM && super.isAtDestination() && canBuildHiveHere()) { + communicate(TASK_TERRAFORM, taskWaypoint); } if (ticksExisted % 10 == 0 && isAtDestination()) { timer++; - if (!worldObj.isRemote && doubleCheckHive()) { + if (!worldObj.isRemote && canBuildHiveHere()) { if(timer == 1) { EntityWaypoint additional = new EntityWaypoint(worldObj); additional.setLocationAndAngles(posX, posY, posZ, 0, 0); - additional.setWaypointType(none); + additional.setWaypointType(TASK_IDLE); //First, go home and get reinforcements EntityWaypoint home = new EntityWaypoint(worldObj); - home.setWaypointType(comm); + home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS); home.setAdditionalWaypoint(additional); home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); home.maxAge = 1200; @@ -149,7 +139,7 @@ public class EntityGlyphidScout extends EntityGlyphid { this.taskWaypoint = home; this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10)); - communicate(comm, taskWaypoint); + communicate(TASK_RETREAT_FOR_REINFORCEMENTS, taskWaypoint); } else if (timer >= 5) { @@ -161,15 +151,19 @@ public class EntityGlyphidScout extends EntityGlyphid { this.setDead(); } else { - communicate(follow, taskWaypoint); + communicate(TASK_FOLLOW, taskWaypoint); } } } } } - public boolean doubleCheckHive(){ + + /** Returns true if the position is far enough away from other hives. Also resets the task if unsuccessful. */ + public boolean canBuildHiveHere() { int length = useLargeHive ? 16 : 8; + for(int i = 0; i < 8; i++) { + float angle = (float) Math.toRadians(360D / 16 * i); Vec3 rot = Vec3.createVectorHelper(0, 0, length); rot.rotateAroundY(angle); @@ -177,12 +171,12 @@ public class EntityGlyphidScout extends EntityGlyphid { Vec3 nextPos = Vec3.createVectorHelper(this.posX + rot.xCoord, this.posY + 1, this.posZ + rot.zCoord); MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos); - if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if(mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); - if (block == ModBlocks.glyphid_base) { - setCurrentTask(none ,null); + if(block == ModBlocks.glyphid_base) { + setCurrentTask(TASK_IDLE, null); hasTarget = false; return false; } @@ -194,10 +188,10 @@ public class EntityGlyphidScout extends EntityGlyphid { @Override public boolean isAtDestination() { - return this.getCurrentTask() == expand && super.isAtDestination(); + return this.getCurrentTask() == TASK_BUILD_HIVE && super.isAtDestination(); } - public boolean findJohnson(){ + public boolean hasNuclearGlyphidNearby(){ int radius = 8; AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( @@ -209,6 +203,7 @@ public class EntityGlyphidScout extends EntityGlyphid { this.posZ + radius); List bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); + for (Entity e: bugs){ if(e instanceof EntityGlyphidNuclear){ return true; @@ -220,51 +215,50 @@ public class EntityGlyphidScout extends EntityGlyphid { @Override public boolean expandHive() { - int nestX = rand.nextInt((homeX + scoutingRange) - (homeX - scoutingRange)) + (homeX - scoutingRange); - int nestZ = rand.nextInt((homeZ + scoutingRange) - (homeZ - scoutingRange)) + (homeZ - scoutingRange); - int nestY = worldObj.getHeightValue(nestX, nestZ); - Block b = worldObj.getBlock(nestX, nestY - 1, nestZ); + int nestX = rand.nextInt((homeX + scoutingRange) - (homeX - scoutingRange)) + (homeX - scoutingRange); + int nestZ = rand.nextInt((homeZ + scoutingRange) - (homeZ - scoutingRange)) + (homeZ - scoutingRange); + int nestY = worldObj.getHeightValue(nestX, nestZ); + Block b = worldObj.getBlock(nestX, nestY - 1, nestZ); - boolean distanceCheck = Vec3.createVectorHelper( - nestX - homeX, - nestY - homeY, - nestZ - homeZ).lengthVector() > minDistanceToHive; + boolean distanceCheck = Vec3.createVectorHelper(nestX - homeX, nestY - homeY, nestZ - homeZ).lengthVector() > minDistanceToHive; - if(distanceCheck && b.getMaterial() != Material.air && b.isNormalCube() && b != ModBlocks.glyphid_base) { + if(distanceCheck && b.getMaterial() != Material.air && b.isNormalCube() && b != ModBlocks.glyphid_base) { - if(b == ModBlocks.basalt) { - useLargeHive = true; - largeHiveChance /= 2; - this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 3)); - } - if(!worldObj.isRemote) { - EntityWaypoint nest = new EntityWaypoint(worldObj); - nest.setWaypointType(getCurrentTask()); - nest.radius = 5; + if(b == ModBlocks.basalt) { + useLargeHive = true; + largeHiveChance /= 2; + this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 60 * 20, 3)); + } + + if(!worldObj.isRemote) { + EntityWaypoint nest = new EntityWaypoint(worldObj); + nest.setWaypointType(getCurrentTask()); + nest.radius = 5; - if(useLargeHive) - nest.setHighPriority(); + if(useLargeHive) + nest.setHighPriority(); - nest.setLocationAndAngles(nestX, nestY, nestZ, 0, 0); - worldObj.spawnEntityInWorld(nest); + nest.setLocationAndAngles(nestX, nestY, nestZ, 0, 0); + worldObj.spawnEntityInWorld(nest); - taskWaypoint = nest; + taskWaypoint = nest; - //updates the task coordinates - setCurrentTask(getCurrentTask(), taskWaypoint); - communicate(expand, taskWaypoint); - } - return true; - } - return false; + // updates the task coordinates + setCurrentTask(getCurrentTask(), taskWaypoint); + communicate(TASK_BUILD_HIVE, taskWaypoint); + } + + return true; + } + + return false; } - @Override public void carryOutTask() { if (!worldObj.isRemote && taskWaypoint == null) { switch(getCurrentTask()){ - case reinforcements: + case TASK_INITIATE_RETREAT: this.removePotionEffect(Potion.moveSlowdown.id); this.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 20, 4)); @@ -283,23 +277,25 @@ public class EntityGlyphidScout extends EntityGlyphid { worldObj.spawnEntityInWorld(home); communicate(4, home); - break; + break; //terraforming task, only used if a big man johnson is near the scout - case terraform: + case TASK_TERRAFORM: scoutingRange = 60; minDistanceToHive = 20; + break; } } super.carryOutTask(); } + @Override public boolean useExtendedTargeting() { return false; } - ///RAMPANT MODE STUFFS + ///RAMPANT MODE STUFFS /** Finds the direction from the bug's location to the target and adds it to their current coord * Used as a performant way to make scouts expand toward the player's spawn point diff --git a/src/main/java/com/hbm/inventory/OreDictManager.java b/src/main/java/com/hbm/inventory/OreDictManager.java index a25849cd1..348f1704c 100644 --- a/src/main/java/com/hbm/inventory/OreDictManager.java +++ b/src/main/java/com/hbm/inventory/OreDictManager.java @@ -302,7 +302,6 @@ public class OreDictManager { /** Any special post-RBMK gating material, namely bismuth and arsenic */ public static final DictFrame ANY_BISMOID = new DictFrame("AnyBismoid"); public static final DictFrame ANY_ASH = new DictFrame("Ash"); - /** Any, nevermind, this should be self-explanatory**/ public static void registerOres() { diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index 4c83847b2..5cc0ee007 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -328,12 +328,12 @@ public class Fluids { HEAVYWATER_HOT = new FluidType("HEAVYWATER_HOT", 0x4D007B, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID); SODIUM = new FluidType("SODIUM", 0xCCD4D5, 1, 2, 3, EnumSymbol.NONE).setTemp(400).addTraits(LIQUID); SODIUM_HOT = new FluidType("SODIUM_HOT", 0xE2ADC1, 1, 2, 3, EnumSymbol.NONE).setTemp(1200).addTraits(LIQUID); - PHEROMONE = new FluidType("PHEROMONE", 0x5FA6E8, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(1)); - PHEROMONE_M = new FluidType("PHEROMONE_M", 0x48C9B0 , 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(2)); THORIUM_SALT = new FluidType("THORIUM_SALT", 0x7A5542, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, new FT_Corrosive(65)); THORIUM_SALT_HOT = new FluidType("THORIUM_SALT_HOT", 0x3E3627, 2, 0, 3, EnumSymbol.NONE).setTemp(1600).addTraits(LIQUID, new FT_Corrosive(65)); THORIUM_SALT_DEPLETED = new FluidType("THORIUM_SALT_DEPLETED", 0x302D1C, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, new FT_Corrosive(65)); FULLERENE = new FluidType(132, "FULLERENE", 0xFF7FED, 3, 3, 3, EnumSymbol.NONE).addTraits(LIQUID, new FT_Corrosive(65)); + PHEROMONE = new FluidType("PHEROMONE", 0x5FA6E8, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(1)); + PHEROMONE_M = new FluidType("PHEROMONE_M", 0x48C9B0 , 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(2)); // ^ ^ ^ ^ ^ ^ ^ ^ //ADD NEW FLUIDS HERE diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index ad1a4a00b..3d82a99ed 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -522,7 +522,7 @@ public class ClientProxy extends ServerProxy { MinecraftForgeClient.registerItemRenderer(ModItems.gun_quadro, new ItemRenderWeaponQuadro()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_sauer, new ItemRenderWeaponSauer()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_vortex, new ItemRenderWeaponVortex()); - MinecraftForgeClient.registerItemRenderer(ModItems.gun_thompson, new ItemRenderWeaponThompson());; + MinecraftForgeClient.registerItemRenderer(ModItems.gun_thompson, new ItemRenderWeaponThompson()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolter, new ItemRenderWeaponBolter()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_bolter_digamma, new ItemRenderWeaponBolter()); MinecraftForgeClient.registerItemRenderer(ModItems.gun_fireext, new ItemRenderFireExt()); diff --git a/src/main/java/com/hbm/world/feature/GlyphidHive.java b/src/main/java/com/hbm/world/feature/GlyphidHive.java index f7c83e76f..f0ddf5c41 100644 --- a/src/main/java/com/hbm/world/feature/GlyphidHive.java +++ b/src/main/java/com/hbm/world/feature/GlyphidHive.java @@ -4,8 +4,6 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; -import net.minecraft.block.Block; -import com.hbm.util.LootGenerator; import net.minecraft.init.Blocks; import net.minecraft.world.World; diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 44f03fd5b..720fc1d5f 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -2390,6 +2390,8 @@ item.dieselsuit_helmet.name=Diesel-Powered Head-Mounted Environmental Sensor item.dieselsuit_legs.name=Diesel-Powered Leg Servos item.dieselsuit_plate.name=Diesel-Powered Cybernetics item.digamma_diagnostic.name=Digamma Diagnostic +item.disperser_canister.name= Disperser Canister: +item.disperser_canister_empty.name= Disperser Canister item.dns_boots.name=DNT Nano Suit Boots item.dns_legs.name=DNT Nano Suit Leggings item.dns_helmet.name=DNT Nano Suit Helmet @@ -2616,13 +2618,8 @@ item.grenade_smart.name=Smart Grenade item.grenade_strong.name=Enhanced Grenade item.grenade_tau.name=Tau Grenade item.grenade_zomg.name=Negative Energy Pair Annihilation Grenade - -item.disperser_canister.name= Disperser Canister: -item.disperser_canister_empty.name= Disperser Canister - item.glyphid_gland.name= Gland item.glyphid_gland_empty.name= Glyphid's Fluid Gland - item.gun_ar15.name=Josh item.gun_avenger.name=CZ57 Avenger Minigun item.gun_b92.name=§9B92 Energy Pistol§r @@ -4887,9 +4884,7 @@ tile.door_office.name=Office Door tile.ducrete.name=Ducrete Tile tile.ducrete_stairs.name=Ducrete Tile Stairs tile.ducrete_smooth.name=Ducrete - tile.ducrete_smooth_stairs.name=Ducrete Stairs - tile.dummy_block.name=Dummy Block tile.dummy_port.name=Dummy Block (Electricity Port) tile.dungeon_chain.name=Metal Chain From 31c55c7cfa350d9023b9228c7b197caec7d6df69 Mon Sep 17 00:00:00 2001 From: Boblet Date: Wed, 13 Dec 2023 15:12:28 +0100 Subject: [PATCH 06/10] now i know how megan feels --- .../com/hbm/entity/logic/EntityWaypoint.java | 195 +++++++++--------- .../com/hbm/entity/mob/EntityGlyphid.java | 104 +++++----- .../hbm/entity/mob/EntityGlyphidNuclear.java | 8 +- .../hbm/entity/mob/EntityGlyphidScout.java | 12 +- 4 files changed, 150 insertions(+), 169 deletions(-) diff --git a/src/main/java/com/hbm/entity/logic/EntityWaypoint.java b/src/main/java/com/hbm/entity/logic/EntityWaypoint.java index 87ca34199..33712524e 100644 --- a/src/main/java/com/hbm/entity/logic/EntityWaypoint.java +++ b/src/main/java/com/hbm/entity/logic/EntityWaypoint.java @@ -2,6 +2,7 @@ package com.hbm.entity.logic; import com.hbm.config.MobConfig; import com.hbm.entity.mob.EntityGlyphid; +import static com.hbm.entity.mob.EntityGlyphid.*; import com.hbm.entity.mob.EntityGlyphidNuclear; import com.hbm.entity.mob.EntityGlyphidScout; import com.hbm.main.MainRegistry; @@ -9,131 +10,125 @@ 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 EntityWaypoint(World world) { + super(world); + this.isImmuneToFire = true; + this.noClip = true; + } - } - 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); - } + @Override + protected void entityInit() { + this.dataWatcher.addObject(10, 0); + // this.dataWatcher.addObject(11, 0); - 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()){ + public int maxAge = 2400; + public int radius = 3; + public boolean highPriority = false; + protected EntityWaypoint additional; - case 1: return 0x5FA6E8; + public void setHighPriority() { + highPriority = true; + } - case 2: - case 3: - return 0x127766; + public int getWaypointType() { + return this.dataWatcher.getWatchableObjectInt(10); + } - default: return 0x566573; - } - } - AxisAlignedBB bb; - @Override - public void onEntityUpdate() { - if (ticksExisted >= maxAge) { - this.setDead(); - } + public void setAdditionalWaypoint(EntityWaypoint waypoint) { + additional = waypoint; + } - bb = AxisAlignedBB.getBoundingBox( - this.posX - radius, - this.posY - radius, - this.posZ - radius, - this.posX + radius, - this.posY + radius, - this.posZ + radius); + public void setWaypointType(int waypointType) { + this.dataWatcher.updateObject(10, waypointType); + } - if (!worldObj.isRemote) { + boolean hasSpawned = false; - if (ticksExisted % 40 == 0) { + public int getColor() { + switch(getWaypointType()) { - List targets = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); + case TASK_RETREAT_FOR_REINFORCEMENTS: return 0x5FA6E8; + case TASK_BUILD_HIVE: + case TASK_INITIATE_RETREAT: return 0x127766; + default: return 0x566573; + } + } - for (Entity e : targets) { - if (e instanceof EntityGlyphid) { + AxisAlignedBB bb; - EntityGlyphid bug = ((EntityGlyphid) e); + @Override + public void onEntityUpdate() { + if(ticksExisted >= maxAge) { + this.setDead(); + } - if (additional != null && !hasSpawned) { - worldObj.spawnEntityInWorld(additional); - hasSpawned = true; - } + bb = AxisAlignedBB.getBoundingBox(this.posX, this.posY, this.posZ, this.posX, this.posY, this.posZ).expand(radius, radius, radius); - boolean exceptions = bug.getWaypoint() != this - || e instanceof EntityGlyphidScout - || e instanceof EntityGlyphidNuclear; + if(!worldObj.isRemote) { - if(!exceptions) - bug.setCurrentTask(getWaypointType(), additional); + if(ticksExisted % 40 == 0) { - if (getWaypointType() == 2) { - if (e instanceof EntityGlyphidScout) - setDead(); - } else { - setDead(); - } + List targets = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); - } - } - } - } else if(MobConfig.waypointDebug) { + for(Entity e : targets) { + if(e instanceof EntityGlyphid) { - 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); + EntityGlyphid bug = ((EntityGlyphid) e); - 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); - } + 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); - @Override - protected void readEntityFromNBT(NBTTagCompound nbt) { - this.setWaypointType(nbt.getInteger("type")); - } + if(getWaypointType() == TASK_BUILD_HIVE) { + if(e instanceof EntityGlyphidScout) + setDead(); + } else { + setDead(); + } - @Override - protected void writeEntityToNBT(NBTTagCompound nbt) { - nbt.setInteger("type", getWaypointType()); - } + } + } + } + } 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/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 11b26b439..08a067063 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -55,7 +55,7 @@ public class EntityGlyphid extends EntityMob { public int taskZ; //used for digging, bigger glyphids have a longer reach - public int blastSize = Math.min((int) (3 * (getScale()))/2, 5); + public int blastSize = Math.min((int) (3 * (getScale())) / 2, 5); public int blastResToDig = Math.min((int) (50 * (getScale() * 2)), 150); public boolean shouldDig; @@ -73,10 +73,12 @@ public class EntityGlyphid extends EntityMob { public static final int TASK_FOLLOW = 4; /** Causes nuclear glyphids to immediately self-destruct, also signaling nearby scouts to retreat */ public static final int TASK_TERRAFORM = 5; - /** Id any task other than IDLE is interrupted by an obstacle, initiates digging behavior which is also communicated to nearby glyohids */ + /** If any task other than IDLE is interrupted by an obstacle, initiates digging behavior which is also communicated to nearby glyohids */ public static final int TASK_DIG = 6; - EntityWaypoint taskWaypoint = null; + protected boolean hasWaypoint = false; + /** Yeah, fuck, whatever, anything goes now */ + protected EntityWaypoint taskWaypoint = null; public EntityGlyphid(World world) { super(world); @@ -125,7 +127,7 @@ public class EntityGlyphid extends EntityMob { if(getCurrentTask() == TASK_FOLLOW){ //incase the waypoint somehow doesn't exist and it got this task anyway - if(isAtDestination() && taskX == TASK_IDLE) { + if(isAtDestination() && !hasWaypoint) { setCurrentTask(TASK_IDLE, null); } //the task cannot be 6 outside of rampant, so this is a non issue p much @@ -201,7 +203,7 @@ public class EntityGlyphid extends EntityMob { } - if (taskX != TASK_IDLE) { + if(hasWaypoint) { if(MobConfig.rampantDig) { MovingObjectPosition obstacle = findWaypointObstruction(); @@ -292,8 +294,6 @@ public class EntityGlyphid extends EntityMob { } 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; @@ -423,8 +423,9 @@ public class EntityGlyphid extends EntityMob { * @param waypoint The waypoint for the task, can be null */ public void setCurrentTask(int task, @Nullable EntityWaypoint waypoint){ - currentTask = task; - taskWaypoint = waypoint; + this.currentTask = task; + this.taskWaypoint = waypoint; + this.hasWaypoint = waypoint != null; if (taskWaypoint != null) { taskX = (int) taskWaypoint.posX; @@ -448,50 +449,44 @@ public class EntityGlyphid extends EntityMob { switch(task){ - //call for reinforcements - case TASK_RETREAT_FOR_REINFORCEMENTS: if(taskWaypoint != null){ + case TASK_RETREAT_FOR_REINFORCEMENTS: + if(taskWaypoint != null) { communicate(TASK_FOLLOW, taskWaypoint); setCurrentTask(TASK_FOLLOW, taskWaypoint); - } break; - - //expand the hive, used by the scout - //case 2: expandHive(null); - - //retreat - case TASK_INITIATE_RETREAT: - - 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(TASK_RETREAT_FOR_REINFORCEMENTS); - home.setAdditionalWaypoint(additional); - home.setHighPriority(); - home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); - worldObj.spawnEntityInWorld(home); - - this.taskWaypoint = home; - communicate(TASK_FOLLOW, home); - setCurrentTask(TASK_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 + case TASK_INITIATE_RETREAT: + + 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(TASK_RETREAT_FOR_REINFORCEMENTS); + home.setAdditionalWaypoint(additional); + home.setHighPriority(); + home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); + worldObj.spawnEntityInWorld(home); + + this.taskWaypoint = home; + communicate(TASK_FOLLOW, home); + setCurrentTask(TASK_FOLLOW, taskWaypoint); - //dig - case TASK_DIG: - shouldDig = true; break; + } - default: break; + break; + + case TASK_DIG: + shouldDig = true; + break; + + default: + break; } @@ -500,19 +495,12 @@ public class EntityGlyphid extends EntityMob { /** Copies tasks and waypoint to nearby glyphids. Does not work on glyphid scouts */ public void communicate(int task, @Nullable EntityWaypoint waypoint) { int radius = waypoint != null ? waypoint.radius : 4; - - AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( - this.posX - radius, - this.posY - radius, - this.posZ - radius, - this.posX + radius, - this.posY + radius, - this.posZ + radius); + AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(this.posX, this.posY, this.posZ, this.posX, this.posY, this.posZ).expand(radius, radius, radius); List bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); - for (Entity e: bugs){ - if(e instanceof EntityGlyphid && !(e instanceof EntityGlyphidScout)){ - if(((EntityGlyphid) e).getCurrentTask() != task){ + for(Entity e : bugs) { + if(e instanceof EntityGlyphid && !(e instanceof EntityGlyphidScout)) { + if(((EntityGlyphid) e).getCurrentTask() != task) { ((EntityGlyphid) e).setCurrentTask(task, waypoint); } } @@ -580,6 +568,7 @@ public class EntityGlyphid extends EntityMob { nbt.setInteger("homeY", homeY); nbt.setInteger("homeZ", homeZ); + nbt.setBoolean("hasWaypoint", hasWaypoint); nbt.setInteger("taskX", taskX); nbt.setInteger("taskY", taskY); nbt.setInteger("taskZ", taskZ); @@ -597,6 +586,7 @@ public class EntityGlyphid extends EntityMob { this.homeY = nbt.getInteger("homeY"); this.homeZ = nbt.getInteger("homeZ"); + this.hasWaypoint = nbt.getBoolean("hasWaypoint"); this.taskX = nbt.getInteger("taskX"); this.taskY = nbt.getInteger("taskY"); this.taskZ = nbt.getInteger("taskZ"); diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java index d98a13edd..e68c5311f 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java @@ -135,13 +135,7 @@ public class EntityGlyphidNuclear extends EntityGlyphid { 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); + AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(this.posX, this.posY, this.posZ, this.posX, this.posY, this.posZ).expand(radius, radius, radius); List bugs = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb); for (Entity e: bugs){ diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java index 1ceaf824c..bd09849ec 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java @@ -74,9 +74,7 @@ public class EntityGlyphidScout extends EntityGlyphid { if(MobConfig.rampantGlyphidGuidance && PollutionHandler.targetCoords != null){ if(!hasTarget) { - Vec3 dirVec = playerBaseDirFinder( - Vec3.createVectorHelper(posX, posY, posZ), - PollutionHandler.targetCoords); + Vec3 dirVec = playerBaseDirFinder(Vec3.createVectorHelper(posX, posY, posZ), getPlayerTargetDirection()); EntityWaypoint target = new EntityWaypoint(worldObj); target.setLocationAndAngles(dirVec.xCoord, dirVec.yCoord, dirVec.zCoord, 0, 0); @@ -157,7 +155,7 @@ public class EntityGlyphidScout extends EntityGlyphid { } } } - + /** Returns true if the position is far enough away from other hives. Also resets the task if unsuccessful. */ public boolean canBuildHiveHere() { int length = useLargeHive ? 16 : 8; @@ -308,5 +306,9 @@ public class EntityGlyphidScout extends EntityGlyphid { currentLocation.zCoord + dirVec.zCoord * 10 ); } - + + //TODO: replace that with some actual directions + protected Vec3 getPlayerTargetDirection() { + return PollutionHandler.targetCoords; + } } From debfa0f3ee18cd4e0939d604d18c6da72d9c4930 Mon Sep 17 00:00:00 2001 From: Boblet Date: Thu, 14 Dec 2023 16:36:10 +0100 Subject: [PATCH 07/10] better spawner behavior, digger glyphid --- .../blocks/generic/BlockGlyphidSpawner.java | 102 +++++++++--------- src/main/java/com/hbm/config/MobConfig.java | 10 +- .../java/com/hbm/entity/EntityMappings.java | 1 + .../com/hbm/entity/mob/EntityGlyphid.java | 17 ++- .../hbm/entity/mob/EntityGlyphidDigger.java | 41 +++++++ .../java/com/hbm/inventory/fluid/Fluids.java | 4 +- .../java/com/hbm/main/ResourceManager.java | 1 + .../hbm/textures/entity/glyphid_digger.png | Bin 0 -> 2239 bytes 8 files changed, 114 insertions(+), 62 deletions(-) create mode 100644 src/main/java/com/hbm/entity/mob/EntityGlyphidDigger.java create mode 100644 src/main/resources/assets/hbm/textures/entity/glyphid_digger.png diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java index f2acc1999..0150ad3d5 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java @@ -4,23 +4,14 @@ import java.util.*; import java.util.function.Function; import com.hbm.config.MobConfig; -import com.hbm.entity.mob.EntityGlyphid; -import com.hbm.entity.mob.EntityGlyphidBehemoth; -import com.hbm.entity.mob.EntityGlyphidBlaster; -import com.hbm.entity.mob.EntityGlyphidBombardier; -import com.hbm.entity.mob.EntityGlyphidBrawler; -import com.hbm.entity.mob.EntityGlyphidBrenda; -import com.hbm.entity.mob.EntityGlyphidNuclear; -import com.hbm.entity.mob.EntityGlyphidScout; +import com.hbm.entity.mob.*; 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; @@ -30,25 +21,27 @@ import net.minecraft.world.World; public class BlockGlyphidSpawner extends BlockContainer { - public BlockGlyphidSpawner(Material p_i45386_1_) { - super(p_i45386_1_); + public BlockGlyphidSpawner(Material mat) { + super(mat); } @Override 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)); + 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<>(EntityGlyphidDigger::new, MobConfig.diggerChance)); + 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 @@ -67,47 +60,51 @@ public class BlockGlyphidSpawner extends BlockContainer { @Override public void updateEntity() { - 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; - } + if(initialSpawn || worldObj.getTotalWorldTime() % MobConfig.swarmCooldown == 0) { + int count = 0; - for (Object e : worldObj.loadedEntityList) { - if (e instanceof EntityGlyphid) { + for(Object e : worldObj.loadedEntityList) { + if(e instanceof EntityGlyphid) { count++; - if (count >= MobConfig.spawnMax) return; + //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); + List list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 9, yCoord + 1, zCoord - 9, xCoord + 10, yCoord + 8, zCoord + 10)); + float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT); - if (list.size() <= 3) { + 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()); + for(EntityGlyphid glyphid : currentSwarm) { + trySpawnEntity(glyphid); } - 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); + if(!initialSpawn && worldObj.rand.nextInt(MobConfig.scoutSwarmSpawnChance + 1) == 0 && soot >= MobConfig.scoutThreshold) { + trySpawnEntity(new EntityGlyphidScout(worldObj)); } initialSpawn = false; - } - + } + } + } + + public void trySpawnEntity(EntityGlyphid glyphid) { + double offsetX = glyphid.getRNG().nextGaussian() * 3; + double offsetZ = glyphid.getRNG().nextGaussian() * 3; + + for(int i = 0; i < 7; i++) { + glyphid.setLocationAndAngles(xCoord + 0.5 + offsetX, yCoord - 2 + i, zCoord + 0.5 + offsetZ, worldObj.rand.nextFloat() * 360.0F, 0.0F); + if(glyphid.getCanSpawnHere()) { + worldObj.spawnEntityInWorld(glyphid); + return; } } } @@ -115,21 +112,18 @@ public class BlockGlyphidSpawner extends BlockContainer { public ArrayList createSwarm(float soot) { Random rand = new Random(); - ArrayList currentSpawns = new ArrayList<>(); - 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)); - } - } + // (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; } diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index 19d515b5a..2cf744595 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -36,7 +36,7 @@ public class MobConfig { public static int largeHiveChance = 5; public static int largeHiveThreshold = 30; - public static int swarmCooldown = 120; + public static int swarmCooldown = 120 * 20; public static int baseSwarmSize = 5; public static double swarmScalingMult = 1.2; @@ -46,6 +46,7 @@ public class MobConfig { public static int[] brawlerChance = {5, 35}; public static int[] bombardierChance = {20, -15}; public static int[] blasterChance = {-15, 40}; + public static int[] diggerChance = {-15, 25}; public static int[] behemothChance = {-30, 45}; public static int[] brendaChance = {-50, 60}; public static int[] johnsonChance = {-50, 60}; @@ -136,9 +137,10 @@ public class MobConfig { 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}); + diggerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC05_diggerChance", "Base Spawn chance and soot modifier for a glyphid digger", new int[]{-15, 25}); + behemothChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC06_behemothChance", "Base Spawn chance and soot modifier for a glyphid behemoth", new int[]{-30, 45}); + brendaChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC07_brendaChance", "Base Spawn chance and soot modifier for a glyphid brenda", new int[]{-50, 60}); + johnsonChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC08_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" diff --git a/src/main/java/com/hbm/entity/EntityMappings.java b/src/main/java/com/hbm/entity/EntityMappings.java index 4c33cab1f..c40457abc 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -265,6 +265,7 @@ public class EntityMappings { addMob(EntityGlyphidBlaster.class, "entity_glyphid_blaster", 0xD83737, 0xDBB79D); addMob(EntityGlyphidScout.class, "entity_glyphid_scout", 0x273038, 0xB9E36B); addMob(EntityGlyphidNuclear.class, "entity_glyphid_nuclear", 0x267F00, 0xA0A0A0); + addMob(EntityGlyphidDigger.class, "entity_glyphid_digger", 0x273038, 0x724A21); addMob(EntityPlasticBag.class, "entity_plastic_bag", 0xd0d0d0, 0x808080); addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 08a067063..f6c0ae768 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -32,7 +32,7 @@ import net.minecraft.util.*; import net.minecraft.potion.Potion; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; - +import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import javax.annotation.Nullable; @@ -79,6 +79,9 @@ public class EntityGlyphid extends EntityMob { protected boolean hasWaypoint = false; /** Yeah, fuck, whatever, anything goes now */ protected EntityWaypoint taskWaypoint = null; + + public static final int TYPE_NORMAL = 0; + public static final int TYPE_INFECTED = 1; public EntityGlyphid(World world) { super(world); @@ -98,6 +101,7 @@ public class EntityGlyphid extends EntityMob { super.entityInit(); this.dataWatcher.addObject(16, new Byte((byte) 0)); //wall climbing this.dataWatcher.addObject(17, new Byte((byte) 0b11111)); //armor + this.dataWatcher.addObject(18, new Byte((byte) 0)); //subtype (i.e. normal, infected, etc) } @Override @@ -204,7 +208,8 @@ public class EntityGlyphid extends EntityMob { } if(hasWaypoint) { - if(MobConfig.rampantDig) { + + if(canDig()) { MovingObjectPosition obstacle = findWaypointObstruction(); if (getScale() >= 1 && getCurrentTask() != TASK_DIG && obstacle != null) { @@ -229,6 +234,9 @@ public class EntityGlyphid extends EntityMob { } } + protected boolean canDig() { + return MobConfig.rampantDig; + } public void onBlinded(){ this.entityToAttack = null; @@ -593,4 +601,9 @@ public class EntityGlyphid extends EntityMob { this.currentTask = nbt.getInteger("task"); } + + @Override + public boolean getCanSpawnHere() { + return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + } } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidDigger.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidDigger.java new file mode 100644 index 000000000..09801fe4b --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidDigger.java @@ -0,0 +1,41 @@ +package com.hbm.entity.mob; + +import com.hbm.main.ResourceManager; + +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +public class EntityGlyphidDigger extends EntityGlyphid { + + public EntityGlyphidDigger(World world) { + super(world); + } + + public ResourceLocation getSkin() { + return ResourceManager.glyphid_digger_tex; + } + + @Override + public double getScale() { + return 1.25D; + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(35D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D); + } + + @Override + public boolean isArmorBroken(float amount) { + return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.25, 2), 100); + } + + @Override + protected boolean canDig() { + return true; + } +} diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index 5cc0ee007..b2efa5781 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -331,9 +331,9 @@ public class Fluids { THORIUM_SALT = new FluidType("THORIUM_SALT", 0x7A5542, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, new FT_Corrosive(65)); THORIUM_SALT_HOT = new FluidType("THORIUM_SALT_HOT", 0x3E3627, 2, 0, 3, EnumSymbol.NONE).setTemp(1600).addTraits(LIQUID, new FT_Corrosive(65)); THORIUM_SALT_DEPLETED = new FluidType("THORIUM_SALT_DEPLETED", 0x302D1C, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, new FT_Corrosive(65)); - FULLERENE = new FluidType(132, "FULLERENE", 0xFF7FED, 3, 3, 3, EnumSymbol.NONE).addTraits(LIQUID, new FT_Corrosive(65)); + FULLERENE = new FluidType("FULLERENE", 0xFF7FED, 3, 3, 3, EnumSymbol.NONE).addTraits(LIQUID, new FT_Corrosive(65)); PHEROMONE = new FluidType("PHEROMONE", 0x5FA6E8, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(1)); - PHEROMONE_M = new FluidType("PHEROMONE_M", 0x48C9B0 , 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(2)); + PHEROMONE_M = new FluidType(132, "PHEROMONE_M", 0x48C9B0 , 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(2)); // ^ ^ ^ ^ ^ ^ ^ ^ //ADD NEW FLUIDS HERE diff --git a/src/main/java/com/hbm/main/ResourceManager.java b/src/main/java/com/hbm/main/ResourceManager.java index 9816aee87..0d1a613df 100644 --- a/src/main/java/com/hbm/main/ResourceManager.java +++ b/src/main/java/com/hbm/main/ResourceManager.java @@ -750,6 +750,7 @@ public class ResourceManager { public static final ResourceLocation glyphid_blaster_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_blaster.png"); public static final ResourceLocation glyphid_scout_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_scout.png"); public static final ResourceLocation glyphid_nuclear_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_nuclear.png"); + public static final ResourceLocation glyphid_digger_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_digger.png"); //ZIRNOX public static final ResourceLocation zirnox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox.png"); diff --git a/src/main/resources/assets/hbm/textures/entity/glyphid_digger.png b/src/main/resources/assets/hbm/textures/entity/glyphid_digger.png new file mode 100644 index 0000000000000000000000000000000000000000..524358e730f743d404a26a3f5d5cdea813d3f2eb GIT binary patch literal 2239 zcmV;w2tfCVP)ud-d908fE_Qx_&H}igI*V(mw9~epdq^GA( z-^`ntC$}Jgz5Y%;I4EKLMh5F^t5A%_R{Nu8?^^wb+qHD2Q2+c|yk@VzQx~H# z6vGM*%L;yf^GWP$ufJ0R02HG!tgo$FZTMR;8pES!?^@dVbpOHb>)@CvmO>|JJ6< zgh)yp9(VK1=}+pv7*=MB*dM%)QUbnUNm1A~I4F(sD4b^*jm>$nN(?H{OWx$IH6_p7 zWAc)y0%NhYk(+%S4~}hXBR4Mx+qGxl+gJn%nOb7Bc^=A-LkL~(J4W;KDMlhvdKgZO_M3K&)R%T&yw*~nIU&&>g{}`ClUOs= z^fcv3*J+blDtRR&B0(pL$n(xMflEWWNQVp*o@?)N+@%}V|q&BT? z8C6V}rQ$-62FmvV6%v~s`7Z%#)oOzH9zeeZ?@8Lj;rs-hCJS`p+yxamBFoY z)I@buffA?!0nS1Xryww+b^zU6k-!&kOOc%F`>`Pp)rZHp1vpiv9yMVNZ5kgve{!#u$~xN2*MGQOOD0YG z?C0CosvX6w6zDTyY(xKr@gEYEt#n{qegyz9O2al(r!O9~0%>1;O+t(*i(d!KSb;pi z2LLCeL45i9bE~)YYYhOF`Ep-}YW!>ePj4`75r}bKH_zbH{=a6cfje+X1@ybT^|e*! zt0$UCOshZy9gk!o)Kocnk}3OO5h#)2n{`vp*Oo1(RVXSDk@9Vh6#G%~LjDhc5xCjA zZVx+jU`I)2Q-CyLlM2~IJ=F`GasJr<$C zG*u{m5Q(3W;JJAG=-E5t^YEk1{lR<74@!Y^w$h3E$kSvZbYK9sU*YS+n2F$d6!e;6 zSi#GWKUDH06X8x9R}BGVQ|1Lze*E&|537HiX=5raF)(qUMhG34RNCj@Nj(ihLn@R4 z){p|V?CI>DNy|RTX!|k?ZFWn^M3y_XLmbU70U)}B6!V#e6^0EfsJ_bzoE6$JvlXIA zE-WcfQ=;~84|ZR-XgQ0PzBpmD{C0Y;pR7P%I5H0f;w(+GA-d1MzF!Ch^52lKc`49` zxhpWV2H~z9=-=^4Gu!Rn-Fj9&Py+XhQvAomm{}s&AqKuQX9Tdz;dm_NjW=)IskJIE z4`V`!yM|EUe4dEXH_a8PN@CUzuvEmWz?jHWvu&b4fb{=wnSL(o&(1ye47MJkbVl zSL`W?0Ja(=@}zSy$fhQ&g**JET@>;FCIm_g%M=<>05ivX*b zaB_U)T^FV1nyqx4Sysw*`HRuM1dx8e2)S{R3FE9veIh4QXnrq@voG8vv7#K%L*|L1aSQycj{8e!Oj1oOa#+l3BYyqQeaCJ z$t%npzF6?GA?TBM8H$3(Y?q}(m4fIsKVD?u{_e7tt3rq(P@5z!V(K+(1PSz2oG0au~({T#e8q1<~um2rUh}st78OD$e&+!c`?P%7nF?RXe^)_z!yO4x9^J_?G|x N002ovPDHLkV1i_!I~@Q3 literal 0 HcmV?d00001 From 95520daebc5f9500f59ae4a554a0fde26430fe3a Mon Sep 17 00:00:00 2001 From: Boblet Date: Fri, 15 Dec 2023 14:25:44 +0100 Subject: [PATCH 08/10] moldy glyphids --- .../com/hbm/blocks/generic/BlockGlyphid.java | 21 ++++++++---- .../blocks/generic/BlockGlyphidSpawner.java | 30 +++++++++++++--- .../com/hbm/entity/mob/EntityGlyphid.java | 32 +++++++++++------- .../hbm/render/entity/mob/RenderGlyphid.java | 30 +++++++++++++++- .../com/hbm/world/feature/GlyphidHive.java | 5 +-- src/main/resources/assets/hbm/lang/de_DE.lang | 3 +- src/main/resources/assets/hbm/lang/en_US.lang | 1 + .../hbm/textures/blocks/glyphid_base_2.png | Bin 560 -> 0 bytes .../textures/blocks/glyphid_base_infested.png | Bin 0 -> 594 bytes .../blocks/glyphid_base_infested_alt.png | Bin 0 -> 585 bytes .../blocks/glyphid_eggs_base_infested.png | Bin 0 -> 423 bytes .../textures/blocks/glyphid_eggs_infested.png | Bin 0 -> 747 bytes .../textures/entity/glyphid_infestation.png | Bin 0 -> 1288 bytes 13 files changed, 96 insertions(+), 26 deletions(-) delete mode 100644 src/main/resources/assets/hbm/textures/blocks/glyphid_base_2.png create mode 100644 src/main/resources/assets/hbm/textures/blocks/glyphid_base_infested.png create mode 100644 src/main/resources/assets/hbm/textures/blocks/glyphid_base_infested_alt.png create mode 100644 src/main/resources/assets/hbm/textures/blocks/glyphid_eggs_base_infested.png create mode 100644 src/main/resources/assets/hbm/textures/blocks/glyphid_eggs_infested.png create mode 100644 src/main/resources/assets/hbm/textures/entity/glyphid_infestation.png diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java index 267624e28..be1613d3a 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java @@ -11,8 +11,9 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; public class BlockGlyphid extends Block { - - public IIcon[] icons = new IIcon[2]; + + public IIcon[] iconsStandard = new IIcon[2]; + public IIcon[] iconsInfested = new IIcon[2]; public BlockGlyphid(Material mat) { super(mat); @@ -24,20 +25,28 @@ public class BlockGlyphid extends Block { long l = (long) (x * 3129871) ^ (long)y * 116129781L ^ (long)z; l = l * l * 42317861L + l * 11L; int i = (int)(l >> 16 & 3L); - return icons[(int)(Math.abs(i) % this.icons.length)]; + IIcon[] icons = this.getIconArray(world.getBlockMetadata(x, y, z)); + return icons[(int)(Math.abs(i) % icons.length)]; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { - return icons[meta % this.icons.length]; + IIcon[] icons = this.getIconArray(meta); + return icons[meta % icons.length]; } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister reg) { - icons[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_base"); - icons[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_alt"); + iconsStandard[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_base"); + iconsStandard[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_alt"); + iconsInfested[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_infested"); + iconsInfested[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_base_infested_alt"); } + protected IIcon[] getIconArray(int meta) { + if(meta == 1) return this.iconsInfested; + return this.iconsStandard; + } } diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java index 0150ad3d5..a212e980b 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java @@ -8,18 +8,25 @@ import com.hbm.entity.mob.*; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.items.ModItems; - +import com.hbm.lib.RefStrings; import com.hbm.util.Tuple.Pair; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; public class BlockGlyphidSpawner extends BlockContainer { + + public IIcon[] icons = new IIcon[2]; public BlockGlyphidSpawner(Material mat) { super(mat); @@ -30,6 +37,19 @@ public class BlockGlyphidSpawner extends BlockContainer { return ModItems.egg_glyphid; } + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return icons[meta % icons.length]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister reg) { + icons[0] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_alt"); + icons[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_infested"); + } + private static final ArrayList, int[]>> spawnMap = new ArrayList<>(); static { @@ -80,7 +100,7 @@ public class BlockGlyphidSpawner extends BlockContainer { if(list.size() <= 3) { - ArrayList currentSwarm = createSwarm(soot); + ArrayList currentSwarm = createSwarm(soot, this.getBlockMetadata()); for(EntityGlyphid glyphid : currentSwarm) { trySpawnEntity(glyphid); @@ -109,7 +129,7 @@ public class BlockGlyphidSpawner extends BlockContainer { } } - public ArrayList createSwarm(float soot) { + public ArrayList createSwarm(float soot, int meta) { Random rand = new Random(); ArrayList currentSpawns = new ArrayList<>(); @@ -121,7 +141,9 @@ public class BlockGlyphidSpawner extends BlockContainer { 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)); + EntityGlyphid entity = glyphid.getKey().apply(worldObj); + if(meta == 1) entity.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_INFECTED); + currentSpawns.add(entity); } } } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index f6c0ae768..a4dc08af5 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -80,8 +80,14 @@ public class EntityGlyphid extends EntityMob { /** Yeah, fuck, whatever, anything goes now */ protected EntityWaypoint taskWaypoint = null; + //subtypes public static final int TYPE_NORMAL = 0; public static final int TYPE_INFECTED = 1; + + //data watcher keys + public static final int DW_WALL = 16; + public static final int DW_ARMOR = 17; + public static final int DW_SUBTYPE = 18; public EntityGlyphid(World world) { super(world); @@ -99,9 +105,9 @@ public class EntityGlyphid extends EntityMob { @Override protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(16, new Byte((byte) 0)); //wall climbing - this.dataWatcher.addObject(17, new Byte((byte) 0b11111)); //armor - this.dataWatcher.addObject(18, new Byte((byte) 0)); //subtype (i.e. normal, infected, etc) + this.dataWatcher.addObject(DW_WALL, new Byte((byte) 0)); //wall climbing + this.dataWatcher.addObject(DW_ARMOR, new Byte((byte) 0b11111)); //armor + this.dataWatcher.addObject(DW_SUBTYPE, new Byte((byte) 0)); //subtype (i.e. normal, infected, etc) } @Override @@ -282,7 +288,7 @@ public class EntityGlyphid extends EntityMob { 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); + byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR); if(armor != 0) { //if at least one bit of armor is present @@ -322,7 +328,7 @@ public class EntityGlyphid extends EntityMob { public float calculateDamage(float amount) { - byte armor = this.dataWatcher.getWatchableObjectByte(17); + byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR); int divisor = 1; for(int i = 0; i < 5; i++) { @@ -341,7 +347,7 @@ public class EntityGlyphid extends EntityMob { } public void breakOffArmor() { - byte armor = this.dataWatcher.getWatchableObjectByte(17); + byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR); List indices = Arrays.asList(0, 1, 2, 3, 4); Collections.shuffle(indices); @@ -350,7 +356,7 @@ public class EntityGlyphid extends EntityMob { if((armor & bit) > 0) { armor &= ~bit; armor = (byte) (armor & 0b11111); - this.dataWatcher.updateObject(17, armor); + this.dataWatcher.updateObject(DW_ARMOR, armor); worldObj.playSoundAtEntity(this, "mob.zombie.woodbreak", 1.0F, 1.25F); break; } @@ -388,11 +394,11 @@ public class EntityGlyphid extends EntityMob { } public boolean isBesideClimbableBlock() { - return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + return (this.dataWatcher.getWatchableObjectByte(DW_WALL) & 1) != 0; } public void setBesideClimbableBlock(boolean climbable) { - byte watchable = this.dataWatcher.getWatchableObjectByte(16); + byte watchable = this.dataWatcher.getWatchableObjectByte(DW_WALL); if(climbable) { watchable = (byte) (watchable | 1); @@ -400,7 +406,7 @@ public class EntityGlyphid extends EntityMob { watchable &= -2; } - this.dataWatcher.updateObject(16, Byte.valueOf(watchable)); + this.dataWatcher.updateObject(DW_WALL, Byte.valueOf(watchable)); } @Override @@ -569,7 +575,8 @@ public class EntityGlyphid extends EntityMob { @Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); - nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(17)); + nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(DW_ARMOR)); + nbt.setByte("subtype", this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE)); nbt.setBoolean("hasHome", hasHome); nbt.setInteger("homeX", homeX); @@ -587,7 +594,8 @@ public class EntityGlyphid extends EntityMob { @Override public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); - this.dataWatcher.updateObject(17, nbt.getByte("armor")); + this.dataWatcher.updateObject(DW_ARMOR, nbt.getByte("armor")); + this.dataWatcher.updateObject(DW_SUBTYPE, nbt.getByte("subtype")); this.hasHome = nbt.getBoolean("hasHome"); this.homeX = nbt.getInteger("homeX"); diff --git a/src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java b/src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java index 49b0ea4f8..6ad109605 100644 --- a/src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java +++ b/src/main/java/com/hbm/render/entity/mob/RenderGlyphid.java @@ -3,6 +3,7 @@ package com.hbm.render.entity.mob; import org.lwjgl.opengl.GL11; import com.hbm.entity.mob.EntityGlyphid; +import com.hbm.lib.RefStrings; import com.hbm.main.ResourceManager; import net.minecraft.client.model.ModelBase; @@ -13,10 +14,13 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; public class RenderGlyphid extends RenderLiving { + + public static final ResourceLocation glyphid_infested_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_infestation.png"); public RenderGlyphid() { super(new ModelGlyphid(), 1.0F); this.shadowOpaque = 0.0F; + this.setRenderPassModel(this.mainModel); } @Override @@ -24,6 +28,21 @@ public class RenderGlyphid extends RenderLiving { EntityGlyphid glyphid = (EntityGlyphid) entity; return glyphid.getSkin(); } + + @Override + protected int shouldRenderPass(EntityLivingBase entity, int pass, float interp) { + if(pass != 0) { + return -1; + } else { + if(entity.getDataWatcher().getWatchableObjectByte(EntityGlyphid.DW_SUBTYPE) == EntityGlyphid.TYPE_INFECTED) { + this.bindTexture(glyphid_infested_tex); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + return 1; + } + return -1; + } + } public static class ModelGlyphid extends ModelBase { @@ -43,11 +62,20 @@ public class RenderGlyphid extends RenderLiving { GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); + this.renderModel(entity, limbSwing); + + GL11.glPopMatrix(); + } + + public void renderModel(Entity entity, float limbSwing) { + + GL11.glPushMatrix(); + double s = ((EntityGlyphid) entity).getScale(); GL11.glScaled(s, s, s); EntityLivingBase living = (EntityLivingBase) entity; - byte armor = living.getDataWatcher().getWatchableObjectByte(17); + byte armor = living.getDataWatcher().getWatchableObjectByte(EntityGlyphid.DW_ARMOR); double walkCycle = limbSwing; diff --git a/src/main/java/com/hbm/world/feature/GlyphidHive.java b/src/main/java/com/hbm/world/feature/GlyphidHive.java index f0ddf5c41..a5e8df06b 100644 --- a/src/main/java/com/hbm/world/feature/GlyphidHive.java +++ b/src/main/java/com/hbm/world/feature/GlyphidHive.java @@ -105,6 +105,7 @@ public class GlyphidHive { public static void generateBigGround(World world, int x, int y, int z, Random rand, boolean openDesign) { int orientation = rand.nextInt(2) + 2; + int overrideMeta = 0; for(int i = 0; i < 11; i++) { for(int j = 0; j < 7; j++) { @@ -115,7 +116,7 @@ public class GlyphidHive { 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); + world.setBlock(x + i - 5, y + j - 2, z + k - 5, ModBlocks.glyphid_base, overrideMeta, 2); } else if (block != 0) { world.setBlock(x + i - 5, y + j - 2, z + k - 5, Blocks.air); } @@ -123,7 +124,7 @@ public class GlyphidHive { } } - world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner); + world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner, overrideMeta, 2); } diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 34cd14145..9a561713c 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -508,7 +508,7 @@ death.attack.tauBlast=%1$s lud die XVL1456 zu lange auf und wurde in Stücke ger death.attack.teleporter=%1$s wurde ins Nichts teleportiert. desc.item.rtgHeat=Hitzelevel: %s -desc.gui.rtgBFurnace.desc=Bönitigt mindestens 15 Hitze um zu starten$Je mehr Hitze, desto schneller der Vorgang$Hitze über dem maximalen Level hat keinen Effekt$Gold-198 kann zu Quecksilber zerfallen +desc.gui.rtgBFurnace.desc=Benötigt mindestens 15 Hitze um zu starten$Je mehr Hitze, desto schneller der Vorgang$Hitze über dem maximalen Level hat keinen Effekt$Gold-198 kann zu Quecksilber zerfallen desc.gui.rtgBFurnace.heat=§eHitzelevel: %s desc.gui.rtgBFurnace.pellets=Akzeptierte Pellets: desc.gui.rtgBFurnace.pellet=%s (%s Hitze) @@ -527,6 +527,7 @@ entity.entity_glyphid_blaster.name=Glyphid-Blaster entity.entity_glyphid_bombardier.name=Glyphid-Bombardierer entity.entity_glyphid_brawler.name=Glyphid-Schläger entity.entity_glyphid_brenda.name=Brenda +entity.entity_glyphid_digger.name=Glyphid-Gräber entity.entity_glyphid_nuclear.name=Der dicke Johnson entity.entity_glyphid_scout.name=Glyphid-Späher entity.entity_ntm_fbi.name=FBI Agent diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 720fc1d5f..78f5468b6 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -1036,6 +1036,7 @@ entity.entity_glyphid_blaster.name=Glyphid Blaster entity.entity_glyphid_bombardier.name=Glyphid Bombardier entity.entity_glyphid_brawler.name=Glyphid Brawler entity.entity_glyphid_brenda.name=Brenda +entity.entity_glyphid_digger.name=Glyphid Digger entity.entity_glyphid_nuclear.name=Big Man Johnson entity.entity_glyphid_scout.name=Glyphid Scout entity.entity_ntm_fbi.name=FBI Agent diff --git a/src/main/resources/assets/hbm/textures/blocks/glyphid_base_2.png b/src/main/resources/assets/hbm/textures/blocks/glyphid_base_2.png deleted file mode 100644 index 541a53c5f56156aede4138dd7d332424794fa7f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 560 zcmV-00?+-4P)r7UJMf+)l?Omx>Fj}sc&pbu~ZZtET9o(Dj%OG}a{B-o{F_bJPVN3=m71wfF9 zr>%E5W(RcF!QQ6?yHxJkT@!%0=aI)rNsz}0K@`eEmSIXIA3iRyUp8{z9*)okeeyUd z6$|h>4gkCNkf3Omd12o*FrlN1$mtC`(?v1JJ8lU z(p*I=VWcqdk?N1lhEw(j!|VdkHg%eR zPc)j%8d!H7TJJiX@`A>7B~Z@&di5-A=&o}E7V{89A&T8KrKh>)v8`r*3bGB+f*=)O y%P>*w;fNp#v4?&0H|_-NP5U^fhrd)gBjO% zSBSWa4`7?vXt$17tv3wPKFiXe+Ym_)fKg|Hl9g$oWQE)oE-BKPo8;Z-J@?+D`yYEb zBJQGOMO|xrTU`A3Z4gdE6bnSq1DQh%!|a?P=d9KnEZ}s0gGhQbY_T{A$=|*?Ag!)7 zN><#@9$Bq7v|C3gS#kaSi<{QBsCKvKJBDGfUu`#yJ=?rS?B#p*{8PulAniNJBAq#+ z$H|48H1={c!KgFgXZaP8>_|!tNs-O~7^HmwrsXY>&KRc`d(2^G$O+}8Ls7CikoMQZ zAC|$)HMEVwFu-4}Hz-*#%+B|##5kFj!3=`Ev~{hCbY|}B%*Z&M-!PrS`0UcTkk}yG zT?r5EZtq@+O=XBHGesMeFi}1^ccNp(rh*liU(<*Ry$;~)-;|=0><~#^44)N zNc%5}tsmsJz!yo+$oKS*QD?$3m>KUUILlfUY*R($B=%!3M?MwAUQUg6&(>M-^ld#D)dD1aHAx^a*$z zq%OMej!0BdA+1`K3NwmEIK;7mRw|1yL#)nb{NYnV1j(0HfY!0t-N1>V=0X1E`*VyI7{?m$RMNuMC#rgc2 zRlcU>HIb>}!}ODx*3w;d$8Cr|)_VZL=%b zQ7`7p)eVTMNE$HdZ|t0&p5Z$llkvfS3R)bkx)y2M+RKX@mSt`LHIVB%SgU-EOcjG+ zx58E1v@G+AwM9|lJDz#3zutd-IGxRzeZHhox3G6CT3!=-$0GajlizoLh{6uGZJSNK zy}hID``ETkUEBwUTGflIZ{$TzJMaN`(tb?2`c)||ijt%sC64>nh^z_VV zk@VvS#d;r7wZIZ0Fq}rct=%7E+|Vv)P>C`YTT$2{RSTl9v)R0VzpYMA)xyN}*%tCI X^w1Mf)T-^U00000NkvXXu0mjfDq9bo literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/blocks/glyphid_eggs_base_infested.png b/src/main/resources/assets/hbm/textures/blocks/glyphid_eggs_base_infested.png new file mode 100644 index 0000000000000000000000000000000000000000..c4308d58a14300f969bc074dfb12c568671243c7 GIT binary patch literal 423 zcmV;Y0a*TtP)8EYWp^-wKff^wIU+i_l>F|BJ&*nY$0Wx z-QBsai&6^iPAP@^z7Y}jeV_A}Qr;d!0;~ID4BVYaDVpLw@GTw#oaZ^sNh!@ATWeg` z#dl2;*92m=TI+27&fd&;yN*_xU36xTJMB}&2l{9`1g|QRv&R>QO4LbT7 Rdbj`p002ovPDHLkV1gZMxCa0L literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/blocks/glyphid_eggs_infested.png b/src/main/resources/assets/hbm/textures/blocks/glyphid_eggs_infested.png new file mode 100644 index 0000000000000000000000000000000000000000..93786bc31f6bba1b63eed61356441c1e1be0926a GIT binary patch literal 747 zcmVF|9LGQI&Wtn5ya~2~R4T0Ku!oQeHicG++9+6v^yVc9 z>J(n=kc63p7w1q!2fav#x|m*;{^)ImAf+NyB!Uppw2j>j-;VC6)pS_rMZeRJ-}}Ay z`||mHU(Lw%y8*kAano2aLB8PP`xT}K5&*P6x(vWd-er0qfs_&e$8m^c+%(Cah42mX z1s8yQ^+(uyaZ1(w=s2cnsb0r%0MO*-5CBq2vfYy;dn)X!KY~|UQ}va+i)mWwF~@Pp zxM=_)p;XWFkWyCj(i*jUGypu$V|pNg?^p2s3JZ^uv_HCx+#KRZ=^-^E*Y5^G2-@y7 z1CZ^WRMLwRDWsH2ZkV_BFA^)S^Lns}2teDtW(-}!&^3}h3oMQ{{dZXi0YF1TLzRbL zVP>`pQVS0Y>rb%bb(p55CUy>YVCWiSU9S*AkbZC$fUz!=BF$)dNw&L8vZn&2HSBmD zdoND0INF4vYpmp5TKg?>y^R1wb&J;iMSQ=4X<9@=snY`q?06l2mOd+ZA^rKc%K&We z{8DR;0H$FOZ%nJA20ZzIvu8|{6bF{hviA;=7#=jge^e0f^S z@8#ocZEevx+`*U0uN-JzL(_D8zru+#->MM9si7;Qx<$U=lDJj zcHT;eJ|Ix8y(+q&*sNFEKD-2@;UtJ{r5D)RGC6iL zqUvdwXrL6mA0mWM_HMcm5nAnj&}#RMHNl(kiii>|F!f4l*B&urDcge^v1bE02%Rsc zAq<4rYWD;A+OlKCoDUoUh^mU=oqS;f?ADhTuj%z;)BW9s(}Y6dr{e;xh|yD6K#gmJS;|W^1uuIr( z$`BFQoAZ=)Ifg-R9K<$%C)Xz;+}}L~(lH^Q<3;YQYFm6bPb*wJ4;jZ)YE>H*ho)I7 zEW88k+D;LIh=doZTm})RT4mmJvtET<-!%2)2DQeMMzC2h)j-zZQ>fq^%Aqgr)uL6c z`Bn7*%7CY0Y?J&5EtKkv?|2tpR9RiIK~%NAkr~Et;tsf}u9QqP=#2y2Vn&&r3#kGm zBB%p$DL~a^q-cBL3lkAW!%6V?@RD1piJ!%(qPtq6#!Hn+UNLvazNuq0eUMyNEThtr zSxit9W!F4EaN3pjqB#P@X1xmIl{!^x zGwr1^>$Ir6oW-yW&!TD@$%owq1; zKj%|QU01046t0rG6l)v2fxV{fv}>lTvL>o45IIybx$YEEJL-*F*lN8eBL$;en24-9 z>Q5?kkuWYM40_{$g=Y{1NB4J6!ROaIM#D+j-KF*7i0dQ`4GqR<#do=R%?qfq}}nkHh_U`mYoK0000 Date: Sat, 16 Dec 2023 18:24:43 +0100 Subject: [PATCH 09/10] fancier glyphid hives, maggots --- src/main/java/com/hbm/blocks/ModBlocks.java | 4 +- .../com/hbm/blocks/generic/BlockGlyphid.java | 21 ++- .../blocks/generic/BlockGlyphidSpawner.java | 30 +++- .../com/hbm/blocks/generic/BlockLoot.java | 8 - src/main/java/com/hbm/config/MobConfig.java | 46 +++--- .../java/com/hbm/entity/EntityMappings.java | 1 + .../com/hbm/entity/mob/EntityGlyphid.java | 41 ++++- .../hbm/entity/mob/EntityGlyphidBehemoth.java | 2 +- .../hbm/entity/mob/EntityGlyphidBlaster.java | 2 +- .../entity/mob/EntityGlyphidBombardier.java | 4 +- .../hbm/entity/mob/EntityGlyphidScout.java | 53 +++---- .../hbm/entity/mob/EntityParasiteMaggot.java | 49 ++++++ .../entity/projectile/EntityBulletBaseNT.java | 4 +- .../com/hbm/items/weapon/ItemDisperser.java | 84 +++++----- src/main/java/com/hbm/lib/HbmWorldGen.java | 8 +- src/main/java/com/hbm/main/ClientProxy.java | 1 + .../hbm/render/entity/mob/RenderMaggot.java | 28 ++++ .../com/hbm/render/tileentity/RenderLoot.java | 21 ++- .../com/hbm/render/util/RenderInfoSystem.java | 4 +- src/main/java/com/hbm/util/LootGenerator.java | 43 ++++++ .../com/hbm/world/feature/GlyphidHive.java | 143 ++++++++---------- .../hbm/textures/entity/parasite_maggot.png | Bin 0 -> 441 bytes .../items/disperser_canister_overlay.png | Bin 202 -> 154 bytes 23 files changed, 383 insertions(+), 214 deletions(-) create mode 100644 src/main/java/com/hbm/entity/mob/EntityParasiteMaggot.java create mode 100644 src/main/java/com/hbm/render/entity/mob/RenderMaggot.java create mode 100644 src/main/resources/assets/hbm/textures/entity/parasite_maggot.png diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 7196b59c5..91476fd94 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -2935,8 +2935,8 @@ public class ModBlocks { GameRegistry.registerBlock(mush, mush.getUnlocalizedName()); GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName()); GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName()); - GameRegistry.registerBlock(glyphid_base, glyphid_base.getUnlocalizedName()); - GameRegistry.registerBlock(glyphid_spawner, glyphid_spawner.getUnlocalizedName()); + register(glyphid_base); + register(glyphid_spawner); GameRegistry.registerBlock(moon_turf, moon_turf.getUnlocalizedName()); //Waste diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java index be1613d3a..240356149 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java @@ -1,22 +1,30 @@ package com.hbm.blocks.generic; +import java.util.List; + +import com.hbm.blocks.IBlockMulti; import com.hbm.lib.RefStrings; +import com.hbm.main.MainRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -public class BlockGlyphid extends Block { +public class BlockGlyphid extends Block implements IBlockMulti { public IIcon[] iconsStandard = new IIcon[2]; public IIcon[] iconsInfested = new IIcon[2]; public BlockGlyphid(Material mat) { super(mat); + this.setCreativeTab(MainRegistry.blockTab); } @Override @@ -49,4 +57,15 @@ public class BlockGlyphid extends Block { if(meta == 1) return this.iconsInfested; return this.iconsStandard; } + + @Override + public int getSubCount() { + return 2; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + for(int i = 0; i < getSubCount(); ++i) list.add(new ItemStack(item, 1, i)); + } } diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java index a212e980b..d9ff39bc7 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java @@ -3,12 +3,14 @@ package com.hbm.blocks.generic; import java.util.*; import java.util.function.Function; +import com.hbm.blocks.IBlockMulti; import com.hbm.config.MobConfig; import com.hbm.entity.mob.*; import com.hbm.handler.pollution.PollutionHandler; import com.hbm.handler.pollution.PollutionHandler.PollutionType; import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; +import com.hbm.main.MainRegistry; import com.hbm.util.Tuple.Pair; import cpw.mods.fml.relauncher.Side; @@ -16,7 +18,9 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; @@ -24,12 +28,13 @@ import net.minecraft.util.IIcon; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; -public class BlockGlyphidSpawner extends BlockContainer { +public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti { public IIcon[] icons = new IIcon[2]; public BlockGlyphidSpawner(Material mat) { super(mat); + this.setCreativeTab(MainRegistry.blockTab); } @Override @@ -50,6 +55,17 @@ public class BlockGlyphidSpawner extends BlockContainer { icons[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_infested"); } + @Override + public int getSubCount() { + return 2; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + for(int i = 0; i < getSubCount(); ++i) list.add(new ItemStack(item, 1, i)); + } + private static final ArrayList, int[]>> spawnMap = new ArrayList<>(); static { @@ -90,8 +106,7 @@ public class BlockGlyphidSpawner extends BlockContainer { for(Object e : worldObj.loadedEntityList) { if(e instanceof EntityGlyphid) { count++; - //if(count >= MobConfig.spawnMax) - // return; + if(count >= MobConfig.spawnMax) return; } } @@ -134,18 +149,21 @@ public class BlockGlyphidSpawner extends BlockContainer { Random rand = new Random(); ArrayList currentSpawns = new ArrayList<>(); int swarmAmount = (int) Math.min(MobConfig.baseSwarmSize * Math.max(MobConfig.swarmScalingMult * (soot / MobConfig.sootStep), 1), 10); - - while(currentSpawns.size() <= swarmAmount) { + int cap = 100; + + while(currentSpawns.size() <= swarmAmount && cap >= 0) { // (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) { + if(soot >= chance[2] && rand.nextInt(100) <= adjustedChance) { EntityGlyphid entity = glyphid.getKey().apply(worldObj); if(meta == 1) entity.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_INFECTED); currentSpawns.add(entity); } } + + cap--; } return currentSpawns; } diff --git a/src/main/java/com/hbm/blocks/generic/BlockLoot.java b/src/main/java/com/hbm/blocks/generic/BlockLoot.java index db0a966f7..cf949e161 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockLoot.java +++ b/src/main/java/com/hbm/blocks/generic/BlockLoot.java @@ -51,14 +51,6 @@ public class BlockLoot extends BlockContainer { @Override public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); - - /*TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); - - if(loot != null && loot.items.isEmpty()) { - loot.addItem(new ItemStack(ModItems.gun_lever_action), 0, 0, 0); - }*/ - - //LootGenerator.lootCapStash(world, x, y, z); } @Override diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index 2cf744595..14f219193 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -42,14 +42,14 @@ public class MobConfig { 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[] diggerChance = {-15, 25}; - public static int[] behemothChance = {-30, 45}; - public static int[] brendaChance = {-50, 60}; - public static int[] johnsonChance = {-50, 60}; + public static int[] glyphidChance = {50, -40, 0}; + public static int[] brawlerChance = {5, 35, 1}; + public static int[] bombardierChance = {20, -15, 1}; + public static int[] blasterChance = {-15, 40, 5}; + public static int[] diggerChance = {-15, 25, 5}; + public static int[] behemothChance = {-30, 45, 10}; + public static int[] brendaChance = {-50, 60, 20}; + public static int[] johnsonChance = {-50, 60, 50}; public static double spawnMax = 50; public static boolean enableInfestation = true; @@ -116,15 +116,11 @@ public class MobConfig { 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 first number is the base chance which applies at 0 soot,\n" + + "the second number is the modifier that applies with soot based on the formular below,\n" + + "the third number is a hard minimum of soot for this type to spawn.\n" + + "Negative base chances mean that glyphids won't spawn outright, negative modifiers mean that the type becomes less likely with higher soot.\n" + + "The formula for glyphid spawning chance is: (base chance + (modifier - modifier / max( (soot + 1)/3, 3 )))\n" + "The formula for glyphid swarm scaling is: (baseSwarmSize * Math.max(swarmScalingMult * soot/sootStep, 1))"); @@ -133,14 +129,14 @@ public class MobConfig { 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}); - diggerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC05_diggerChance", "Base Spawn chance and soot modifier for a glyphid digger", new int[]{-15, 25}); - behemothChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC06_behemothChance", "Base Spawn chance and soot modifier for a glyphid behemoth", new int[]{-30, 45}); - brendaChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC07_brendaChance", "Base Spawn chance and soot modifier for a glyphid brenda", new int[]{-50, 60}); - johnsonChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC08_johnsonChance", "Base Spawn chance and soot modifier for Big Man Johnson", new int[]{-50, 60}); + glyphidChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC01_glyphidChance", "Base Spawn chance and soot modifier for a glyphid grunt", new int[]{50, -45, 0}); + brawlerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC02_brawlerChance", "Base Spawn chance and soot modifier for a glyphid brawler", new int[]{10, 30, 1}); + bombardierChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC03_bombardierChance", "Base Spawn chance and soot modifier for a glyphid bombardier", new int[]{20, -15, 1}); + blasterChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC04_blasterChance", "Base Spawn chance and soot modifier for a glyphid blaster", new int[]{-5, 40, 5}); + diggerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC05_diggerChance", "Base Spawn chance and soot modifier for a glyphid digger", new int[]{-15, 25, 5}); + behemothChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC06_behemothChance", "Base Spawn chance and soot modifier for a glyphid behemoth", new int[]{-30, 45, 10}); + brendaChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC07_brendaChance", "Base Spawn chance and soot modifier for a glyphid brenda", new int[]{-50, 60, 20}); + johnsonChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC08_johnsonChance", "Base Spawn chance and soot modifier for Big Man Johnson", new int[]{-50, 60, 50}); String rampantDesc = "Rampant Mode changes glyphid behavior and spawning to be more aggressive, changes include:\n" + "\n" diff --git a/src/main/java/com/hbm/entity/EntityMappings.java b/src/main/java/com/hbm/entity/EntityMappings.java index c40457abc..6884483a8 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -267,6 +267,7 @@ public class EntityMappings { addMob(EntityGlyphidNuclear.class, "entity_glyphid_nuclear", 0x267F00, 0xA0A0A0); addMob(EntityGlyphidDigger.class, "entity_glyphid_digger", 0x273038, 0x724A21); addMob(EntityPlasticBag.class, "entity_plastic_bag", 0xd0d0d0, 0x808080); + addMob(EntityParasiteMaggot.class, "entity_parasite_maggot", 0xd0d0d0, 0x808080); addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index a4dc08af5..86d783cd6 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -174,8 +174,8 @@ public class EntityGlyphid extends EntityMob { protected Entity findPlayerToAttack() { if(this.isPotionActive(Potion.blindness)) return null; - EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, useExtendedTargeting() && getCurrentTask() != 0 ? 128D : 16D); - return entityplayer != null && (MobConfig.rampantExtendedTargetting || canEntityBeSeen(entityplayer)) ? entityplayer : null; + EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, useExtendedTargeting() ? 128D : 16D); + return entityplayer; } @Override @@ -193,7 +193,7 @@ public class EntityGlyphid extends EntityMob { if (!this.hasPath()) { // hell yeah!! - if (useExtendedTargeting() && this.entityToAttack != null) { + if(useExtendedTargeting() && this.entityToAttack != null) { this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, true, true)); } else if (getCurrentTask() != TASK_IDLE) { @@ -281,11 +281,15 @@ public class EntityGlyphid extends EntityMob { @Override protected boolean canDespawn() { - return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == TASK_IDLE; + return entityToAttack == null && getCurrentTask() == TASK_IDLE && this.ticksExisted > 100; } @Override public boolean attackEntityFrom(DamageSource source, float amount) { + + if(source.getEntity() instanceof EntityGlyphid) { + return false; + } if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote && !source.isFireDamage() && !source.getDamageType().equals(ModDamageSource.s_cryolator)) { byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR); @@ -318,8 +322,29 @@ public class EntityGlyphid extends EntityMob { if(this.isPotionActive(HbmPotion.phosphorus.getId())){ amount *= 1.5F; } + + boolean alive = this.getHealth() > 0; + boolean wasAttacked = super.attackEntityFrom(source, amount); + + if(alive && this.getHealth() <= 0) { + if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) { - return super.attackEntityFrom(source, amount); + int j = 2 + this.rand.nextInt(3); + + for(int k = 0; k < j; ++k) { + float f = ((float) (k % 2) - 0.5F) * 0.5F; + float f1 = ((float) (k / 2) - 0.5F) * 0.5F; + EntityParasiteMaggot maggot = new EntityParasiteMaggot(worldObj); + maggot.setLocationAndAngles(this.posX + (double) f, this.posY + 0.5D, this.posZ + (double) f1, this.rand.nextFloat() * 360.0F, 0.0F); + maggot.motionX = f; + maggot.motionZ = f1; + maggot.velocityChanged = true; + this.worldObj.spawnEntityInWorld(maggot); + } + } + } + + return wasAttacked; } public boolean isArmorBroken(float amount) { @@ -437,16 +462,16 @@ public class EntityGlyphid extends EntityMob { * @param waypoint The waypoint for the task, can be null */ public void setCurrentTask(int task, @Nullable EntityWaypoint waypoint){ - this.currentTask = task; + this.currentTask = task; this.taskWaypoint = waypoint; this.hasWaypoint = waypoint != null; - if (taskWaypoint != null) { + if(taskWaypoint != null) { taskX = (int) taskWaypoint.posX; taskY = (int) taskWaypoint.posY; taskZ = (int) taskWaypoint.posZ; - if (taskWaypoint.highPriority) { + if(taskWaypoint.highPriority) { this.entityToAttack = null; this.setPathToEntity(null); } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java index fbc138cde..27f2595d9 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBehemoth.java @@ -85,7 +85,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid { public void acidAttack(){ - if (!worldObj.isRemote && entityToAttack instanceof EntityLivingBase) { + if(!worldObj.isRemote && entityToAttack instanceof EntityLivingBase && this.getDistanceToEntity(entityToAttack) < 20) { this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 20, 6)); EntityChemical chem = new EntityChemical(worldObj, this); diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java index 4c2e649a8..ef2ccde88 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBlaster.java @@ -65,7 +65,7 @@ public class EntityGlyphidBlaster extends EntityGlyphidBombardier { @Override public int getBombCount() { - return 20; + return 10; } @Override diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java index 3b385e363..7fda8206d 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBombardier.java @@ -44,7 +44,7 @@ public class EntityGlyphidBombardier extends EntityGlyphid { this.lastZ = e.posZ; } - if(this.ticksExisted % 20 == 1) { + if(this.ticksExisted % 60 == 1) { boolean topAttack = rand.nextBoolean(); @@ -95,7 +95,7 @@ public class EntityGlyphidBombardier extends EntityGlyphid { } public int getBombCount() { - return 10; + return 5; } public float getSpreadMult() { diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java index bd09849ec..7e0378bbd 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java @@ -12,6 +12,7 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.*; @@ -119,38 +120,35 @@ public class EntityGlyphidScout extends EntityGlyphid { timer++; if (!worldObj.isRemote && canBuildHiveHere()) { - if(timer == 1) { + if(timer == 1) { - EntityWaypoint additional = new EntityWaypoint(worldObj); - additional.setLocationAndAngles(posX, posY, posZ, 0, 0); - additional.setWaypointType(TASK_IDLE); + EntityWaypoint additional = new EntityWaypoint(worldObj); + additional.setLocationAndAngles(posX, posY, posZ, 0, 0); + additional.setWaypointType(TASK_IDLE); - //First, go home and get reinforcements - EntityWaypoint home = new EntityWaypoint(worldObj); - home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS); - home.setAdditionalWaypoint(additional); - home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); - home.maxAge = 1200; - home.radius = 6; + // First, go home and get reinforcements + EntityWaypoint home = new EntityWaypoint(worldObj); + home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS); + home.setAdditionalWaypoint(additional); + home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0); + home.maxAge = 1200; + home.radius = 6; - worldObj.spawnEntityInWorld(home); + worldObj.spawnEntityInWorld(home); - this.taskWaypoint = home; - this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10)); - communicate(TASK_RETREAT_FOR_REINFORCEMENTS, taskWaypoint); + this.taskWaypoint = home; + this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10)); + communicate(TASK_RETREAT_FOR_REINFORCEMENTS, taskWaypoint); - } else if (timer >= 5) { + } 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(); + worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false); + GlyphidHive.generateSmall(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rand, this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) != TYPE_NORMAL, false); + this.setDead(); - } else { - communicate(TASK_FOLLOW, taskWaypoint); - } + } else { + communicate(TASK_FOLLOW, taskWaypoint); + } } } } @@ -307,8 +305,11 @@ public class EntityGlyphidScout extends EntityGlyphid { ); } - //TODO: replace that with some actual directions protected Vec3 getPlayerTargetDirection() { + EntityPlayer player = worldObj.getClosestPlayerToEntity(this, 300); + if(player != null) { + return Vec3.createVectorHelper(player.posX, player.posY, player.posZ); + } return PollutionHandler.targetCoords; } } diff --git a/src/main/java/com/hbm/entity/mob/EntityParasiteMaggot.java b/src/main/java/com/hbm/entity/mob/EntityParasiteMaggot.java new file mode 100644 index 000000000..40cc3b003 --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/EntityParasiteMaggot.java @@ -0,0 +1,49 @@ +package com.hbm.entity.mob; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.world.World; + +public class EntityParasiteMaggot extends EntityMob { + + public EntityParasiteMaggot(World world) { + super(world); + this.setSize(0.3F, 0.7F); + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D); + } + + @Override + protected boolean canTriggerWalking() { + return false; + } + + @Override + protected Entity findPlayerToAttack() { + return this.worldObj.getClosestVulnerablePlayerToEntity(this, 16); + } + + @Override + public void onUpdate() { + this.renderYawOffset = this.rotationYaw; + super.onUpdate(); + } + + @Override + protected boolean isValidLightLevel() { + return true; + } + + @Override + public EnumCreatureAttribute getCreatureAttribute() { + return EnumCreatureAttribute.ARTHROPOD; + } +} diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java index d8ee0f4f3..bfaaf8b31 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java @@ -378,8 +378,8 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block)); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, living.posX, living.posY + living.height - head, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50)); worldObj.playSoundEffect(victim.posX, victim.posY, victim.posZ, "mob.zombie.woodbreak", 1.0F, 0.95F + rand.nextFloat() * 0.2F); - } - } + } + } } } diff --git a/src/main/java/com/hbm/items/weapon/ItemDisperser.java b/src/main/java/com/hbm/items/weapon/ItemDisperser.java index 9971ee3e7..682ff3eec 100644 --- a/src/main/java/com/hbm/items/weapon/ItemDisperser.java +++ b/src/main/java/com/hbm/items/weapon/ItemDisperser.java @@ -18,59 +18,57 @@ import net.minecraft.world.World; import java.util.List; public class ItemDisperser extends ItemFluidTank { - @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if (!player.capabilities.isCreativeMode) { - --stack.stackSize; - } + if(!player.capabilities.isCreativeMode) { + --stack.stackSize; + } - world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); - if (!world.isRemote) { + if(!world.isRemote) { - EntityDisperserCanister canister = new EntityDisperserCanister(world, player); + EntityDisperserCanister canister = new EntityDisperserCanister(world, player); + canister.setType(Item.getIdFromItem(this)); + canister.setFluid(stack.getItemDamage()); + world.spawnEntityInWorld(canister); + } + return stack; + } - canister.setType(Item.getIdFromItem(this)); - canister.setFluid(stack.getItemDamage()); - world.spawnEntityInWorld(canister); + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List list) { - } + FluidType[] order = Fluids.getInNiceOrder(); - return stack; - } - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tabs, List list) { + 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)); + } - 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(); - @Override - public String getItemStackDisplayName(ItemStack stack) { + s = this == ModItems.glyphid_gland ? s1 + " " + s : s + " " + s1; + return s; + } - 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"); - } + @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 ea38eed02..d4bb78bc6 100644 --- a/src/main/java/com/hbm/lib/HbmWorldGen.java +++ b/src/main/java/com/hbm/lib/HbmWorldGen.java @@ -229,7 +229,13 @@ 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.generateBigGround(world, x, y, z, rand, false); + + for(int k = 3; k >= -1; k--) { + if(world.getBlock(x, y - 1 + k, z).isNormalCube()) { + GlyphidHive.generateSmall(world, x, y + k, z, rand, rand.nextInt(10) == 0, true); + break; + } + } } if(biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) { diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 3d82a99ed..dcb6e842c 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -764,6 +764,7 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBlaster.class, new RenderGlyphid()); RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidScout.class, new RenderGlyphid()); RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidNuclear.class, new RenderGlyphidNuclear()); + RenderingRegistry.registerEntityRenderingHandler(EntityParasiteMaggot.class, new RenderMaggot()); RenderingRegistry.registerEntityRenderingHandler(EntityFBIDrone.class, new RenderDrone()); RenderingRegistry.registerEntityRenderingHandler(EntityPlasticBag.class, new RenderPlasticBag()); RenderingRegistry.registerEntityRenderingHandler(EntityPigeon.class, new RenderPigeon(new ModelPigeon(), 0.3F)); diff --git a/src/main/java/com/hbm/render/entity/mob/RenderMaggot.java b/src/main/java/com/hbm/render/entity/mob/RenderMaggot.java new file mode 100644 index 000000000..6fa0184cc --- /dev/null +++ b/src/main/java/com/hbm/render/entity/mob/RenderMaggot.java @@ -0,0 +1,28 @@ +package com.hbm.render.entity.mob; + +import com.hbm.lib.RefStrings; + +import net.minecraft.client.model.ModelSilverfish; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.ResourceLocation; + +public class RenderMaggot extends RenderLiving { + + public static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "textures/entity/parasite_maggot.png"); + + public RenderMaggot() { + super(new ModelSilverfish(), 0.3F); + } + + @Override + protected float getDeathMaxRotation(EntityLivingBase entity) { + return 180.0F; + } + + @Override + protected ResourceLocation getEntityTexture(Entity entity) { + return texture; + } +} diff --git a/src/main/java/com/hbm/render/tileentity/RenderLoot.java b/src/main/java/com/hbm/render/tileentity/RenderLoot.java index 1813bb7d7..125ebb617 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderLoot.java +++ b/src/main/java/com/hbm/render/tileentity/RenderLoot.java @@ -1,6 +1,7 @@ package com.hbm.render.tileentity; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; import com.hbm.blocks.generic.BlockLoot.TileEntityLoot; import com.hbm.items.ModItems; @@ -82,16 +83,20 @@ public class RenderLoot extends TileEntitySpecialRenderer { protected ModelLeverAction shotgun; private void renderShotgun() { - - if(shotgun == null) - shotgun = new ModelLeverAction(); - GL11.glScaled(0.25, 0.25, 0.25); - GL11.glTranslated(3, 0.0625, 2); - GL11.glRotated(-25, 0, 1, 0); + GL11.glScaled(0.5, 0.5, 0.5); + GL11.glTranslated(1, 0, 0); + GL11.glRotated(25, 0, 1, 0); GL11.glRotated(90, 1, 0, 0); - bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelLeverAction.png")); - shotgun.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F); + GL11.glRotated(90, 0, 1, 0); + + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + bindTexture(ResourceManager.ff_wood); + ResourceManager.ff_maresleg.renderPart("Grip"); + bindTexture(ResourceManager.ff_gun_bright); + ResourceManager.ff_maresleg.renderPart("Gun"); + ResourceManager.ff_maresleg.renderPart("Lever"); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); } private void renderStandardItem(ItemStack stack) { diff --git a/src/main/java/com/hbm/render/util/RenderInfoSystem.java b/src/main/java/com/hbm/render/util/RenderInfoSystem.java index da618d194..94f7760d2 100644 --- a/src/main/java/com/hbm/render/util/RenderInfoSystem.java +++ b/src/main/java/com/hbm/render/util/RenderInfoSystem.java @@ -44,7 +44,7 @@ public class RenderInfoSystem { } } - @SubscribeEvent + @SubscribeEvent(receiveCanceled = true) public void onOverlayRender(RenderGameOverlayEvent.Pre event) { if(event.type != ElementType.CROSSHAIRS) @@ -80,7 +80,7 @@ public class RenderInfoSystem { int side = pX + 5 + longest; int height = messages.size() * 10 + pZ + 2; int z = 0; - + GL11.glDisable(GL11.GL_TEXTURE_2D); Tessellator tess = Tessellator.instance; tess.startDrawingQuads(); diff --git a/src/main/java/com/hbm/util/LootGenerator.java b/src/main/java/com/hbm/util/LootGenerator.java index 69b0af7f5..537796427 100644 --- a/src/main/java/com/hbm/util/LootGenerator.java +++ b/src/main/java/com/hbm/util/LootGenerator.java @@ -8,6 +8,7 @@ import com.hbm.items.ModItems; import com.hbm.items.special.ItemBookLore; import com.hbm.items.ItemAmmoEnums.AmmoFatman; +import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -140,4 +141,46 @@ public class LootGenerator { } } } + + public static void lootBones(World world, int x, int y, int z) { + + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); + + if(loot != null && loot.items.isEmpty()) { + + int limit = world.rand.nextInt(3) + 3; + for(int i = 0; i < limit; i++) { + addItemWithDeviation(loot, world.rand, new ItemStack(Items.bone), world.rand.nextDouble() - 0.5, i * 0.03125, world.rand.nextDouble() - 0.5); + } + } + } + + public static void lootGlyphidHive(World world, int x, int y, int z) { + + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); + + if(loot != null && loot.items.isEmpty()) { + + int limit = world.rand.nextInt(3) + 3; + for(int i = 0; i < limit; i++) { + + ItemStack stack = new ItemStack(ModItems.ammo_12gauge, 4); + + switch(world.rand.nextInt(11)) { + case 0: stack = new ItemStack(ModItems.steel_plate); break; + case 1: stack = new ItemStack(ModItems.gun_lever_action); break; + case 2: stack = new ItemStack(ModItems.grenade_if_generic); break; + case 3: + case 4: stack = new ItemStack(ModItems.bottle_nuka, 1 + world.rand.nextInt(2)); break; + case 5: + case 6: stack = new ItemStack(ModItems.ingot_steel, 3 + world.rand.nextInt(10)); break; + case 7: stack = new ItemStack(ModItems.steel_pickaxe); break; + case 8: stack = new ItemStack(ModItems.gas_mask_m65); break; + case 9: stack = new ItemStack(ModItems.ammo_20gauge, 8); break; + } + + addItemWithDeviation(loot, world.rand, stack, world.rand.nextDouble() - 0.5, i * 0.03125, world.rand.nextDouble() - 0.5); + } + } + } } diff --git a/src/main/java/com/hbm/world/feature/GlyphidHive.java b/src/main/java/com/hbm/world/feature/GlyphidHive.java index a5e8df06b..f615b6519 100644 --- a/src/main/java/com/hbm/world/feature/GlyphidHive.java +++ b/src/main/java/com/hbm/world/feature/GlyphidHive.java @@ -3,130 +3,117 @@ package com.hbm.world.feature; import java.util.Random; import com.hbm.blocks.ModBlocks; +import com.hbm.util.LootGenerator; import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntitySkull; import net.minecraft.world.World; public class GlyphidHive { - public static final int[][][] schematicBigGround = new int[][][] { + public static final int[][][] schematicSmall = new int[][][] { { {0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, {0,0,0,0,1,1,1,0,0,0,0}, - {0,0,0,1,1,1,1,1,0,0,0}, - {0,0,0,1,1,1,1,1,0,0,0}, - {0,0,0,1,1,1,1,1,0,0,0}, {0,0,0,0,1,1,1,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, - }, - { - {0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,1,1,1,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,0,1,9,9,9,9,9,1,0,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,1,1,1,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, }, { {0,0,0,0,0,0,0,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,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,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,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,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,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}, - {0,0,0,0,2,2,2,0,0,0,0}, - }, - { {0,0,0,0,1,1,1,0,0,0,0}, {0,0,0,1,1,1,1,1,0,0,0}, {0,0,1,1,1,1,1,1,1,0,0}, - {0,1,1,1,1,1,1,1,1,1,0}, - {1,1,1,1,1,1,1,1,1,1,1}, - {1,1,1,1,1,1,1,1,1,1,1}, - {1,1,1,1,1,1,1,1,1,1,1}, - {0,1,1,1,1,1,1,1,1,1,0}, + {0,0,1,1,1,1,1,1,1,0,0}, {0,0,1,1,1,1,1,1,1,0,0}, {0,0,0,1,1,1,1,1,0,0,0}, {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, }, { {0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,1,1,1,0,0,0,0}, - {0,0,0,1,1,1,1,1,0,0,0}, + {0,0,1,1,1,1,1,1,1,0,0}, + {0,0,1,1,1,1,1,1,1,0,0}, + {0,1,1,1,3,3,3,1,1,1,0}, + {0,1,1,1,3,3,3,1,1,1,0}, + {0,1,1,1,3,3,3,1,1,1,0}, + {0,0,1,1,1,1,1,1,1,0,0}, + {0,0,1,1,1,1,1,1,1,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + }, + { + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,1,1,1,1,1,1,1,0,0}, + {0,0,1,1,2,2,2,1,1,0,0}, + {0,1,1,2,2,2,2,2,1,1,0}, + {0,1,1,2,2,2,2,2,1,1,0}, + {0,1,1,2,2,2,2,2,1,1,0}, + {0,0,1,1,2,2,2,1,1,0,0}, + {0,0,1,1,1,1,1,1,1,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + }, + { + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,1,1,1,1,1,1,1,0,0}, {0,0,1,1,1,1,1,1,1,0,0}, {0,1,1,1,1,1,1,1,1,1,0}, {0,1,1,1,1,1,1,1,1,1,0}, {0,1,1,1,1,1,1,1,1,1,0}, {0,0,1,1,1,1,1,1,1,0,0}, - {0,0,0,1,1,1,1,1,0,0,0}, + {0,0,1,1,1,1,1,1,1,0,0}, {0,0,0,0,1,1,1,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0}, } }; - public static void generateBigGround(World world, int x, int y, int z, Random rand, boolean openDesign) { - - int orientation = rand.nextInt(2) + 2; - int overrideMeta = 0; + public static void generateSmall(World world, int x, int y, int z, Random rand, boolean infected, boolean loot) { + int overrideMeta = infected ? 1 : 0; for(int i = 0; i < 11; i++) { - for(int j = 0; j < 7; j++) { + for(int j = 0; j < 5; j++) { for(int k = 0; k < 11; k++) { - 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, overrideMeta, 2); - } else if (block != 0) { - world.setBlock(x + i - 5, y + j - 2, z + k - 5, Blocks.air); + int block = schematicSmall[4 - j][i][k]; + int iX = x + i - 5; + int iY = y + j - 2; + int iZ = z + k - 5; + + switch(block) { + case 1: world.setBlock(iX, iY, iZ, ModBlocks.glyphid_base, overrideMeta, 2); break; + case 2: world.setBlock(iX, iY, iZ, rand.nextInt(3) == 0 ? ModBlocks.glyphid_spawner : ModBlocks.glyphid_base, overrideMeta, 2); break; + case 3: + int r = rand.nextInt(3); + if(r == 0) { + world.setBlock(iX, iY, iZ, Blocks.skull, 1, 3); + TileEntitySkull skull = (TileEntitySkull) world.getTileEntity(iX, iY, iZ); + if(skull != null) skull.func_145903_a(rand.nextInt(16)); + } else if(r == 1) { + world.setBlock(iX, iY, z + k - 5, ModBlocks.deco_loot, 0, 2); + LootGenerator.lootBones(world, iX, iY, iZ); + } else if(r == 2) { + if(loot) { + world.setBlock(iX, iY, iZ, ModBlocks.deco_loot, 0, 2); + LootGenerator.lootGlyphidHive(world, iX, iY, iZ); + } else { + world.setBlock(iX, iY, iZ, ModBlocks.glyphid_base, overrideMeta, 2); + } + } + break; } } } } - - world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner, overrideMeta, 2); - } - } - diff --git a/src/main/resources/assets/hbm/textures/entity/parasite_maggot.png b/src/main/resources/assets/hbm/textures/entity/parasite_maggot.png new file mode 100644 index 0000000000000000000000000000000000000000..9bc94381b07fd409381bc3ab4c1663b4d9954fda GIT binary patch literal 441 zcmV;q0Y?6bP)nl>AdDagBPfdu*^1}uCFbkpNuaGV z*qYycXjFlHnVZtX7~0F=&`~-J=~Bi7)Wxu`WArdI1X`=WrG>i)Uj^zN7t^8ljnJjt j1Tmc71U(*)$7y~6-Gd4XsJqi}00000NkvXXu0mjf`9#V+ literal 0 HcmV?d00001 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 index 2fdf3d9419511af0d49b291a3a4d4f413c184177..1dcba8865d84680baf53bdba24401e16103f8d94 100644 GIT binary patch delta 137 zcmX@bIE!(DWIY=L1B3kM|A|0~rP#?cgaZg_I8r)*{6J3^#}JF&w|yIV4>)izdzvNk zJ^L=T?2E*bt}hek=`ULHTiej?X3l4QmF|?idiU3;q=%P%KhAp~#7ML!WtnHz=f&K| oZcfrsx^-WS;i~WbniH%!=M849-1Yx7&~OG%S3j3^PD}|+0Ab2DaR2}S delta 185 zcmbQmc#3g?WIZzj1A~Sxe=v|@EDmyaVpw-h<|UBBlJ4m1$iT3%pZiZDE0E6<;1l9{ z^ytz5|Nq~+cMm8q?c94okh+o}zhIysgM-$}FF-zLfk$L90|VcF5N5Ps4ORgPntQr9 zhG+z@?J?wIFyLTf{Qo~aShRheu3C|iqQ;|3=NU|TJf&9Y&eMFuu;9W}%Z1#(L)d=5 bvhDC_Jjrx5Wpl)2pcxFFu6{1-oD!M<3voUb From 5af5c6c861c316b229e63f38d6cb4fd8f004a201 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 17 Dec 2023 17:42:42 +0100 Subject: [PATCH 10/10] more shit to clean up --- .../com/hbm/blocks/generic/BlockGlyphid.java | 6 + .../blocks/generic/BlockGlyphidSpawner.java | 6 +- src/main/java/com/hbm/config/MobConfig.java | 4 - .../java/com/hbm/config/RadiationConfig.java | 4 - .../java/com/hbm/entity/EntityMappings.java | 2 +- .../grenade/EntityDisperserCanister.java | 111 +++++++++--------- .../hbm/entity/grenade/EntityGrenadeBase.java | 27 ++--- .../com/hbm/entity/mob/EntityGlyphid.java | 20 +++- .../hbm/entity/mob/EntityGlyphidNuclear.java | 26 +++- .../handler/pollution/PollutionHandler.java | 10 +- .../java/com/hbm/inventory/fluid/Fluids.java | 12 +- src/main/java/com/hbm/items/ModItems.java | 4 +- .../com/hbm/items/weapon/ItemDisperser.java | 3 +- .../projectile/RenderGenericGrenade.java | 60 ++++++---- src/main/resources/assets/hbm/lang/de_DE.lang | 1 + src/main/resources/assets/hbm/lang/en_US.lang | 1 + 16 files changed, 173 insertions(+), 124 deletions(-) diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java index 240356149..e94c67f14 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphid.java @@ -1,6 +1,7 @@ package com.hbm.blocks.generic; import java.util.List; +import java.util.Random; import com.hbm.blocks.IBlockMulti; import com.hbm.lib.RefStrings; @@ -27,6 +28,11 @@ public class BlockGlyphid extends Block implements IBlockMulti { this.setCreativeTab(MainRegistry.blockTab); } + @Override + public Item getItemDropped(int meta, Random rand, int fortune) { + return null; + } + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java index d9ff39bc7..e4d07db08 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java @@ -110,7 +110,7 @@ public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti { } } - List list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 9, yCoord + 1, zCoord - 9, xCoord + 10, yCoord + 8, zCoord + 10)); + List list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 5, yCoord + 1, zCoord - 5, xCoord + 6, yCoord + 7, zCoord + 6)); float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT); if(list.size() <= 3) { @@ -122,7 +122,9 @@ public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti { } if(!initialSpawn && worldObj.rand.nextInt(MobConfig.scoutSwarmSpawnChance + 1) == 0 && soot >= MobConfig.scoutThreshold) { - trySpawnEntity(new EntityGlyphidScout(worldObj)); + EntityGlyphidScout scout = new EntityGlyphidScout(worldObj); + if(this.getBlockMetadata() == 1) scout.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_INFECTED); + trySpawnEntity(scout); } initialSpawn = false; diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index 14f219193..7f9d45c9d 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -170,14 +170,10 @@ public class MobConfig { 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 11498ab0b..83cf7a10d 100644 --- a/src/main/java/com/hbm/config/RadiationConfig.java +++ b/src/main/java/com/hbm/config/RadiationConfig.java @@ -32,8 +32,6 @@ public class RadiationConfig { 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) { @@ -72,7 +70,5 @@ public class RadiationConfig { 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 6884483a8..6e25d2040 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -234,7 +234,7 @@ public class EntityMappings { 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(EntityDisperserCanister.class, "entity_disperser", 250); addEntity(EntityWaypoint.class, "entity_waypoint", 250, false); addMob(EntityCreeperNuclear.class, "entity_mob_nuclear_creeper", 0x204131, 0x75CE00); diff --git a/src/main/java/com/hbm/entity/grenade/EntityDisperserCanister.java b/src/main/java/com/hbm/entity/grenade/EntityDisperserCanister.java index a3ff8f6f8..3316c8015 100644 --- a/src/main/java/com/hbm/entity/grenade/EntityDisperserCanister.java +++ b/src/main/java/com/hbm/entity/grenade/EntityDisperserCanister.java @@ -3,74 +3,73 @@ 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_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(World p_i1774_1_, EntityLivingBase p_i1774_2_) { + super(p_i1774_1_, p_i1774_2_); + } - 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 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 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); - } - } + public EntityDisperserCanister setFluid(int id) { + this.dataWatcher.updateObject(12, id); + return this; + } - @Override - public void writeEntityToNBT(NBTTagCompound nbt) { - super.writeEntityToNBT(nbt); - nbt.setInteger("fluid", this.dataWatcher.getWatchableObjectInt(12)); - nbt.setInteger("item", this.dataWatcher.getWatchableObjectInt(13)); - } + @Override + protected void entityInit() { + this.dataWatcher.addObject(12, 0); + this.dataWatcher.addObject(13, 0); + } - @Override - public void readEntityFromNBT(NBTTagCompound nbt) { - super.readEntityFromNBT(nbt); - this.dataWatcher.updateObject(12, nbt.getInteger("fluid")); - this.dataWatcher.updateObject(13, nbt.getInteger("item")); + 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/grenade/EntityGrenadeBase.java b/src/main/java/com/hbm/entity/grenade/EntityGrenadeBase.java index 9b0062987..03b16f48c 100644 --- a/src/main/java/com/hbm/entity/grenade/EntityGrenadeBase.java +++ b/src/main/java/com/hbm/entity/grenade/EntityGrenadeBase.java @@ -13,6 +13,7 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; +@Deprecated public abstract class EntityGrenadeBase extends EntityThrowable { public EntityGrenadeBase(World p_i1773_1_) { @@ -31,24 +32,20 @@ public abstract class EntityGrenadeBase extends EntityThrowable { public void onUpdate() { super.onUpdate(); - - this.prevRotationPitch = this.rotationPitch; - - this.rotationPitch -= Vec3.createVectorHelper(motionX, motionY, motionZ).lengthVector() * 25; - - this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - while (this.rotationYaw - this.prevRotationYaw < -180.0F) - { - this.prevRotationYaw -= 360.0F; - } + this.prevRotationPitch = this.rotationPitch; + this.rotationPitch -= Vec3.createVectorHelper(motionX, motionY, motionZ).lengthVector() * 25; + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - while (this.rotationYaw - this.prevRotationYaw >= 180.0F) - { - this.prevRotationYaw += 360.0F; - } + while(this.rotationYaw - this.prevRotationYaw < -180.0F) { + this.prevRotationYaw -= 360.0F; + } - this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + while(this.rotationYaw - this.prevRotationYaw >= 180.0F) { + this.prevRotationYaw += 360.0F; + } + + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; } @Override diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 86d783cd6..ba5d41f5e 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -19,6 +19,7 @@ import com.hbm.main.ResourceManager; import com.hbm.potion.HbmPotion; import net.minecraft.block.Block; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; @@ -30,6 +31,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.world.EnumDifficulty; @@ -317,6 +319,8 @@ public class EntityGlyphid extends EntityMob { amount *= 1.5F; } else if(source == ModDamageSource.acid || source.equals(new DamageSource(ModDamageSource.s_acid))){ amount = 0; + } else if(source == DamageSource.inWall) { + amount *= 15F; } if(this.isPotionActive(HbmPotion.phosphorus.getId())){ @@ -327,7 +331,7 @@ public class EntityGlyphid extends EntityMob { boolean wasAttacked = super.attackEntityFrom(source, amount); if(alive && this.getHealth() <= 0) { - if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) { + if(doesInfectedSpawnMaggots() && this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) { int j = 2 + this.rand.nextInt(3); @@ -346,6 +350,10 @@ public class EntityGlyphid extends EntityMob { return wasAttacked; } + + public boolean doesInfectedSpawnMaggots() { + return true; + } public boolean isArmorBroken(float amount) { return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.6, 2), 100); @@ -435,10 +443,16 @@ public class EntityGlyphid extends EntityMob { } @Override - public boolean attackEntityAsMob(Entity victum) { + public boolean attackEntityAsMob(Entity victim) { if(this.isSwingInProgress) return false; this.swingItem(); - return super.attackEntityAsMob(victum); + + if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED && victim instanceof EntityLivingBase) { + ((EntityLivingBase) victim).addPotionEffect(new PotionEffect(Potion.poison.id, 100, 2)); + ((EntityLivingBase) victim).addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0)); + } + + return super.attackEntityAsMob(victim); } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java index e68c5311f..b8342bf6f 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidNuclear.java @@ -122,6 +122,11 @@ public class EntityGlyphidNuclear extends EntityGlyphid { return 10F; } + @Override + public boolean doesInfectedSpawnMaggots() { + return false; + } + public boolean hasWaypoint = false; @Override protected void onDeathUpdate() { @@ -148,10 +153,25 @@ public class EntityGlyphidNuclear extends EntityGlyphid { 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()); + + if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) { + int j = 15 + this.rand.nextInt(6); + for(int k = 0; k < j; ++k) { + float f = ((float) (k % 2) - 0.5F) * 0.5F; + float f1 = ((float) (k / 2) - 0.5F) * 0.5F; + EntityParasiteMaggot maggot = new EntityParasiteMaggot(worldObj); + maggot.setLocationAndAngles(this.posX + (double) f, this.posY + 0.5D, this.posZ + (double) f1, this.rand.nextFloat() * 360.0F, 0.0F); + maggot.motionX = f; + maggot.motionZ = f1; + maggot.velocityChanged = true; + this.worldObj.spawnEntityInWorld(maggot); + } + } else { + vnt.setBlockAllocator(new BlockAllocatorStandard(24)); + vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorDebris(ModBlocks.volcanic_lava_block, 0)).setNoDrop()); + } + vnt.setEntityProcessor(new EntityProcessorStandard()); vnt.setPlayerProcessor(new PlayerProcessorStandard()); vnt.explode(); diff --git a/src/main/java/com/hbm/handler/pollution/PollutionHandler.java b/src/main/java/com/hbm/handler/pollution/PollutionHandler.java index 9255062ef..28cd279c4 100644 --- a/src/main/java/com/hbm/handler/pollution/PollutionHandler.java +++ b/src/main/java/com/hbm/handler/pollution/PollutionHandler.java @@ -180,8 +180,6 @@ public class PollutionHandler { if(event.side == Side.SERVER && event.phase == Phase.END) { - int spreadThreshold = RadiationConfig.pollutionSpreadThreshold; - double spreadEff = RadiationConfig.pollutionSpreadEfficiency; eggTimer++; if(eggTimer < 60) return; eggTimer = 0; @@ -200,11 +198,11 @@ public class PollutionHandler { int P = PollutionType.POISON.ordinal(); /* CALCULATION */ - if(data.pollution[S] > spreadThreshold) { - pollutionForNeightbors[S] = (float) (data.pollution[S] * spreadEff); - data.pollution[S] *= 1-spreadEff*4; + if(data.pollution[S] > 15) { + pollutionForNeightbors[S] = (float) (data.pollution[S] * 0.05F); + data.pollution[S] *= 0.8F; } else { - data.pollution[S] *= 0.8; + data.pollution[S] *= 0.99F; } data.pollution[H] *= 0.9995F; diff --git a/src/main/java/com/hbm/inventory/fluid/Fluids.java b/src/main/java/com/hbm/inventory/fluid/Fluids.java index b2efa5781..d4dd8544b 100644 --- a/src/main/java/com/hbm/inventory/fluid/Fluids.java +++ b/src/main/java/com/hbm/inventory/fluid/Fluids.java @@ -325,12 +325,12 @@ public class Fluids { SMOKE_LEADED = new FluidType("SMOKE_LEADED", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON); SMOKE_POISON = new FluidType("SMOKE_POISON", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON); HELIUM4 = new FluidType("HELIUM4", 0xE54B0A, 0, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS); - 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); - 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)); + HEAVYWATER_HOT = new FluidType("HEAVYWATER_HOT", 0x4D007B, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID, VISCOUS); + SODIUM = new FluidType("SODIUM", 0xCCD4D5, 1, 2, 3, EnumSymbol.NONE).setTemp(400).addTraits(LIQUID, VISCOUS); + SODIUM_HOT = new FluidType("SODIUM_HOT", 0xE2ADC1, 1, 2, 3, EnumSymbol.NONE).setTemp(1200).addTraits(LIQUID, VISCOUS); + THORIUM_SALT = new FluidType("THORIUM_SALT", 0x7A5542, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, VISCOUS, new FT_Corrosive(65)); + THORIUM_SALT_HOT = new FluidType("THORIUM_SALT_HOT", 0x3E3627, 2, 0, 3, EnumSymbol.NONE).setTemp(1600).addTraits(LIQUID, VISCOUS, new FT_Corrosive(65)); + THORIUM_SALT_DEPLETED = new FluidType("THORIUM_SALT_DEPLETED", 0x302D1C, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, VISCOUS, new FT_Corrosive(65)); FULLERENE = new FluidType("FULLERENE", 0xFF7FED, 3, 3, 3, EnumSymbol.NONE).addTraits(LIQUID, new FT_Corrosive(65)); PHEROMONE = new FluidType("PHEROMONE", 0x5FA6E8, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(1)); PHEROMONE_M = new FluidType(132, "PHEROMONE_M", 0x48C9B0 , 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(2)); diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 826915238..72651c636 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -936,8 +936,8 @@ 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 disperser_canister; public static Item glyphid_gland; public static Item glyphid_gland_empty; @@ -4650,8 +4650,8 @@ public class ModItems { 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_empty = new Item().setUnlocalizedName("disperser_canister_empty").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":disperser_canister"); 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"); diff --git a/src/main/java/com/hbm/items/weapon/ItemDisperser.java b/src/main/java/com/hbm/items/weapon/ItemDisperser.java index 682ff3eec..7f06f07e1 100644 --- a/src/main/java/com/hbm/items/weapon/ItemDisperser.java +++ b/src/main/java/com/hbm/items/weapon/ItemDisperser.java @@ -18,6 +18,7 @@ import net.minecraft.world.World; import java.util.List; public class ItemDisperser extends ItemFluidTank { + @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { @@ -59,7 +60,7 @@ public class ItemDisperser extends ItemFluidTank { public String getItemStackDisplayName(ItemStack stack) { String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); - String s1 = ("" + StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getUnlocalizedName())).trim(); + String s1 = ("" + StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getConditionalName())).trim(); s = this == ModItems.glyphid_gland ? s1 + " " + s : s + " " + s1; return s; 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 01ff7f5c7..06ecc70fa 100644 --- a/src/main/java/com/hbm/render/entity/projectile/RenderGenericGrenade.java +++ b/src/main/java/com/hbm/render/entity/projectile/RenderGenericGrenade.java @@ -1,11 +1,11 @@ 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; import com.hbm.entity.grenade.IGenericGrenade; +import com.hbm.inventory.fluid.FluidType; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.Render; @@ -18,26 +18,44 @@ public class RenderGenericGrenade extends Render { @Override public void doRender(Entity entity, double x, double y, double z, float f0, float f1) { - 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(); - GL11.glTranslatef((float) x, (float) y, (float) z); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glScalef(0.5F, 0.5F, 0.5F); - this.bindEntityTexture(entity); - Tessellator tessellator = Tessellator.instance; - - this.renderItem(tessellator, iicon); - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); + + boolean disperser = entity instanceof EntityDisperserCanister; + + for(int i = 0; i < (disperser ? 2 : 1); i++) { + + IIcon iicon; + if(disperser){ + EntityDisperserCanister canister = (EntityDisperserCanister) entity; + FluidType fluid = canister.getFluid(); + iicon = canister.getType().getIconFromDamageForRenderPass(fluid.getID(), i); + + if(i == 1) { + int hex = fluid.getColor(); + int r = (hex & 0xFF0000) >> 16; + int g = (hex & 0xFF00) >> 8; + int b = (hex & 0xFF); + GL11.glColor3b((byte) (r / 2), (byte) (g / 2), (byte) (b / 2)); + } + + } else { + IGenericGrenade grenade = (IGenericGrenade) entity; + iicon = grenade.getGrenade().getIconFromDamage(i); + } + + if(iicon != null) { + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) y, (float) z); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glScalef(0.5F, 0.5F, 0.5F); + this.bindEntityTexture(entity); + Tessellator tessellator = Tessellator.instance; + + this.renderItem(tessellator, iicon); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + + GL11.glColor3f(1F, 1F, 1F); } } diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 9a561713c..24112073e 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -541,6 +541,7 @@ entity.entity_mob_nuclear_creeper.name=Nuklearer Creeper entity.entity_mob_phosgene_creeper.name=Phosgen-Creeper entity.entity_mob_tainted_creeper.name=Verseuchter Creeper entity.entity_mob_volatile_creeper.name=Instabiler Creeper +entity.entity_parasite_maggot.name=Parasitische Made entity.entity_pigeon.name=Taube entity.entity_plastic_bag.name=Plastiktüte entity.entity_taint_crab.name=Verseuchte Krabbe diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 78f5468b6..088d36302 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -1050,6 +1050,7 @@ entity.entity_mob_nuclear_creeper.name=Nuclear Creeper entity.entity_mob_phosgene_creeper.name=Phosgene Creeper entity.entity_mob_tainted_creeper.name=Tainted Creeper entity.entity_mob_volatile_creeper.name=Volatile Creeper +entity.entity_parasite_maggot.name=Parasitic Maggot entity.entity_pigeon.name=Pigeon entity.entity_plastic_bag.name=Plastic Bag entity.entity_taint_crab.name=Taint Crab