pipable exhaust

This commit is contained in:
Boblet 2023-06-30 11:57:28 +02:00
parent 0b36b76f3e
commit fcfa725f0b
20 changed files with 313 additions and 256 deletions

View File

@ -6,6 +6,10 @@
* Can be grilled
* Fluid valves
* come in manual and restone variants
* Chimney
* Most polluting machines can now be connected to a chimney with exhaust pipes
* The chimney will vent the pollution created by the machines, reducing it by 75%
* Compatible with soot, heavy metal and poison pollution
## Changed
* Glyphids now have a config for a global spawn limit, which is 50 by default, no more than this many glyphids can be created at once

View File

@ -16,11 +16,13 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class BlockTNTBase extends BlockFlammable implements IToolable {
@ -44,6 +46,8 @@ public abstract class BlockTNTBase extends BlockFlammable implements IToolable {
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
this.onBlockDestroyedByPlayer(world, x, y, z, 1);
world.setBlockToAir(x, y, z);
} else {
checkAndIgnite(world, x, y, z);
}
}
@ -52,6 +56,19 @@ public abstract class BlockTNTBase extends BlockFlammable implements IToolable {
if(world.isBlockIndirectlyGettingPowered(x, y, z)) {
this.onBlockDestroyedByPlayer(world, x, y, z, 1);
world.setBlockToAir(x, y, z);
} else {
checkAndIgnite(world, x, y, z);
}
}
public void checkAndIgnite(World world, int x, int y, int z) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == Blocks.fire) {
this.onBlockDestroyedByPlayer(world, x, y, z, 1);
world.setBlockToAir(x, y, z);
return;
}
}
}

View File

@ -29,7 +29,7 @@ public class HeaterFirebox extends BlockDummyable implements ITooltipProvider {
/*if(lastCore.getX() == lastBlockSet.getX() && lastCore.getY() + 1 == lastBlockSet.getY() && lastCore.getZ() == lastBlockSet.getZ())
return new TileEntityProxyCombo().inventory().heatSource();*/
return new TileEntityProxyCombo(true, false, false);
return new TileEntityProxyCombo().inventory().fluid();
}
@Override

View File

@ -30,7 +30,7 @@ public class MachineDiFurnaceExtension extends BlockContainer implements IProxyC
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityProxyCombo().inventory();
return new TileEntityProxyCombo().inventory().fluid();
}
@Override

View File

@ -10,6 +10,7 @@ import java.util.Locale;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ILookOverlay;
import com.hbm.inventory.fluid.Fluids;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
@ -88,6 +89,7 @@ public class MachineTurbineGas extends BlockDummyable implements ILookOverlay {
if(hitCheck(dir, pos[0], pos[1], pos[2], -1, -1, 0, x, y, z) || hitCheck(dir, pos[0], pos[1], pos[2], 1, -1, 0, x, y, z)) {
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + I18nUtil.resolveKey("hbmfluid." + turbine.tanks[0].getTankType().getName().toLowerCase(Locale.US)));
text.add(EnumChatFormatting.GREEN + "-> " + EnumChatFormatting.RESET + I18nUtil.resolveKey("hbmfluid." + turbine.tanks[1].getTankType().getName().toLowerCase(Locale.US)));
text.add(EnumChatFormatting.RED + "<- " + EnumChatFormatting.RESET + I18nUtil.resolveKey(Fluids.SMOKE.getUnlocalizedName()));
}
if(hitCheck(dir, pos[0], pos[1], pos[2], -1, 4, 0, x, y, z) || hitCheck(dir, pos[0], pos[1], pos[2], 1, 4, 0, x, y, z)) {

View File

@ -35,7 +35,7 @@ public class FluidTank {
FluidType type;
int fluid;
int maxFluid;
public int index = 0;
@Deprecated public int index = 0;
int pressure = 0;
public FluidTank(FluidType type, int maxFluid) {

View File

@ -490,6 +490,9 @@ public class AnvilRecipes {
constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(ModBlocks.fluid_duct_box, 1, i), new AnvilOutput(new ItemStack(ModItems.plate_iron))).setTier(2).setOverlay(OverlayType.RECYCLING));
constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(ModBlocks.fluid_duct_box, 1, i + 1), new AnvilOutput(new ItemStack(ModItems.plate_copper))).setTier(2).setOverlay(OverlayType.RECYCLING));
constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(ModBlocks.fluid_duct_box, 1, i + 2), new AnvilOutput(new ItemStack(ModItems.plate_aluminium))).setTier(2).setOverlay(OverlayType.RECYCLING));
constructionRecipes.add(new AnvilConstructionRecipe(new AStack[] {new OreDictStack(IRON.plate(), 1), new ComparableStack(ModItems.plate_polymer)}, new AnvilOutput(new ItemStack(ModBlocks.fluid_duct_exhaust, 8, i))).setTier(2).setOverlay(OverlayType.CONSTRUCTION));
constructionRecipes.add(new AnvilConstructionRecipe(new ComparableStack(ModBlocks.fluid_duct_exhaust, 8, i), new AnvilOutput[] {new AnvilOutput(new ItemStack(ModItems.plate_iron)), new AnvilOutput(new ItemStack(ModItems.plate_polymer))}).setTier(2));
}
}

