From bef97b5e84095d4666d11de13cadfcc902628db9 Mon Sep 17 00:00:00 2001 From: HbmMods Date: Thu, 7 Sep 2017 18:50:09 +0200 Subject: [PATCH] Fixed pumpjack ports, retrofitted oil and gas ducts, added HD sledge tex --- assets/hbm/textures/gui/gui_planner_alt.png | Bin 1741 -> 1712 bytes assets/hbm/textures/gui/gui_turbofan.png | Bin 0 -> 2508 bytes .../hbm/textures/items/shimmer_sledge_hd.png | Bin 0 -> 435 bytes com/hbm/blocks/machine/MachineIGenerator.java | 8 +- com/hbm/blocks/machine/MachinePumpjack.java | 104 ++++- com/hbm/entity/projectile/EntityRubble.java | 2 +- com/hbm/lib/Library.java | 356 ++++++------------ com/hbm/lib/RefStrings.java | 2 +- com/hbm/tileentity/TileEntityGasDuct.java | 42 ++- .../tileentity/TileEntityGasDuctSolid.java | 8 +- .../tileentity/TileEntityMachinePumpjack.java | 31 +- com/hbm/tileentity/TileEntityOilDuct.java | 42 ++- .../tileentity/TileEntityOilDuctSolid.java | 10 +- 13 files changed, 311 insertions(+), 294 deletions(-) create mode 100644 assets/hbm/textures/gui/gui_turbofan.png create mode 100644 assets/hbm/textures/items/shimmer_sledge_hd.png diff --git a/assets/hbm/textures/gui/gui_planner_alt.png b/assets/hbm/textures/gui/gui_planner_alt.png index fde189a338096ec4743ef12096998fcdbff5c7fb..5fc1db9868ffa555d53691f7fde0ae9bc53a7491 100644 GIT binary patch delta 1325 zcmXX^dsNZ~6#nsxhj~(DDL$6c(aM?RbfRSsL62rS(M}mS?SUi9d_>wz%T3T7wM0km zXD=~v>zE#Vfu=6gfMbIri?D}AnUOMe>9oX*5al;?-9PVlzx#dXyH{l+vbjuRpNtF( ziOa2?8S%>+-U}2zu2WpG&Z)^9eL2bS(7Fc~c+xLtV+7Jih{K8Dxya|jJvS;{98xPn zvp_HVaM13m2JYP}R>)E}%|;X=&(X)pM+%bTmlt`lg5dJ}SEmE{ZN_P}xWsFG(sbao z4=on%)6MB;)99~nz{CgR!YJ=vtLmFK%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`YlA9ylT(=+3gG>nzsQ`Wr$WSGx6nwm{SI$FIc%6%yKXZ1|W z2+mgft<6}_$9{$(f8KVfAiTW(+D!*oU9$s?mo{ID@V-aiHUHEe$63)Q=;t5NUD5^o zk`IP!zj;5vt{xC&8LadWU)~*|R0-wCm4x*vTb~ae5St0M1;Ha-V5p$D+p=?WvOuJ) zG8~V6R!vi-Kj;}iGPUpreSBE!l9_sfS+QH>o~iqG37L<|G=@iqZ?Z9aN8BLN+agrC zEH!8~*-@`PzcUB{>)O5z>=^co3TIo~so2zM5wZ&jeJHlQZ(eXn*s^~`3cO@nrrW;t z1tldVOo=dOaG4Iu!DQp6goD;+Jh3~no%ZAm_>q=S~h53b~yL-lnaYuDL|j(!3$nh9GwJ#Lm~>VuTi*$X{t@aR+o>44PB2MxcYS14Re z{&UruTHK9~D+JxIbf&80vOZtz>kfQ(NEy^sx3kV1)?M_+#I{xDdQpWqkhlau2Y@|{ z2Iysf4QuTp+~22yolM7HaE-2<__yAO)^16*@4k0|;EOd(HC$Yf|MlqKrVJ9RtmkMe zJ9-Tg;nY$nJ&pJmk2nBZwV|9gBycDDz@Hzf&0tCDhiMWX{lDY>+0);^k5Czr)bD3- zxB1Zq(k>m;pOh;Kj8(T1%?dimf38UPN&nf?e!x`3}m4Fxz?IE zjvMcLAxGLlisLX08!IOY+h0113W5M=#)(%9{#VV;x7+POoOqAfs@Y0eq*96`NtjF~ zESJlYLmUR#vK4zxDTPuh9~W_6mh$!KJqJ~72Ca2z_lmLvcR*dI|PmD1+&W@{|ZI`}K- 5) { + if(this.ticksExisted > 2) { this.setDead(); if(!this.worldObj.isRemote) worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.1F, true); diff --git a/com/hbm/lib/Library.java b/com/hbm/lib/Library.java index 40f3b63fb..9546071bf 100644 --- a/com/hbm/lib/Library.java +++ b/com/hbm/lib/Library.java @@ -286,31 +286,9 @@ public class Library { world.getBlock(x, y, z) == ModBlocks.dummy_port_drill || world.getBlock(x, y, z) == ModBlocks.dummy_port_assembler || world.getBlock(x, y, z) == ModBlocks.dummy_port_chemplant || - world.getBlock(x, y, z) == ModBlocks.dummy_port_refinery) - { - return true; - } - return false; - } - - public static boolean checkOilConnectables(World world, int x, int y, int z) - { - TileEntity tileentity = world.getTileEntity(x, y, z); - if((tileentity != null && tileentity instanceof IOilDuct) || - world.getBlock(x, y, z) == ModBlocks.dummy_port_well || - world.getBlock(x, y, z) == ModBlocks.machine_refinery) - { - return true; - } - return false; - } - - public static boolean checkGasConnectables(World world, int x, int y, int z) - { - TileEntity tileentity = world.getTileEntity(x, y, z); - if((tileentity != null && tileentity instanceof IGasDuct) || - world.getBlock(x, y, z) == ModBlocks.dummy_port_well || - world.getBlock(x, y, z) == ModBlocks.dummy_port_flare) + world.getBlock(x, y, z) == ModBlocks.dummy_port_refinery || + world.getBlock(x, y, z) == ModBlocks.dummy_port_pumpjack || + world.getBlock(x, y, z) == ModBlocks.dummy_port_turbofan) { return true; } @@ -322,13 +300,23 @@ public class Library { TileEntity tileentity = world.getTileEntity(x, y, z); if(tileentity != null && tileentity instanceof TileEntityFluidDuct && ((TileEntityFluidDuct)tileentity).type == type) return true; + if(tileentity != null && tileentity instanceof TileEntityOilDuct && ((TileEntityOilDuct)tileentity).type == type) + return true; + if(tileentity != null && tileentity instanceof TileEntityGasDuct && ((TileEntityGasDuct)tileentity).type == type) + return true; + if(tileentity != null && tileentity instanceof TileEntityOilDuctSolid && ((TileEntityOilDuctSolid)tileentity).type == type) + return true; + if(tileentity != null && tileentity instanceof TileEntityGasDuctSolid && ((TileEntityGasDuctSolid)tileentity).type == type) + return true; if((tileentity != null && (tileentity instanceof IFluidAcceptor || tileentity instanceof IFluidSource)) || world.getBlock(x, y, z) == ModBlocks.dummy_port_well || world.getBlock(x, y, z) == ModBlocks.dummy_port_flare || world.getBlock(x, y, z) == ModBlocks.dummy_port_chemplant || world.getBlock(x, y, z) == ModBlocks.dummy_port_fluidtank || - world.getBlock(x, y, z) == ModBlocks.dummy_port_refinery) + world.getBlock(x, y, z) == ModBlocks.dummy_port_refinery || + world.getBlock(x, y, z) == ModBlocks.dummy_port_pumpjack || + world.getBlock(x, y, z) == ModBlocks.dummy_port_turbofan) { return true; } @@ -348,32 +336,6 @@ public class Library { return false; } - public static boolean checkOilUnionListForOil(List list, IOilSource that) { - - for(UnionOfTileEntitiesAndBooleansForOil union : list) - { - if(union.source == that) - { - return true; - } - } - - return false; - } - - public static boolean checkGasUnionListForGas(List list, IGasSource that) { - - for(UnionOfTileEntitiesAndBooleansForGas union : list) - { - if(union.source == that) - { - return true; - } - } - - return false; - } - public static boolean checkUnionListForFluids(List list, IFluidSource that) { for(UnionOfTileEntitiesAndBooleansForFluids union : list) @@ -869,6 +831,11 @@ public class Library { { tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ); } + //Pumpjack + if(block == ModBlocks.dummy_port_pumpjack) + { + tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ); + } if(tileentity instanceof IConductor) { @@ -983,195 +950,6 @@ public class Library { } } - public static void transmitOil(int x, int y, int z, boolean newTact, IOilSource that, World worldObj) { - Block block = worldObj.getBlock(x, y, z); - TileEntity tileentity = worldObj.getTileEntity(x, y, z); - - if(tileentity instanceof IOilDuct) - { - if(tileentity instanceof TileEntityOilDuct) - { - if(Library.checkOilUnionListForOil(((TileEntityOilDuct)tileentity).uoteab, that)) - { - for(int i = 0; i < ((TileEntityOilDuct)tileentity).uoteab.size(); i++) - { - if(((TileEntityOilDuct)tileentity).uoteab.get(i).source == that) - { - if(((TileEntityOilDuct)tileentity).uoteab.get(i).ticked != newTact) - { - ((TileEntityOilDuct)tileentity).uoteab.get(i).ticked = newTact; - that.fill(x, y + 1, z, that.getTact()); - that.fill(x, y - 1, z, that.getTact()); - that.fill(x - 1, y, z, that.getTact()); - that.fill(x + 1, y, z, that.getTact()); - that.fill(x, y, z - 1, that.getTact()); - that.fill(x, y, z + 1, that.getTact()); - } - } - } - } else { - ((TileEntityOilDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForOil(that, newTact)); - } - } - if(tileentity instanceof TileEntityOilDuctSolid) - { - if(Library.checkOilUnionListForOil(((TileEntityOilDuctSolid)tileentity).uoteab, that)) - { - for(int i = 0; i < ((TileEntityOilDuctSolid)tileentity).uoteab.size(); i++) - { - if(((TileEntityOilDuctSolid)tileentity).uoteab.get(i).source == that) - { - if(((TileEntityOilDuctSolid)tileentity).uoteab.get(i).ticked != newTact) - { - ((TileEntityOilDuctSolid)tileentity).uoteab.get(i).ticked = newTact; - that.fill(x, y + 1, z, that.getTact()); - that.fill(x, y - 1, z, that.getTact()); - that.fill(x - 1, y, z, that.getTact()); - that.fill(x + 1, y, z, that.getTact()); - that.fill(x, y, z - 1, that.getTact()); - that.fill(x, y, z + 1, that.getTact()); - } - } - } - } else { - ((TileEntityOilDuctSolid)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForOil(that, newTact)); - } - } - } - - if(tileentity instanceof IOilAcceptor && newTact) - { - that.getList().add((IOilAcceptor)tileentity); - } - - if(!newTact) - { - int size = that.getList().size(); - if(size > 0) - { - int part = that.getSFill() / size; - for(IOilAcceptor consume : that.getList()) - { - if(consume.getFill() < consume.getMaxFill()) - { - if(consume.getMaxFill() - consume.getFill() >= part) - { - that.setSFill(that.getSFill()-part); - consume.setFill(consume.getFill() + part); - } else { - that.setSFill(that.getSFill() - (consume.getMaxFill() - consume.getFill())); - consume.setFill(consume.getMaxFill()); - } - } - } - } - that.clearList(); - } - } - - public static void transmitGas(int x, int y, int z, boolean newTact, IGasSource that, World worldObj) { - Block block = worldObj.getBlock(x, y, z); - TileEntity tileentity = worldObj.getTileEntity(x, y, z); - - if(block == ModBlocks.dummy_port_flare && worldObj.getBlock(x + 1, y, z) == ModBlocks.machine_flare) - { - tileentity = worldObj.getTileEntity(x + 1, y, z); - } - if(block == ModBlocks.dummy_port_flare && worldObj.getBlock(x - 1, y, z) == ModBlocks.machine_flare) - { - tileentity = worldObj.getTileEntity(x - 1, y, z); - } - if(block == ModBlocks.dummy_port_flare && worldObj.getBlock(x, y, z + 1) == ModBlocks.machine_flare) - { - tileentity = worldObj.getTileEntity(x, y, z + 1); - } - if(block == ModBlocks.dummy_port_flare && worldObj.getBlock(x, y, z - 1) == ModBlocks.machine_flare) - { - tileentity = worldObj.getTileEntity(x, y, z - 1); - } - - if(tileentity instanceof IGasDuct) - { - if(tileentity instanceof TileEntityGasDuct) - { - if(Library.checkGasUnionListForGas(((TileEntityGasDuct)tileentity).uoteab, that)) - { - for(int i = 0; i < ((TileEntityGasDuct)tileentity).uoteab.size(); i++) - { - if(((TileEntityGasDuct)tileentity).uoteab.get(i).source == that) - { - if(((TileEntityGasDuct)tileentity).uoteab.get(i).ticked != newTact) - { - ((TileEntityGasDuct)tileentity).uoteab.get(i).ticked = newTact; - that.fillGas(x, y + 1, z, that.getTact()); - that.fillGas(x, y - 1, z, that.getTact()); - that.fillGas(x - 1, y, z, that.getTact()); - that.fillGas(x + 1, y, z, that.getTact()); - that.fillGas(x, y, z - 1, that.getTact()); - that.fillGas(x, y, z + 1, that.getTact()); - } - } - } - } else { - ((TileEntityGasDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForGas(that, newTact)); - } - } - if(tileentity instanceof TileEntityGasDuctSolid) - { - if(Library.checkGasUnionListForGas(((TileEntityGasDuctSolid)tileentity).uoteab, that)) - { - for(int i = 0; i < ((TileEntityGasDuctSolid)tileentity).uoteab.size(); i++) - { - if(((TileEntityGasDuctSolid)tileentity).uoteab.get(i).source == that) - { - if(((TileEntityGasDuctSolid)tileentity).uoteab.get(i).ticked != newTact) - { - ((TileEntityGasDuctSolid)tileentity).uoteab.get(i).ticked = newTact; - that.fillGas(x, y + 1, z, that.getTact()); - that.fillGas(x, y - 1, z, that.getTact()); - that.fillGas(x - 1, y, z, that.getTact()); - that.fillGas(x + 1, y, z, that.getTact()); - that.fillGas(x, y, z - 1, that.getTact()); - that.fillGas(x, y, z + 1, that.getTact()); - } - } - } - } else { - ((TileEntityGasDuctSolid)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForGas(that, newTact)); - } - } - } - - if(tileentity instanceof IGasAcceptor && newTact) - { - that.getGasList().add((IGasAcceptor)tileentity); - } - - if(!newTact) - { - int size = that.getGasList().size(); - if(size > 0) - { - int part = that.getGasFill() / size; - for(IGasAcceptor consume : that.getGasList()) - { - if(consume.getGasFill() < consume.getMaxGasFill()) - { - if(consume.getMaxGasFill() - consume.getGasFill() >= part) - { - that.setGasFill(that.getGasFill()-part); - consume.setGasFill(consume.getGasFill() + part); - } else { - that.setGasFill(that.getGasFill() - (consume.getMaxGasFill() - consume.getGasFill())); - consume.setGasFill(consume.getMaxGasFill()); - } - } - } - } - that.clearGasList(); - } - } - public static void transmitFluid(int x, int y, int z, boolean newTact, IFluidSource that, World worldObj, FluidType type) { Block block = worldObj.getBlock(x, y, z); TileEntity tileentity = worldObj.getTileEntity(x, y, z); @@ -1226,6 +1004,102 @@ public class Library { ((TileEntityFluidDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); } } + if(tileentity instanceof TileEntityGasDuct && ((TileEntityGasDuct)tileentity).type.name().equals(type.name())) + { + if(Library.checkUnionListForFluids(((TileEntityGasDuct)tileentity).uoteab, that)) + { + for(int i = 0; i < ((TileEntityGasDuct)tileentity).uoteab.size(); i++) + { + if(((TileEntityGasDuct)tileentity).uoteab.get(i).source == that) + { + if(((TileEntityGasDuct)tileentity).uoteab.get(i).ticked != newTact) + { + ((TileEntityGasDuct)tileentity).uoteab.get(i).ticked = newTact; + that.fillFluid(x, y + 1, z, that.getTact(), type); + that.fillFluid(x, y - 1, z, that.getTact(), type); + that.fillFluid(x - 1, y, z, that.getTact(), type); + that.fillFluid(x + 1, y, z, that.getTact(), type); + that.fillFluid(x, y, z - 1, that.getTact(), type); + that.fillFluid(x, y, z + 1, that.getTact(), type); + } + } + } + } else { + ((TileEntityGasDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); + } + } + if(tileentity instanceof TileEntityOilDuct && ((TileEntityOilDuct)tileentity).type.name().equals(type.name())) + { + if(Library.checkUnionListForFluids(((TileEntityOilDuct)tileentity).uoteab, that)) + { + for(int i = 0; i < ((TileEntityOilDuct)tileentity).uoteab.size(); i++) + { + if(((TileEntityOilDuct)tileentity).uoteab.get(i).source == that) + { + if(((TileEntityOilDuct)tileentity).uoteab.get(i).ticked != newTact) + { + ((TileEntityOilDuct)tileentity).uoteab.get(i).ticked = newTact; + that.fillFluid(x, y + 1, z, that.getTact(), type); + that.fillFluid(x, y - 1, z, that.getTact(), type); + that.fillFluid(x - 1, y, z, that.getTact(), type); + that.fillFluid(x + 1, y, z, that.getTact(), type); + that.fillFluid(x, y, z - 1, that.getTact(), type); + that.fillFluid(x, y, z + 1, that.getTact(), type); + } + } + } + } else { + ((TileEntityOilDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); + } + } + if(tileentity instanceof TileEntityGasDuctSolid && ((TileEntityGasDuctSolid)tileentity).type.name().equals(type.name())) + { + if(Library.checkUnionListForFluids(((TileEntityGasDuctSolid)tileentity).uoteab, that)) + { + for(int i = 0; i < ((TileEntityGasDuctSolid)tileentity).uoteab.size(); i++) + { + if(((TileEntityGasDuctSolid)tileentity).uoteab.get(i).source == that) + { + if(((TileEntityGasDuctSolid)tileentity).uoteab.get(i).ticked != newTact) + { + ((TileEntityGasDuctSolid)tileentity).uoteab.get(i).ticked = newTact; + that.fillFluid(x, y + 1, z, that.getTact(), type); + that.fillFluid(x, y - 1, z, that.getTact(), type); + that.fillFluid(x - 1, y, z, that.getTact(), type); + that.fillFluid(x + 1, y, z, that.getTact(), type); + that.fillFluid(x, y, z - 1, that.getTact(), type); + that.fillFluid(x, y, z + 1, that.getTact(), type); + } + } + } + } else { + ((TileEntityGasDuctSolid)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); + } + } + if(tileentity instanceof TileEntityOilDuctSolid && ((TileEntityOilDuctSolid)tileentity).type.name().equals(type.name())) + { + if(Library.checkUnionListForFluids(((TileEntityOilDuctSolid)tileentity).uoteab, that)) + { + for(int i = 0; i < ((TileEntityOilDuctSolid)tileentity).uoteab.size(); i++) + { + if(((TileEntityOilDuctSolid)tileentity).uoteab.get(i).source == that) + { + if(((TileEntityOilDuctSolid)tileentity).uoteab.get(i).ticked != newTact) + { + ((TileEntityOilDuctSolid)tileentity).uoteab.get(i).ticked = newTact; + that.fillFluid(x, y + 1, z, that.getTact(), type); + that.fillFluid(x, y - 1, z, that.getTact(), type); + that.fillFluid(x - 1, y, z, that.getTact(), type); + that.fillFluid(x + 1, y, z, that.getTact(), type); + that.fillFluid(x, y, z - 1, that.getTact(), type); + that.fillFluid(x, y, z + 1, that.getTact(), type); + } + } + } + } else { + ((TileEntityOilDuctSolid)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact)); + } + } } if(tileentity instanceof IFluidAcceptor && newTact && !(tileentity instanceof TileEntityMachineFluidTank && ((TileEntityMachineFluidTank)tileentity).dna())) diff --git a/com/hbm/lib/RefStrings.java b/com/hbm/lib/RefStrings.java index 697aec0bb..9b6c71e2d 100644 --- a/com/hbm/lib/RefStrings.java +++ b/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.26 BETA (Astatine-Actinium-X02)"; + public static final String VERSION = "1.0.26 BETA (Bromine-Lanthanium-X02)"; //HBM's Beta Naming Convention: //V T (X-Y-Z) //V -> next release version diff --git a/com/hbm/tileentity/TileEntityGasDuct.java b/com/hbm/tileentity/TileEntityGasDuct.java index be23f9a52..fa226cd5b 100644 --- a/com/hbm/tileentity/TileEntityGasDuct.java +++ b/com/hbm/tileentity/TileEntityGasDuct.java @@ -1,22 +1,29 @@ package com.hbm.tileentity; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids; import com.hbm.calc.UnionOfTileEntitiesAndBooleansForGas; +import com.hbm.handler.FluidTypeHandler.FluidType; +import com.hbm.interfaces.IFluidDuct; import com.hbm.interfaces.IGasDuct; import com.hbm.lib.Library; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.TEFluidPipePacket; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityGasDuct extends TileEntity implements IGasDuct { +public class TileEntityGasDuct extends TileEntity implements IFluidDuct { public ForgeDirection[] connections = new ForgeDirection[6]; - - public List uoteab = new ArrayList(); + public FluidType type = FluidType.GAS; + public List uoteab = new ArrayList(); public TileEntityGasDuct() { @@ -24,28 +31,45 @@ public class TileEntityGasDuct extends TileEntity implements IGasDuct { @Override public void updateEntity() { + + if(!worldObj.isRemote) + PacketDispatcher.wrapper.sendToAll(new TEFluidPipePacket(xCoord, yCoord, zCoord, type)); + this.updateConnections(); } public void updateConnections() { - if(Library.checkGasConnectables(this.worldObj, xCoord, yCoord + 1, zCoord)) connections[0] = ForgeDirection.UP; + if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord + 1, zCoord, type)) connections[0] = ForgeDirection.UP; else connections[0] = null; - if(Library.checkGasConnectables(this.worldObj, xCoord, yCoord - 1, zCoord)) connections[1] = ForgeDirection.DOWN; + if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord - 1, zCoord, type)) connections[1] = ForgeDirection.DOWN; else connections[1] = null; - if(Library.checkGasConnectables(this.worldObj, xCoord, yCoord, zCoord - 1)) connections[2] = ForgeDirection.NORTH; + if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord, zCoord - 1, type)) connections[2] = ForgeDirection.NORTH; else connections[2] = null; - if(Library.checkGasConnectables(this.worldObj, xCoord + 1, yCoord, zCoord)) connections[3] = ForgeDirection.EAST; + if(Library.checkFluidConnectables(this.worldObj, xCoord + 1, yCoord, zCoord, type)) connections[3] = ForgeDirection.EAST; else connections[3] = null; - if(Library.checkGasConnectables(this.worldObj, xCoord, yCoord, zCoord + 1)) connections[4] = ForgeDirection.SOUTH; + if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord, zCoord + 1, type)) connections[4] = ForgeDirection.SOUTH; else connections[4] = null; - if(Library.checkGasConnectables(this.worldObj, xCoord - 1, yCoord, zCoord)) connections[5] = ForgeDirection.WEST; + if(Library.checkFluidConnectables(this.worldObj, xCoord - 1, yCoord, zCoord, type)) connections[5] = ForgeDirection.WEST; else connections[5] = null; } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + type = FluidType.GAS; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + } @Override @SideOnly(Side.CLIENT) diff --git a/com/hbm/tileentity/TileEntityGasDuctSolid.java b/com/hbm/tileentity/TileEntityGasDuctSolid.java index 5b82052b2..01cf67f65 100644 --- a/com/hbm/tileentity/TileEntityGasDuctSolid.java +++ b/com/hbm/tileentity/TileEntityGasDuctSolid.java @@ -3,12 +3,16 @@ package com.hbm.tileentity; import java.util.ArrayList; import java.util.List; +import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids; import com.hbm.calc.UnionOfTileEntitiesAndBooleansForGas; +import com.hbm.handler.FluidTypeHandler.FluidType; +import com.hbm.interfaces.IFluidDuct; import com.hbm.interfaces.IGasDuct; import net.minecraft.tileentity.TileEntity; -public class TileEntityGasDuctSolid extends TileEntity implements IGasDuct { +public class TileEntityGasDuctSolid extends TileEntity implements IFluidDuct { - public List uoteab = new ArrayList(); + public FluidType type = FluidType.GAS; + public List uoteab = new ArrayList(); } diff --git a/com/hbm/tileentity/TileEntityMachinePumpjack.java b/com/hbm/tileentity/TileEntityMachinePumpjack.java index 9a90dc695..7bc7cebae 100644 --- a/com/hbm/tileentity/TileEntityMachinePumpjack.java +++ b/com/hbm/tileentity/TileEntityMachinePumpjack.java @@ -466,10 +466,33 @@ public class TileEntityMachinePumpjack extends TileEntity implements ISidedInven @Override public void fillFluidInit(FluidType type) { - fillFluid(this.xCoord - 2, this.yCoord, this.zCoord, getTact(), type); - fillFluid(this.xCoord + 2, this.yCoord, this.zCoord, getTact(), type); - fillFluid(this.xCoord, this.yCoord, this.zCoord - 2, getTact(), type); - fillFluid(this.xCoord, this.yCoord, this.zCoord + 2, getTact(), type); + + int i = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + + if(i == 5) { + fillFluid(this.xCoord - 2, this.yCoord, this.zCoord + 2, getTact(), type); + fillFluid(this.xCoord - 2, this.yCoord, this.zCoord - 2, getTact(), type); + fillFluid(this.xCoord - 3, this.yCoord, this.zCoord + 2, getTact(), type); + fillFluid(this.xCoord - 3, this.yCoord, this.zCoord - 2, getTact(), type); + } + if(i == 3) { + fillFluid(this.xCoord + 2, this.yCoord, this.zCoord - 2, getTact(), type); + fillFluid(this.xCoord - 2, this.yCoord, this.zCoord - 2, getTact(), type); + fillFluid(this.xCoord + 2, this.yCoord, this.zCoord - 2, getTact(), type); + fillFluid(this.xCoord - 2, this.yCoord, this.zCoord - 2, getTact(), type); + } + if(i == 4) { + fillFluid(this.xCoord + 2, this.yCoord, this.zCoord + 2, getTact(), type); + fillFluid(this.xCoord + 2, this.yCoord, this.zCoord - 2, getTact(), type); + fillFluid(this.xCoord + 3, this.yCoord, this.zCoord + 2, getTact(), type); + fillFluid(this.xCoord + 3, this.yCoord, this.zCoord - 2, getTact(), type); + } + if(i == 2) { + fillFluid(this.xCoord + 2, this.yCoord, this.zCoord + 2, getTact(), type); + fillFluid(this.xCoord - 2, this.yCoord, this.zCoord + 2, getTact(), type); + fillFluid(this.xCoord + 2, this.yCoord, this.zCoord + 2, getTact(), type); + fillFluid(this.xCoord - 2, this.yCoord, this.zCoord + 2, getTact(), type); + } } @Override diff --git a/com/hbm/tileentity/TileEntityOilDuct.java b/com/hbm/tileentity/TileEntityOilDuct.java index 27db97e0c..02994dc1d 100644 --- a/com/hbm/tileentity/TileEntityOilDuct.java +++ b/com/hbm/tileentity/TileEntityOilDuct.java @@ -1,22 +1,29 @@ package com.hbm.tileentity; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids; import com.hbm.calc.UnionOfTileEntitiesAndBooleansForOil; +import com.hbm.handler.FluidTypeHandler.FluidType; +import com.hbm.interfaces.IFluidDuct; import com.hbm.interfaces.IOilDuct; import com.hbm.lib.Library; +import com.hbm.packet.PacketDispatcher; +import com.hbm.packet.TEFluidPipePacket; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityOilDuct extends TileEntity implements IOilDuct { +public class TileEntityOilDuct extends TileEntity implements IFluidDuct { public ForgeDirection[] connections = new ForgeDirection[6]; - - public List uoteab = new ArrayList(); + public FluidType type = FluidType.OIL; + public List uoteab = new ArrayList(); public TileEntityOilDuct() { @@ -24,28 +31,45 @@ public class TileEntityOilDuct extends TileEntity implements IOilDuct { @Override public void updateEntity() { + + if(!worldObj.isRemote) + PacketDispatcher.wrapper.sendToAll(new TEFluidPipePacket(xCoord, yCoord, zCoord, type)); + this.updateConnections(); } public void updateConnections() { - if(Library.checkOilConnectables(this.worldObj, xCoord, yCoord + 1, zCoord)) connections[0] = ForgeDirection.UP; + if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord + 1, zCoord, type)) connections[0] = ForgeDirection.UP; else connections[0] = null; - if(Library.checkOilConnectables(this.worldObj, xCoord, yCoord - 1, zCoord)) connections[1] = ForgeDirection.DOWN; + if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord - 1, zCoord, type)) connections[1] = ForgeDirection.DOWN; else connections[1] = null; - if(Library.checkOilConnectables(this.worldObj, xCoord, yCoord, zCoord - 1)) connections[2] = ForgeDirection.NORTH; + if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord, zCoord - 1, type)) connections[2] = ForgeDirection.NORTH; else connections[2] = null; - if(Library.checkOilConnectables(this.worldObj, xCoord + 1, yCoord, zCoord)) connections[3] = ForgeDirection.EAST; + if(Library.checkFluidConnectables(this.worldObj, xCoord + 1, yCoord, zCoord, type)) connections[3] = ForgeDirection.EAST; else connections[3] = null; - if(Library.checkOilConnectables(this.worldObj, xCoord, yCoord, zCoord + 1)) connections[4] = ForgeDirection.SOUTH; + if(Library.checkFluidConnectables(this.worldObj, xCoord, yCoord, zCoord + 1, type)) connections[4] = ForgeDirection.SOUTH; else connections[4] = null; - if(Library.checkOilConnectables(this.worldObj, xCoord - 1, yCoord, zCoord)) connections[5] = ForgeDirection.WEST; + if(Library.checkFluidConnectables(this.worldObj, xCoord - 1, yCoord, zCoord, type)) connections[5] = ForgeDirection.WEST; else connections[5] = null; } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + type = FluidType.OIL; + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + } @Override @SideOnly(Side.CLIENT) diff --git a/com/hbm/tileentity/TileEntityOilDuctSolid.java b/com/hbm/tileentity/TileEntityOilDuctSolid.java index 17fd647a0..aed0ee453 100644 --- a/com/hbm/tileentity/TileEntityOilDuctSolid.java +++ b/com/hbm/tileentity/TileEntityOilDuctSolid.java @@ -3,13 +3,17 @@ package com.hbm.tileentity; import java.util.ArrayList; import java.util.List; +import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids; import com.hbm.calc.UnionOfTileEntitiesAndBooleansForOil; +import com.hbm.handler.FluidTypeHandler.FluidType; +import com.hbm.interfaces.IFluidDuct; import com.hbm.interfaces.IOilDuct; import net.minecraft.tileentity.TileEntity; -public class TileEntityOilDuctSolid extends TileEntity implements IOilDuct { - - public List uoteab = new ArrayList(); +public class TileEntityOilDuctSolid extends TileEntity implements IFluidDuct { + + public FluidType type = FluidType.OIL; + public List uoteab = new ArrayList(); }