Added smokestack support to fluid burning lads

This commit is contained in:
70000hp 2024-05-10 16:47:33 -04:00
parent 78f9d19b8d
commit 81a3c19e88
7 changed files with 39 additions and 5 deletions

View File

@ -173,6 +173,9 @@ public class MobConfig {
if(pollutionMult == 1) {
pollutionMult = 3;
}
if (bombardierChance[2] == 1){
bombardierChance[2] = 0;
}
RadiationConfig.sootFogThreshold *= pollutionMult;
}
}

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);