View File

@ -0,0 +1,65 @@
package com.hbm.tileentity;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import api.hbm.fluid.IFluidUser;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class TileEntityMachinePolluting extends TileEntityMachineBase implements IFluidUser {
public FluidTank smoke;
public FluidTank smoke_leaded;
public FluidTank smoke_poison;
public TileEntityMachinePolluting(int scount, int buffer) {
super(scount);
smoke = new FluidTank(Fluids.SMOKE, buffer);
smoke_leaded = new FluidTank(Fluids.SMOKE_LEADED, buffer);
smoke_poison = new FluidTank(Fluids.SMOKE_POISON, buffer);
}
public void pollute(PollutionType type, float amount) {
FluidTank tank = type == PollutionType.SOOT ? smoke : type == PollutionType.HEAVYMETAL ? smoke_leaded : smoke_poison;
int fluidAmount = (int) Math.ceil(amount * 40);
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, type, overflow / 40F);
}
}
public void sendSmoke(int x, int y, int z, ForgeDirection dir) {
if(this.smoke.getFill() > 0) this.sendFluid(smoke, worldObj, x, y, z, dir);
if(this.smoke_leaded.getFill() > 0) this.sendFluid(smoke_leaded, worldObj, x, y, z, dir);
if(this.smoke_poison.getFill() > 0) this.sendFluid(smoke_poison, worldObj, x, y, z, dir);
}
public FluidTank[] getSmokeTanks() {
return new FluidTank[] {smoke, smoke_leaded, smoke_poison};
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
smoke.readFromNBT(nbt, "smoke0");
smoke_leaded.readFromNBT(nbt, "smoke1");
smoke_poison.readFromNBT(nbt, "smoke2");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
smoke.writeToNBT(nbt, "smoke0");
smoke_leaded.writeToNBT(nbt, "smoke1");
smoke_poison.writeToNBT(nbt, "smoke2");
}
}

View File

@ -1,18 +1,25 @@
package com.hbm.tileentity.machine;
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 com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.fluid.IFluidUser;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChimneyBrick extends TileEntityLoadedBase implements IFluidUser {
public class TileEntityChimneyBrick extends TileEntityLoadedBase implements IFluidUser, INBTPacketReceiver {
public int onTicks;
@Override
public void updateEntity() {
@ -29,8 +36,34 @@ public class TileEntityChimneyBrick extends TileEntityLoadedBase implements IFlu
this.trySubscribe(type, worldObj, xCoord, yCoord, zCoord - 2, Library.NEG_Z);
}
}
NBTTagCompound data = new NBTTagCompound();
data.setInteger("onTicks", onTicks);
INBTPacketReceiver.networkPack(this, data, 150);
} else {
if(onTicks < 0) {
if(worldObj.getTotalWorldTime() % 2 == 0) {
NBTTagCompound fx = new NBTTagCompound();
fx.setString("type", "tower");
fx.setFloat("lift", 10F);
fx.setFloat("base", 0.5F);
fx.setFloat("max", 3F);
fx.setInteger("life", 250 + worldObj.rand.nextInt(50));
fx.setInteger("color",0x404040);
fx.setDouble("posX", xCoord + 0.5);
fx.setDouble("posY", yCoord + 12);
fx.setDouble("posZ", zCoord + 0.5);
MainRegistry.proxy.effectNT(fx);
}
}
}
}
public void networkUnpack(NBTTagCompound nbt) {
this.onTicks = nbt.getInteger("onTicks");
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
@ -40,6 +73,14 @@ public class TileEntityChimneyBrick extends TileEntityLoadedBase implements IFlu
@Override
public long transferFluid(FluidType type, int pressure, long fluid) {
onTicks = 20;
fluid *= 0.25;
if(type == Fluids.SMOKE) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, fluid / 40F);
if(type == Fluids.SMOKE_LEADED) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, fluid / 40F);
if(type == Fluids.SMOKE_POISON) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.POISON, fluid / 40F);
return 0;
}

