Java Code Examples for net.minecraft.tileentity.TileEntity#canUpdate()

The following examples show how to use net.minecraft.tileentity.TileEntity#canUpdate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GT_MetaTileEntity_WorldAccelerator.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
private boolean isTEBlackListed( TileEntity pTile )
{
  if( pTile == null ) {
      return true; // Obvious
  }
  if( !pTile.canUpdate() ) {
      return true; // Skip if TE can't update at all
  }
  if( pTile.isInvalid() ) {
      return true; // Obvious
  }   
  
  String tSimpleClassName = pTile.getClass().getSimpleName().toLowerCase();
  String tCanonicalName = pTile.getClass().getCanonicalName().toLowerCase();
  if( tSimpleClassName.contains( "conduit" ) || tSimpleClassName.contains( "wire" ) || tSimpleClassName.contains( "cable" ) ) {
      return true;
  }
  if( tCanonicalName.contains( "appeng" ) || tCanonicalName.contains( "gregtech" ) ) // Don't accelerate ANY gregtech machines
  {
      return true;
  }
  if (tSimpleClassName.contains( "solar" )|| tCanonicalName.contains( "solar" ))// Don't accelerate ANY solars
  {	
  	return true;
  }
  	
  for( String tS : MainRegistry.CoreConfig.BlacklistedTileEntiyClassNames )
  {
    if( tCanonicalName.equalsIgnoreCase( tS ) ) {
        return true;
    }
  }

  return GT_MetaTileEntity_WorldAccelerator._mBlacklistedTiles.stream()
          .map(Class::getCanonicalName)
          .map(String::toLowerCase)
          .anyMatch(tCanonicalName::equalsIgnoreCase);
}
 
Example 2
Source File: CauldronUtils.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
public static boolean canTileEntityUpdate(Class<? extends TileEntity> c)
{
    boolean canUpdate = false;
    try 
    {
        Constructor<? extends TileEntity> ctor = c.getConstructor();
        TileEntity te = ctor.newInstance();
        canUpdate = te.canUpdate();
    } 
    catch (Throwable e) 
    {
        // ignore
    }
    return canUpdate;
}
 
Example 3
Source File: CauldronHooks.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public static boolean canUpdate(TileEntity tileEntity)
{
    if (tileEntity == null || !tileEntity.canUpdate() || MinecraftServer.bannedTileEntityUpdates.contains(tileEntity.getClass())) return false; // quick exit
    return true;
}