fix NPE with ae2fc and blocking mode

This commit is contained in:
PrototypeTrousers
2022-03-25 23:27:02 -03:00
parent f30f334a23
commit 3b94e9420d
4 changed files with 63 additions and 52 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ aebuild=7
aegroup=appeng
aebasename=appliedenergistics2
extended=extended_life
extendedversion=v51e
extendedversion=v51f
#########################################################
# Versions #
#########################################################
+3
View File
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import appeng.helpers.NonBlockingItems;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;
@@ -238,6 +239,8 @@ public final class AppEng
AppEng.proxy.postInit();
AEConfig.instance().save();
NonBlockingItems.INSTANCE.init();
NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler );
NetworkHandler.init( "AE2" );
@@ -1154,38 +1154,37 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
}
}
if( this.isBlocking() )
InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
if( ad != null )
{
IPhantomTile phantomTE;
if( Loader.isModLoaded( "actuallyadditions" ) && te instanceof IPhantomTile )
if( this.isBlocking() )
{
phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() )
IPhantomTile phantomTE;
if( Loader.isModLoaded( "actuallyadditions" ) && te instanceof IPhantomTile )
{
TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() );
if( NonBlockingItems.INSTANCE.getMap().containsKey( phantom.getBlockType().getRegistryName().getResourceDomain() ) )
phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() )
{
if( isCustomInvBlocking( phantom, s ) )
TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() );
if( NonBlockingItems.INSTANCE.getMap().containsKey( w.getBlockState( phantomTE.getBoundPosition() ).getBlock().getRegistryName().getResourceDomain() ) )
{
visitedFaces.remove( s );
continue;
if( isCustomInvBlocking( phantom, s ) )
{
visitedFaces.remove( s );
continue;
}
}
}
}
}
else if( NonBlockingItems.INSTANCE.getMap().containsKey( te.getBlockType().getRegistryName().getResourceDomain() ) )
{
if( isCustomInvBlocking( te, s ) )
else if( NonBlockingItems.INSTANCE.getMap().containsKey( w.getBlockState( tile.getPos().offset( s ) ).getBlock().getRegistryName().getResourceDomain() ) )
{
visitedFaces.remove( s );
continue;
if( isCustomInvBlocking( te, s ) )
{
visitedFaces.remove( s );
continue;
}
}
}
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
if( ad != null )
{
if( invIsBlocked( ad ) )
else if( invIsBlocked( ad ) )
{
visitedFaces.remove( s );
continue;
@@ -1235,34 +1234,34 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) );
IPhantomTile phantomTE;
if( Loader.isModLoaded( "actuallyadditions" ) && Loader.isModLoaded( "gregtech" ) && te instanceof IPhantomTile )
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
if( ad != null )
{
phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() )
if( Loader.isModLoaded( "actuallyadditions" ) && Loader.isModLoaded( "gregtech" ) && te instanceof IPhantomTile )
{
TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() );
if( NonBlockingItems.INSTANCE.getMap().containsKey( phantom.getBlockType().getRegistryName().getResourceDomain() ) )
phantomTE = ( (IPhantomTile) te );
if( phantomTE.hasBoundPosition() )
{
if( !isCustomInvBlocking( phantom, s ) )
TileEntity phantom = w.getTileEntity( phantomTE.getBoundPosition() );
if( NonBlockingItems.INSTANCE.getMap().containsKey( w.getBlockState( phantomTE.getBoundPosition() ).getBlock().getRegistryName().getResourceDomain() ) )
{
allAreBusy = false;
break;
if( !isCustomInvBlocking( phantom, s ) )
{
allAreBusy = false;
break;
}
}
}
}
}
else if( NonBlockingItems.INSTANCE.getMap().containsKey( te.getBlockType().getRegistryName().getResourceDomain() ) )
{
if( !isCustomInvBlocking( te, s ) )
else if( NonBlockingItems.INSTANCE.getMap().containsKey( w.getBlockState( tile.getPos().offset( s ) ).getBlock().getRegistryName().getResourceDomain() ) )
{
allAreBusy = false;
break;
if( !isCustomInvBlocking( te, s ) )
{
allAreBusy = false;
break;
}
}
}
else
{
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( te, s.getOpposite() );
if( ad != null )
else
{
if( !invIsBlocked( ad ) )
{
@@ -61,7 +61,8 @@ public class NonBlockingItems
found = true;
ItemStack itemStack = metaItem2.getStackForm();
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) -> {
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) ->
{
intSet.add( itemStack.getItemDamage() );
return intSet;
} );
@@ -72,7 +73,8 @@ public class NonBlockingItems
if( !itemStack.isEmpty() )
{
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) -> {
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) ->
{
intSet.add( itemStack.getItemDamage() );
return intSet;
} );
@@ -86,13 +88,15 @@ public class NonBlockingItems
}
else if( ModItemMeta[0].equals( "ore" ) )
{
OreDictionary.getOres( ModItemMeta[1] ).forEach( itemStack -> {
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) -> {
intSet.add( itemStack.getItemDamage() );
return intSet;
} );
} );
OreDictionary.getOres( ModItemMeta[1] ).forEach( itemStack ->
{
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) ->
{
intSet.add( itemStack.getItemDamage() );
return intSet;
} );
} );
}
else
{
@@ -100,7 +104,8 @@ public class NonBlockingItems
if( !itemStack.isEmpty() )
{
NON_BLOCKING_MAP.get( modid ).putIfAbsent( itemStack.getItem(), new IntOpenHashSet() );
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) -> {
NON_BLOCKING_MAP.get( modid ).computeIfPresent( itemStack.getItem(), ( item, intSet ) ->
{
intSet.add( itemStack.getItemDamage() );
return intSet;
} );
@@ -120,4 +125,8 @@ public class NonBlockingItems
{
return NON_BLOCKING_MAP;
}
public void init()
{
}
}