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
} }
} }
} }
else if( Loader.isModLoaded( "gregtech" ) && te instanceof MetaTileEntityHolder )
{
if( isGTCEblocked( te, s ) ) if( isGTCEblocked( te, s ) )
{ {
visitedFaces.remove( s ); visitedFaces.remove( s );
continue; continue;
} }
if( invIsBlocked( ad ) ) }
else if( invIsBlocked( ad ) )
{ {
visitedFaces.remove( s ); visitedFaces.remove( s );
continue; continue;
@@ -1168,27 +1176,28 @@ 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 ); phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() && phantomTE.isBoundThingInRange()) if( phantomTE.hasBoundPosition() )
{ {
TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() ); TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() );
if( phantom != null && isGTCEblocked( phantom, s ) ) if( phantom != null && !isGTCEblocked( phantom, s ) )
{ {
allAreBusy = false; allAreBusy = false;
break; break;
} }
} }
} }
}
else if( !isGTCEblocked(te,s) ) else if( Loader.isModLoaded( "gregtech" ) && te instanceof MetaTileEntityHolder )
{
if( !isGTCEblocked( te, s ) )
{ {
allAreBusy = false; allAreBusy = false;
break; break;
} }
}
else if( !invIsBlocked( ad ) ) else if( !invIsBlocked( ad ) )
{ {
@@ -1203,14 +1212,10 @@ 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() ); GTad = GTCEInventoryAdaptor.getAdaptor( te, s.getOpposite() );
return invIsBlockedGTCE( GTad ); return invIsBlockedGTCE( GTad );
} }
return false;
}
private boolean sameGrid( final IGrid grid ) throws GridAccessException private boolean sameGrid( final IGrid grid ) throws GridAccessException
{ {