View File

@ -5,13 +5,15 @@ import com.hbm.blocks.machine.MachineDiFurnace;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.inventory.container.ContainerDiFurnace;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIDiFurnace;
import com.hbm.inventory.recipes.BlastFurnaceRecipes;
import com.hbm.items.ModItems;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import api.hbm.fluid.IFluidStandardSender;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
@ -23,8 +25,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityDiFurnace extends TileEntityMachineBase implements IGUIProvider {
public class TileEntityDiFurnace extends TileEntityMachinePolluting implements IFluidStandardSender, IGUIProvider {
public int progress;
public int fuel;
@ -37,7 +40,7 @@ public class TileEntityDiFurnace extends TileEntityMachineBase implements IGUIPr
public byte sideLower = 1;
public TileEntityDiFurnace() {
super(4);
super(4, 1200);
}
@Override
@ -183,6 +186,14 @@ public class TileEntityDiFurnace extends TileEntityMachineBase implements IGUIPr
public void updateEntity() {
if(!worldObj.isRemote) {
boolean extension = worldObj.getBlock(xCoord, yCoord + 1, zCoord) == ModBlocks.machine_difurnace_extension;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
this.sendSmoke(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
}
if(extension) this.sendSmoke(xCoord, yCoord + 2, zCoord, ForgeDirection.UP);
boolean markDirty = false;
@ -198,7 +209,6 @@ public class TileEntityDiFurnace extends TileEntityMachineBase implements IGUIPr
}
if(canProcess()) {
boolean extension = worldObj.getBlock(xCoord, yCoord + 1, zCoord) == ModBlocks.machine_difurnace_extension;
//fuel -= extension ? 2 : 1;
fuel -= 1; //switch it up on me, fuel efficiency, on fumes i'm running - running - running - running
@ -214,7 +224,7 @@ public class TileEntityDiFurnace extends TileEntityMachineBase implements IGUIPr
fuel = 0;
}
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * (extension ? 3 : 1));
if(worldObj.getTotalWorldTime() % 20 == 0) this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * (extension ? 3 : 1));
} else {
progress = 0;
@ -263,4 +273,14 @@ public class TileEntityDiFurnace extends TileEntityMachineBase implements IGUIPr
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIDiFurnace(player.inventory, this);
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[0];
}
@Override
public FluidTank[] getSendingTanks() {
return this.getSmokeTanks();
}
}

View File

