fix GTCE blocking mode

This commit is contained in:
Salomão
2021-05-16 23:28:05 -03:00
parent 1319ec79c9
commit 3f86884965
@@ -32,6 +32,9 @@ import com.google.common.collect.ImmutableSet;
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile; import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
import gregtech.api.block.machines.BlockMachine; import gregtech.api.block.machines.BlockMachine;
import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.MetaTileEntityHolder;
import gregtech.api.metatileentity.TieredMetaTileEntity;
import gregtech.api.metatileentity.WorkableTieredMetaTileEntity;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@@ -1097,7 +1100,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
if( this.isBlocking() ) if( this.isBlocking() )
{ {
IPhantomTile phantomTE = null; IPhantomTile phantomTE = null;
if (Loader.isModLoaded( "actuallyadditions" ) && te instanceof IPhantomTile ) if( Loader.isModLoaded( "actuallyadditions" ) && te instanceof IPhantomTile )
{ {
phantomTE = ( (IPhantomTile) te ); phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() ) if( phantomTE.hasBoundPosition() )
@@ -1110,12 +1113,17 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
} }
} }
} }
if( isGTCEblocked( te, s ) )
else if( Loader.isModLoaded( "gregtech" ) && te instanceof MetaTileEntityHolder )
{ {
visitedFaces.remove( s ); if( isGTCEblocked( te, s ) )
continue; {
visitedFaces.remove( s );
continue;
}
} }
if( invIsBlocked( ad ) )
else if( invIsBlocked( ad ) )
{ {
visitedFaces.remove( s ); visitedFaces.remove( s );
continue; continue;
@@ -1168,26 +1176,27 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() ); final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
if( ad != null ) if( ad != null )
{ {
if (Loader.isModLoaded( "actuallyadditions" )) if( Loader.isModLoaded( "actuallyadditions" ) && te instanceof IPhantomTile )
{ {
if( te instanceof IPhantomTile ) phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() )
{ {
phantomTE = ( (IPhantomTile) te ); TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() );
if( phantomTE.hasBoundPosition() && phantomTE.isBoundThingInRange()) if( phantom != null && !isGTCEblocked( phantom, s ) )
{ {
TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() ); allAreBusy = false;
if( phantom != null && isGTCEblocked( phantom, s ) ) break;
{
allAreBusy = false;
break;
}
} }
} }
} }
else if( !isGTCEblocked(te,s) )
else if( Loader.isModLoaded( "gregtech" ) && te instanceof MetaTileEntityHolder )
{ {
allAreBusy = false; if( !isGTCEblocked( te, s ) )
break; {
allAreBusy = false;
break;
}
} }
else if( !invIsBlocked( ad ) ) else if( !invIsBlocked( ad ) )
@@ -1204,12 +1213,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
boolean isGTCEblocked(TileEntity te, EnumFacing s) boolean isGTCEblocked(TileEntity te, EnumFacing s)
{ {
if( te.getBlockType().getRegistryName().getResourceDomain().equals( "gregtech" ) ) GTad = GTCEInventoryAdaptor.getAdaptor( te, s.getOpposite() );
{ return invIsBlockedGTCE( GTad );
GTad = GTCEInventoryAdaptor.getAdaptor( te, s.getOpposite() );
return invIsBlockedGTCE( GTad );
}
return false;
} }
private boolean sameGrid( final IGrid grid ) throws GridAccessException private boolean sameGrid( final IGrid grid ) throws GridAccessException