allow GTCE blocking mode to work through phantom faces

This commit is contained in:
Salomão
2021-05-16 01:36:23 -03:00
parent 31a3afc18b
commit 1319ec79c9
2 changed files with 52 additions and 21 deletions
@@ -29,6 +29,7 @@ import appeng.util.*;
import appeng.util.inv.*;
import com.google.common.collect.ImmutableSet;
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
import gregtech.api.block.machines.BlockMachine;
import gregtech.api.metatileentity.MetaTileEntity;
import net.minecraft.block.Block;
@@ -1095,16 +1096,26 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
{
if( this.isBlocking() )
{
if( te.getBlockType().getRegistryName().getResourceDomain().equals( "gregtech" ) )
IPhantomTile phantomTE = null;
if (Loader.isModLoaded( "actuallyadditions" ) && te instanceof IPhantomTile )
{
GTad = GTCEInventoryAdaptor.getAdaptor( te, s.getOpposite() );
if( GTad != null && !invIsBlockedGTCE( GTad ) )
phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() )
{
visitedFaces.remove( s );
continue;
TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() );
if( phantom != null && isGTCEblocked( phantom, s ) )
{
visitedFaces.remove( s );
continue;
}
}
}
else if ( invIsBlocked( ad ) )
if( isGTCEblocked( te, s ) )
{
visitedFaces.remove( s );
continue;
}
if( invIsBlocked( ad ) )
{
visitedFaces.remove( s );
continue;
@@ -1152,19 +1163,33 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
for( final EnumFacing s : possibleDirections )
{
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
IPhantomTile phantomTE = null;
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
if( ad != null )
{
if( te.getBlockType().getRegistryName().getResourceDomain().equals( "gregtech" ) )
if (Loader.isModLoaded( "actuallyadditions" ))
{
GTad = GTCEInventoryAdaptor.getAdaptor( te, s.getOpposite() );
if( GTad != null && !invIsBlockedGTCE( GTad ) )
if( te instanceof IPhantomTile )
{
allAreBusy = false;
break;
phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() && phantomTE.isBoundThingInRange())
{
TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() );
if( phantom != null && isGTCEblocked( phantom, s ) )
{
allAreBusy = false;
break;
}
}
}
}
else if( !isGTCEblocked(te,s) )
{
allAreBusy = false;
break;
}
else if( !invIsBlocked( ad ) )
{
allAreBusy = false;
@@ -1177,6 +1202,16 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
return busy;
}
boolean isGTCEblocked(TileEntity te, EnumFacing s)
{
if( te.getBlockType().getRegistryName().getResourceDomain().equals( "gregtech" ) )
{
GTad = GTCEInventoryAdaptor.getAdaptor( te, s.getOpposite() );
return invIsBlockedGTCE( GTad );
}
return false;
}
private boolean sameGrid( final IGrid grid ) throws GridAccessException
{
return grid == this.gridProxy.getGrid();