@ -3,10 +3,13 @@ package com.hbm.tileentity.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.module.ModuleBurnTime;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import api.hbm.fluid.IFluidStandardSender;
import api.hbm.tile.IHeatSource;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -16,7 +19,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class TileEntityFireboxBase extends TileEntityMachineBase implements IGUIProvider, IHeatSource {
public abstract class TileEntityFireboxBase extends TileEntityMachinePolluting implements IFluidStandardSender, IGUIProvider, IHeatSource {
public int maxBurnTime;
public int burnTime;
@ -31,7 +34,7 @@ public abstract class TileEntityFireboxBase extends TileEntityMachineBase implem
public TileEntityFireboxBase() {
super(2);
super(2, 1_200);
}
@Override
@ -49,6 +52,15 @@ public abstract class TileEntityFireboxBase extends TileEntityMachineBase implem
if(!worldObj.isRemote) {
for(int i = 2; i < 6; i++) {
ForgeDirection dir = ForgeDirection.getOrientation(i);
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
for(int j = -1; j <= 1; j++) {
this.sendSmoke(xCoord + dir.offsetX * 2 + rot.offsetX * j, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ * j, dir);
}
}
wasOn = false;
if(burnTime <= 0) {
@ -76,7 +88,7 @@ public abstract class TileEntityFireboxBase extends TileEntityMachineBase implem
if(this.heatEnergy < getMaxHeat()) {
burnTime--;
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 3);
if(worldObj.getTotalWorldTime() % 20 == 0) this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 3);
}
this.wasOn = true;
@ -201,4 +213,19 @@ public abstract class TileEntityFireboxBase extends TileEntityMachineBase implem
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[0];
}
@Override
public FluidTank[] getSendingTanks() {
return this.getSmokeTanks();
}
@Override
public boolean canConnect(FluidType type, ForgeDirection dir) {
return dir != ForgeDirection.UNKNOWN && dir != ForgeDirection.DOWN;
}
}

View File

@ -11,7 +11,7 @@ import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIFurnaceCombo;
import com.hbm.inventory.recipes.CombinationRecipes;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import com.hbm.util.Tuple.Pair;
import api.hbm.fluid.IFluidStandardSender;
@ -29,7 +29,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityFurnaceCombination extends TileEntityMachineBase implements IFluidStandardSender, IGUIProvider {
public class TileEntityFurnaceCombination extends TileEntityMachinePolluting implements IFluidStandardSender, IGUIProvider {
public boolean wasOn;
public int progress;
@ -42,7 +42,7 @@ public class TileEntityFurnaceCombination extends TileEntityMachineBase implemen
public FluidTank tank;
public TileEntityFurnaceCombination() {
super(4);
super(4, 1_200);
this.tank = new FluidTank(Fluids.NONE, 24_000);
}
@ -65,6 +65,7 @@ public class TileEntityFurnaceCombination extends TileEntityMachineBase implemen
for(int y = yCoord; y <= yCoord + 1; y++) {
for(int j = -1; j <= 1; j++) {
if(tank.getFill() > 0) this.sendFluid(tank, worldObj, xCoord + dir.offsetX * 2 + rot.offsetX * j, y, zCoord + dir.offsetZ * 2 + rot.offsetZ * j, dir);
this.sendSmoke(xCoord + dir.offsetX * 2 + rot.offsetX * j, y, zCoord + dir.offsetZ * 2 + rot.offsetZ * j, dir);
}
}
}
@ -72,6 +73,7 @@ public class TileEntityFurnaceCombination extends TileEntityMachineBase implemen
for(int x = xCoord - 1; x <= xCoord + 1; x++) {
for(int z = zCoord - 1; z <= zCoord + 1; z++) {
if(tank.getFill() > 0) this.sendFluid(tank, worldObj, x, yCoord + 2, z, ForgeDirection.UP);
this.sendSmoke(x, yCoord + 2, z, ForgeDirection.UP);
}
}
}
@ -122,7 +124,7 @@ public class TileEntityFurnaceCombination extends TileEntityMachineBase implemen
if(worldObj.getTotalWorldTime() % 10 == 0) this.worldObj.playSoundEffect(this.xCoord, this.yCoord + 1, this.zCoord, "hbm:weapon.flamethrowerShoot", 0.25F, 0.5F);
}
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 3);
if(worldObj.getTotalWorldTime() % 20 == 0) this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 3);
} else {
this.progress = 0;
}
@ -274,6 +276,6 @@ public class TileEntityFurnaceCombination extends TileEntityMachineBase implemen
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {tank};
return new FluidTank[] {tank, smoke, smoke_leaded, smoke_poison};
}
}

View File

