17
17
import sunsetsatellite .catalyst .fluids .util .FluidStack ;
18
18
19
19
import java .util .*;
20
- import java .util .stream .Collectors ;
21
20
22
21
public class TileEntityFluidContainer extends TileEntity
23
22
implements IFluidInventory , IFluidTransfer {
@@ -31,12 +30,12 @@ public class TileEntityFluidContainer extends TileEntity
31
30
32
31
public int transferSpeed = 20 ;
33
32
34
- public HashMap <Direction , Connection > connections = new HashMap <>();
33
+ public HashMap <Direction , Connection > fluidConnections = new HashMap <>();
35
34
public HashMap <Direction , Integer > activeFluidSlots = new HashMap <>();
36
35
37
36
public TileEntityFluidContainer (){
38
37
for (Direction dir : Direction .values ()) {
39
- connections .put (dir , Connection .NONE );
38
+ fluidConnections .put (dir , Connection .NONE );
40
39
activeFluidSlots .put (dir ,0 );
41
40
}
42
41
for (FluidStack ignored : fluidContents ) {
@@ -45,7 +44,7 @@ public TileEntityFluidContainer(){
45
44
}
46
45
47
46
public void take (@ NotNull FluidStack fluidStack , Direction dir ){
48
- if (connections .get (dir ) == Connection .INPUT || connections .get (dir ) == Connection .BOTH ){
47
+ if (fluidConnections .get (dir ) == Connection .INPUT || fluidConnections .get (dir ) == Connection .BOTH ){
49
48
TileEntity tile = dir .getTileEntity (worldObj ,this );
50
49
if (tile instanceof IFluidInventory && tile instanceof IFluidTransfer ){
51
50
IFluidInventory fluidInv = ((IFluidInventory ) tile );
@@ -71,7 +70,7 @@ public void take(@NotNull FluidStack fluidStack, Direction dir){
71
70
public void give (Direction dir ){
72
71
int slot = activeFluidSlots .get (dir );
73
72
FluidStack fluidStack = fluidContents [slot ];
74
- if (connections .get (dir ) == Connection .OUTPUT || connections .get (dir ) == Connection .BOTH ){
73
+ if (fluidConnections .get (dir ) == Connection .OUTPUT || fluidConnections .get (dir ) == Connection .BOTH ){
75
74
TileEntity tile = dir .getTileEntity (worldObj ,this );
76
75
if (tile instanceof IFluidInventory && tile instanceof IFluidTransfer ) {
77
76
IFluidInventory fluidInv = ((IFluidInventory ) tile );
@@ -135,7 +134,7 @@ public boolean canInsertFluid(int slot,FluidStack fluidStack){
135
134
136
135
@ Override
137
136
public Connection getConnection (Direction dir ) {
138
- return connections .get (dir );
137
+ return fluidConnections .get (dir );
139
138
}
140
139
141
140
public String getInvName () {
@@ -158,7 +157,7 @@ public void readFromNBT(CompoundTag CompoundTag1) {
158
157
159
158
CompoundTag connectionsTag = CompoundTag1 .getCompound ("fluidConnections" );
160
159
for (Object con : connectionsTag .getValues ()) {
161
- connections .replace (Direction .values ()[Integer .parseInt (((IntTag )con ).getTagName ())],Connection .values ()[((IntTag )con ).getValue ()]);
160
+ fluidConnections .replace (Direction .values ()[Integer .parseInt (((IntTag )con ).getTagName ())],Connection .values ()[((IntTag )con ).getValue ()]);
162
161
}
163
162
164
163
CompoundTag activeFluidSlotsTag = CompoundTag1 .getCompound ("fluidActiveSlots" );
@@ -199,7 +198,7 @@ public void writeToNBT(CompoundTag CompoundTag1) {
199
198
Direction dir = entry .getKey ();
200
199
activeFluidSlotsTag .putInt (String .valueOf (dir .ordinal ()),entry .getValue ());
201
200
}
202
- for (Map .Entry <Direction , Connection > entry : connections .entrySet ()) {
201
+ for (Map .Entry <Direction , Connection > entry : fluidConnections .entrySet ()) {
203
202
Direction dir = entry .getKey ();
204
203
Connection con = entry .getValue ();
205
204
connectionsTag .putInt (String .valueOf (dir .ordinal ()),con .ordinal ());
@@ -343,14 +342,14 @@ public int getActiveFluidSlot(Direction dir) {
343
342
344
343
public void moveFluids (Direction dir , TileEntityFluidPipe tile ) {
345
344
Integer activeSlot = activeFluidSlots .get (dir );
346
- if (connections .get (dir ) == Connection .BOTH || connections .get (dir ) == Connection .OUTPUT ){
345
+ if (fluidConnections .get (dir ) == Connection .BOTH || fluidConnections .get (dir ) == Connection .OUTPUT ){
347
346
if (getFluidInSlot (activeSlot ) != null ){
348
347
give (dir );
349
348
}
350
349
/*if(getFluidInSlot(activeSlot) != null && (tile.getFluidInSlot(tile.getActiveFluidSlot(dir.getOpposite())) == null || (tile.getFluidInSlot(tile.getActiveFluidSlot(dir.getOpposite())) != null && tile.acceptedFluids.get(activeSlot).contains(getFluidInSlot(activeSlot).getLiquid())))){
351
350
give(dir);
352
351
}*/
353
- } else if (connections .get (dir ) == Connection .BOTH || connections .get (dir ) == Connection .INPUT ){
352
+ } else if (fluidConnections .get (dir ) == Connection .BOTH || fluidConnections .get (dir ) == Connection .INPUT ){
354
353
if (tile .getFluidInSlot (0 ) != null ){
355
354
take (tile .getFluidInSlot (0 ),dir );
356
355
}
0 commit comments