Merge pull request #1483 from 70000hp/soot-moment-and-bugs

Soot moment and bugs
This commit is contained in:
HbmMods 2024-05-12 12:33:33 +02:00 committed by GitHub
commit 52821f7b52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 44 additions and 11 deletions

View File

@ -59,7 +59,7 @@ public class MobConfig {
public static boolean rampantMode = false;
public static boolean rampantNaturalScoutSpawn = false;
public static double rampantScoutSpawnThresh = 14;
public static int rampantScoutSpawnChance = 600;
public static int rampantScoutSpawnChance = 1400;
public static boolean scoutInitialSpawn = false;
public static boolean rampantExtendedTargetting = false;
public static boolean rampantDig = false;
@ -154,8 +154,8 @@ public class MobConfig {
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);
rampantScoutSpawnThresh = CommonConfig.createConfigDouble(config, CATEGORY, "12.R02.1_rampantScoutSpawnThresh", "How much soot is needed for scouts to naturally spawn", 20);
rampantScoutSpawnChance = CommonConfig.createConfigInt(config, CATEGORY, "12.R02.2_rampantScoutSpawnChance", "How often scouts naturally spawn per mob population, 1/x format, the bigger the number, the more uncommon the scouts", 600);
rampantScoutSpawnThresh = CommonConfig.createConfigDouble(config, CATEGORY, "12.R02.1_rampantScoutSpawnThresh", "How much soot is needed for scouts to naturally spawn", 13);
rampantScoutSpawnChance = CommonConfig.createConfigInt(config, CATEGORY, "12.R02.2_rampantScoutSpawnChance", "How often scouts naturally spawn per mob population, 1/x format, the bigger the number, the more uncommon the scouts", 1400);
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);
@ -171,7 +171,10 @@ public class MobConfig {
scoutSwarmSpawnChance = 1;
scoutThreshold = 0.1;
if(pollutionMult == 1) {
pollutionMult = 2;
pollutionMult = 3;
}
if (bombardierChance[2] == 1){
bombardierChance[2] = 0;
}
RadiationConfig.sootFogThreshold *= pollutionMult;
}

View File

@ -397,8 +397,7 @@ public class PollutionHandler {
@SubscribeEvent
public void rampantScoutPopulator(WorldEvent.PotentialSpawns event){
if(MobConfig.rampantNaturalScoutSpawn && !event.world.isRemote && event.world.provider.dimensionId == 0 && event.type == EnumCreatureType.monster
&& event.world.canBlockSeeTheSky(event.x, event.y, event.z) && !event.isCanceled()) {
if(MobConfig.rampantNaturalScoutSpawn && !event.world.isRemote && event.world.provider.dimensionId == 0 && event.world.canBlockSeeTheSky(event.x, event.y, event.z) && !event.isCanceled()) {
if (event.world.rand.nextInt(MobConfig.rampantScoutSpawnChance) == 0) {

View File

@ -2,13 +2,19 @@ package com.hbm.tileentity;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import api.hbm.fluid.IFluidUser;
import com.hbm.inventory.fluid.trait.FT_Polluting;
import com.hbm.inventory.fluid.trait.FluidTrait;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.HashMap;
import java.util.Map;
public abstract class TileEntityMachinePolluting extends TileEntityMachineBase implements IFluidUser {
public FluidTank smoke;
@ -36,6 +42,30 @@ public abstract class TileEntityMachinePolluting extends TileEntityMachineBase i
if(worldObj.rand.nextInt(3) == 0) worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.fizz", 0.1F, 1.5F);
}
}
public void pollute(FluidType type, FluidTrait.FluidReleaseType release, float amount) {
FluidTank tank;
FT_Polluting trait = type.getTrait(FT_Polluting.class);
if(trait == null) return;
if(release == FluidTrait.FluidReleaseType.VOID) return;
HashMap<PollutionType, Float> map = release == FluidTrait.FluidReleaseType.BURN ? trait.burnMap : trait.releaseMap;
for(Map.Entry<PollutionType, Float> entry : map.entrySet()) {
tank = entry.getKey() == PollutionType.SOOT ? smoke : entry.getKey() == PollutionType.HEAVYMETAL ? smoke_leaded : smoke_poison;
int fluidAmount = (int) Math.ceil(entry.getValue() * amount * 100);
tank.setFill(tank.getFill() + fluidAmount);
if (tank.getFill() > tank.getMaxFill()) {
int overflow = tank.getFill() - tank.getMaxFill();
tank.setFill(tank.getMaxFill());
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, entry.getKey(), overflow / 100F);
if (worldObj.rand.nextInt(3) == 0)
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.fizz", 0.1F, 1.5F);
}
}
}
public void sendSmoke(int x, int y, int z, ForgeDirection dir) {
if(this.smoke.getFill() > 0) this.sendFluid(smoke, worldObj, x, y, z, dir);

View File

@ -172,7 +172,7 @@ public class TileEntityCrucible extends TileEntityMachineBase implements IGUIPro
}
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND / 2F);
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND / 20F);
}
/* pour recipe stack */

View File

@ -82,7 +82,7 @@ public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implem
this.heatEnergy += heat * toBurn;
if(worldObj.getTotalWorldTime() % 5 == 0 && toBurn > 0) {
FT_Polluting.pollute(worldObj, xCoord, yCoord, zCoord, tank.getTankType(), FluidReleaseType.BURN, toBurn * 5);
super.pollute(tank.getTankType(), FluidReleaseType.BURN, toBurn * 5);
}
shouldCool = false;

View File

@ -87,7 +87,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachinePollutin
fill -= toBurn;
if(worldObj.getTotalWorldTime() % 5 == 0 && toBurn > 0) {
FT_Polluting.pollute(worldObj, xCoord, yCoord, zCoord, tank.getTankType(), FluidReleaseType.BURN, toBurn * 5);
super.pollute(tank.getTankType(), FluidReleaseType.BURN, toBurn * 0.5F);
}
if(toBurn > 0) {

View File

@ -212,7 +212,7 @@ public class TileEntityMachineDiesel extends TileEntityMachinePolluting implemen
tank.setFill(0);
if(worldObj.getTotalWorldTime() % 5 == 0) {
FT_Polluting.pollute(worldObj, xCoord, yCoord, zCoord, tank.getTankType(), FluidReleaseType.BURN, 5F);
super.pollute(tank.getTankType(), FluidReleaseType.BURN, 5F);
}
if(power + getHEFromFuel() <= powerCap) {

View File

@ -16,6 +16,7 @@ import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.fluid.trait.FT_Combustible;
import com.hbm.inventory.fluid.trait.FT_Combustible.FuelGrade;
import com.hbm.inventory.fluid.trait.FluidTrait;
import com.hbm.inventory.gui.GUIMachineTurbofan;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
@ -176,7 +177,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implem
this.power += this.output;
this.consumption = amountToBurn;
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * amountToBurn);
if(worldObj.getTotalWorldTime() % 20 == 0) super.pollute(tank.getTankType(), FluidTrait.FluidReleaseType.BURN, amountToBurn * 5);;
}
power = Library.chargeItemsFromTE(slots, 3, power, power);