@ -67,7 +67,6 @@ public class TileEntityFurnaceIron extends TileEntityMachineBase implements IGUI
if(slots[i] != null) {
int fuel = burnModule.getBurnTime(slots[i]);
//int fuel = TileEntityFurnace.getItemBurnTime(slots[i]);
if(fuel > 0) {
this.maxBurnTime = this.burnTime = fuel;

View File

@ -3,9 +3,7 @@ package com.hbm.tileentity.machine;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.inventory.container.ContainerOilburner;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.fluid.trait.FT_Flammable;
@ -13,9 +11,10 @@ import com.hbm.inventory.fluid.trait.FluidTraitSimple.FT_Leaded;
import com.hbm.inventory.gui.GUIOilburner;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.fluid.IFluidStandardReceiver;
import api.hbm.fluid.IFluidStandardTransceiver;
import api.hbm.tile.IHeatSource;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -26,7 +25,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class TileEntityHeaterOilburner extends TileEntityMachineBase implements IGUIProvider, IFluidStandardReceiver, IHeatSource, IControlReceiver, IFluidAcceptor {
public class TileEntityHeaterOilburner extends TileEntityMachinePolluting implements IGUIProvider, IFluidStandardTransceiver, IHeatSource, IControlReceiver {
public boolean isOn = false;
public FluidTank tank;
@ -36,14 +35,23 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
public static final int maxHeatEnergy = 100_000;
public TileEntityHeaterOilburner() {
super(3);
tank = new FluidTank(Fluids.HEATINGOIL, 16000, 0);
super(3, 2_000);
tank = new FluidTank(Fluids.HEATINGOIL, 16000);
}
@Override
public String getName() {
return "container.heaterOilburner";
}
public DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X),
new DirPos(xCoord - 2, yCoord, zCoord, Library.NEG_X),
new DirPos(xCoord, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z)
};
}
@Override
public void updateEntity() {
@ -53,10 +61,10 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
tank.loadTank(0, 1, slots);
tank.setType(2, slots);
this.trySubscribe(tank.getTankType(), worldObj, xCoord + 2, yCoord, zCoord, Library.POS_X);
this.trySubscribe(tank.getTankType(), worldObj, xCoord - 2, yCoord, zCoord, Library.NEG_X);
this.trySubscribe(tank.getTankType(), worldObj, xCoord, yCoord, zCoord + 2, Library.POS_Z);
this.trySubscribe(tank.getTankType(), worldObj, xCoord, yCoord, zCoord - 2, Library.NEG_Z);
for(DirPos pos : this.getConPos()) {
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.sendSmoke(pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
boolean shouldCool = true;
@ -75,8 +83,8 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
this.heatEnergy += heat * toBurn;
if(worldObj.getTotalWorldTime() % 20 == 0) {
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * burnRate * 0.5F);
if(tank.getTankType().hasTrait(FT_Leaded.class)) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * burnRate * 0.5F);
this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * burnRate * 0.5F);
if(tank.getTankType().hasTrait(FT_Leaded.class)) this.pollute(PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * burnRate * 0.5F);
}
shouldCool = false;
@ -157,28 +165,6 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
this.heatEnergy = Math.max(0, this.heatEnergy - heat);
}
@Override
public void setFillForSync(int fill, int index) { }
@Override
public void setFluidFill(int fill, FluidType type) {
if(type == tank.getTankType())
tank.setFill(fill);
}
@Override
public void setTypeForSync(FluidType type, int index) { }
@Override
public int getFluidFill(FluidType type) {
return type == tank.getTankType() ? tank.getFill() : 0;
}
@Override
public int getMaxFluidFill(FluidType type) {
return type == tank.getTankType() ? tank.getMaxFill() : 0;
}
@Override
public boolean hasPermission(EntityPlayer player) {
return player.getDistanceSq(xCoord, yCoord, zCoord) <= 256;
@ -221,4 +207,9 @@ public class TileEntityHeaterOilburner extends TileEntityMachineBase implements
public FluidTank[] getAllTanks() {
return new FluidTank[] { tank };
}
@Override
public FluidTank[] getSendingTanks() {
return this.getSmokeTanks();
}
}

View File

@ -7,27 +7,20 @@ import com.google.gson.stream.JsonWriter;
import com.hbm.blocks.machine.MachineCoal;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.container.ContainerMachineCoal;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineCoal;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.IConfigurableMachine;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import api.hbm.energy.IBatteryItem;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardReceiver;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
@ -37,15 +30,12 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISidedInventory, IEnergyGenerator, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver, IConfigurableMachine, IGUIProvider {
public class TileEntityMachineCoal extends TileEntityMachinePolluting implements ISidedInventory, IEnergyGenerator, IFluidStandardTransceiver, IConfigurableMachine, IGUIProvider {
private ItemStack slots[];
public long power;
public int burnTime;
public static final long maxPower = 100000;
@ -55,84 +45,21 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
private static final int[] slots_bottom = new int[] {0, 2};
private static final int[] slots_side = new int[] {0, 2};
private String customName;
/* CONFIGURABLE CONSTANTS */
public static int waterCap = 5000;
public static int genRate = 25;
public static double fuelMod = 0.5D;
public TileEntityMachineCoal() {
slots = new ItemStack[4];
super(4, 120);
tank = new FluidTank(Fluids.WATER, waterCap, 0);
}
@Override
public int getSizeInventory() {
return slots.length;
public String getName() {
return "container.machineCoal";
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(slots[i] != null)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
{
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : "container.machineCoal";
}
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
{
return false;
}else{
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
}
}
//You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
if(i == 0)
@ -148,46 +75,12 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
return false;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if(slots[i] != null)
{
if(slots[i].stackSize <= j)
{
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0)
{
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
this.power = nbt.getLong("powerTime");
tank.readFromNBT(nbt, "water");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
{
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length)
{
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
@ -195,26 +88,12 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
super.writeToNBT(nbt);
nbt.setLong("powerTime", power);
tank.writeToNBT(nbt, "water");
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
{
if(slots[i] != null)
{
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte)i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
@ -242,8 +121,10 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
if(!worldObj.isRemote) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
this.sendSmoke(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
}
this.subscribeToAllAround(Fluids.WATER, this);
@ -257,23 +138,29 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
boolean trigger = true;
if(isItemValid() && this.burnTime == 0)
{
if(isItemValid() && this.burnTime == 0) {
trigger = false;
}
if(trigger)
{
MachineCoal.updateBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, burnTime, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
if(trigger) {
MachineCoal.updateBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
}
generate();
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", power);
tank.writeToNBT(data, "tank");
this.networkPack(data, 15);
}
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
this.power = nbt.getLong("power");
this.tank.readFromNBT(nbt, "tank");
}
public void generate() {
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0 && burnTime <= 0)
@ -292,7 +179,7 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
if(burnTime > 0) {
burnTime--;
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND);
if(worldObj.getTotalWorldTime() % 20 == 0) this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND);
if(tank.getFill() > 0) {
tank.setFill(tank.getFill() - 1);
@ -307,8 +194,7 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
public boolean isItemValid() {
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0)
{
if(slots[1] != null && TileEntityFurnace.getItemBurnTime(slots[1]) > 0) {
return true;
}
@ -330,37 +216,16 @@ public class TileEntityMachineCoal extends TileEntityLoadedBase implements ISide
return this.maxPower;
}
@Override
public void setFluidFill(int i, FluidType type) {
if(type.name().equals(tank.getTankType().name()))
tank.setFill(i);
}
@Override
public int getFluidFill(FluidType type) {
return type.name().equals(this.tank.getTankType().name()) ? tank.getFill() : 0;
}
@Override
public int getMaxFluidFill(FluidType type) {
return type.name().equals(this.tank.getTankType().name()) ? tank.getMaxFill() : 0;
}
@Override
public void setFillForSync(int fill, int index) {
tank.setFill(fill);
}
@Override
public void setTypeForSync(FluidType type, int index) {
tank.setTankType(type);
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tank};
}
@Override
public FluidTank[] getSendingTanks() {
return this.getSmokeTanks();
}
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] { tank };

View File

@ -17,12 +17,12 @@ import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import com.hbm.util.EnumUtil;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardReceiver;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
@ -34,7 +34,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineCombustionEngine extends TileEntityMachineBase implements IEnergyGenerator, IFluidStandardReceiver, IControlReceiver, IGUIProvider {
public class TileEntityMachineCombustionEngine extends TileEntityMachinePolluting implements IEnergyGenerator, IFluidStandardTransceiver, IControlReceiver, IGUIProvider {
public boolean isOn = false;
public static long maxPower = 2_500_000;
@ -52,7 +52,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachineBase imp
public int tenth = 0;
public TileEntityMachineCombustionEngine() {
super(5);
super(5, 1_200);
this.tank = new FluidTank(Fluids.DIESEL, 24_000, 0);
}
@ -88,8 +88,8 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachineBase imp
fill -= toBurn;
if(worldObj.getTotalWorldTime() % 20 == 0) {
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * setting * 0.1F);
if(tank.getTankType().hasTrait(FT_Leaded.class)) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * setting * 0.1F);
this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * setting * 0.1F);
if(tank.getTankType().hasTrait(FT_Leaded.class)) this.pollute(PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * setting * 0.1F);
}
if(toBurn > 0) {
@ -109,6 +109,7 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachineBase imp
for(DirPos pos : getConPos()) {
this.sendPower(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.sendSmoke(pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
if(power > maxPower)
@ -275,6 +276,11 @@ public class TileEntityMachineCombustionEngine extends TileEntityMachineBase imp
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tank};
}
@Override
public FluidTank[] getSendingTanks() {
return this.getSmokeTanks();
}
AxisAlignedBB bb = null;

View File

@ -23,11 +23,11 @@ import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.tileentity.IConfigurableMachine;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import api.hbm.energy.IBatteryItem;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardReceiver;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
@ -38,7 +38,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineDiesel extends TileEntityMachineBase implements IEnergyGenerator, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver, IConfigurableMachine, IGUIProvider {
public class TileEntityMachineDiesel extends TileEntityMachinePolluting implements IEnergyGenerator, IFluidContainer, IFluidAcceptor, IFluidStandardTransceiver, IConfigurableMachine, IGUIProvider {
public long power;
public int soundCycle = 0;
@ -61,7 +61,7 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
private static final int[] slots_side = new int[] { 2 };
public TileEntityMachineDiesel() {
super(5);
super(5, 200);
tank = new FluidTank(Fluids.DIESEL, 4_000, 0);
}
@ -130,8 +130,10 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
if(!worldObj.isRemote) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
this.sendSmoke(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
}
//Tank Management
FluidType last = tank.getTankType();
@ -207,8 +209,8 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
if(tank.getFill() < 0)
tank.setFill(0);
PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 0.5F);
if(tank.getTankType().hasTrait(FT_Leaded.class)) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * 0.5F);
this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * 0.5F);
if(tank.getTankType().hasTrait(FT_Leaded.class)) this.pollute(PollutionType.HEAVYMETAL, PollutionHandler.HEAVY_METAL_PER_SECOND * 0.5F);
if(power + getHEFromFuel() <= powerCap) {
power += getHEFromFuel();
@ -318,4 +320,9 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIMachineDiesel(player.inventory, this);
}
@Override
public FluidTank[] getSendingTanks() {
return null;
}
}

View File

@ -18,7 +18,7 @@ import com.hbm.lib.Library;
import com.hbm.main.MainRegistry;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardTransceiver;
@ -33,7 +33,7 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineTurbineGas extends TileEntityMachineBase implements IFluidStandardTransceiver, IEnergyGenerator, IControlReceiver, IGUIProvider {
public class TileEntityMachineTurbineGas extends TileEntityMachinePolluting implements IFluidStandardTransceiver, IEnergyGenerator, IControlReceiver, IGUIProvider {
public long power;
public static final long maxPower = 1000000L;
@ -69,7 +69,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
//TODO particles from heat exchanger maybe? maybe in a future
public TileEntityMachineTurbineGas() {
super(2);
super(2, 5_000);
this.tanks = new FluidTank[4];
tanks[0] = new FluidTank(Fluids.GAS, 100000);
tanks[1] = new FluidTank(Fluids.LUBRICANT, 16000);
@ -137,6 +137,9 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
for(int i = 0; i < 2; i++) { //fuel and lube
this.trySubscribe(tanks[i].getTankType(), worldObj, xCoord - dir.offsetX * 2 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ, dir.getOpposite());
this.trySubscribe(tanks[i].getTankType(), worldObj, xCoord + dir.offsetX * 2 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ, dir);
this.sendSmoke(xCoord - dir.offsetX * 2 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ, dir.getOpposite());
this.sendSmoke(xCoord + dir.offsetX * 2 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 2 + rot.offsetZ, dir);
}
//water
this.trySubscribe(tanks[2].getTankType(), worldObj, xCoord - dir.offsetX * 2 + rot.offsetX * -4, yCoord, zCoord - dir.offsetZ * 2 + rot.offsetZ * -4, dir.getOpposite());
@ -300,7 +303,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
}
double consumption = fuelMaxCons.containsKey(tanks[0].getTankType()) ? fuelMaxCons.get(tanks[0].getTankType()) : 5D;
if(worldObj.getTotalWorldTime() % 20 == 0) PollutionHandler.incrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * (float) consumption * 0.25F);
if(worldObj.getTotalWorldTime() % 20 == 0 && tanks[0].getTankType() != Fluids.OXYHYDROGEN) this.pollute(PollutionType.SOOT, PollutionHandler.SOOT_PER_SECOND * (float) consumption * 0.25F);
makePower(consumption, throttle);
}
@ -533,7 +536,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] { tanks[3] };
return new FluidTank[] { tanks[3], smoke, smoke_leaded, smoke_poison };
}
@Override

View File

@ -26,7 +26,7 @@ import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.sound.AudioWrapper;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.tileentity.TileEntityMachinePolluting;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyGenerator;
@ -46,7 +46,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineTurbofan extends TileEntityMachineBase implements IEnergyGenerator, IFluidContainer, IFluidAcceptor, IFluidStandardTransceiver, IGUIProvider {
public class TileEntityMachineTurbofan extends TileEntityMachinePolluting implements IEnergyGenerator, IFluidContainer, IFluidAcceptor, IFluidStandardTransceiver, IGUIProvider {
public long power;
public static final long maxPower = 1_000_000;
@ -64,7 +64,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachineBase implements
private AudioWrapper audio;
public TileEntityMachineTurbofan() {
super(5);
super(5, 4_000);
tank = new FluidTank(Fluids.KEROSENE, 24000);
blood = new FluidTank(Fluids.BLOOD, 24000);
}
@ -173,6 +173,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachineBase implements
this.sendPower(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
if(this.blood.getFill() > 0) this.sendFluid(blood, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.sendSmoke(pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
if(burnValue > 0 && amountToBurn > 0) {
@ -474,7 +475,7 @@ public class TileEntityMachineTurbofan extends TileEntityMachineBase implements
@Override
public FluidTank[] getAllTanks() {
return new FluidTank[] { tank, blood };
return new FluidTank[] { tank, blood, smoke, smoke_leaded, smoke_poison };
}
@Override

View File

@ -23,6 +23,7 @@ import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.ParticleUtil;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyGenerator;
import api.hbm.fluid.IFluidStandardReceiver;
@ -95,15 +96,10 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
if(!worldObj.isRemote) {
this.sendPower(worldObj, xCoord + 2, yCoord, zCoord, Library.POS_X);
this.sendPower(worldObj, xCoord - 2, yCoord, zCoord, Library.NEG_X);
this.sendPower(worldObj, xCoord, yCoord, zCoord + 2, Library.POS_Z);
this.sendPower(worldObj, xCoord, yCoord, zCoord - 2, Library.NEG_Z);
this.trySubscribe(tank.getTankType(), worldObj, xCoord + 2, yCoord, zCoord, Library.POS_X);
this.trySubscribe(tank.getTankType(), worldObj, xCoord - 2, yCoord, zCoord, Library.NEG_X);
this.trySubscribe(tank.getTankType(), worldObj, xCoord, yCoord, zCoord + 2, Library.POS_Z);
this.trySubscribe(tank.getTankType(), worldObj, xCoord, yCoord, zCoord - 2, Library.NEG_Z);
for(DirPos pos : getConPos()) {
this.sendPower(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
tank.setType(3, slots);
tank.loadTank(1, 2, slots);
@ -221,7 +217,15 @@ public class TileEntityMachineGasFlare extends TileEntityMachineBase implements
}
}
}
}
public DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 2, yCoord, zCoord, Library.POS_X),
new DirPos(xCoord - 2, yCoord, zCoord, Library.NEG_X),
new DirPos(xCoord, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord, yCoord, zCoord - 2, Library.NEG_Z)
};
}
@Override