use of forestry.greenhouse.api.greenhouse.IGreenhouseProvider in project ForestryMC by ForestryMC.
the class ChunkThread method handleDirtyChunks.
private static void handleDirtyChunks(World world) {
if (world == null || world.provider == null) {
return;
}
GreenhouseBlockManager manager = GreenhouseBlockManager.getInstance();
synchronized (manager) {
List<Long> dirtyChunks = manager.getDirtyChunks(world);
Iterator<Long> dirtyChunksIterator = dirtyChunks.iterator();
while (dirtyChunksIterator.hasNext()) {
Long chunkPos = dirtyChunksIterator.next();
GreenhouseChunk chunk = manager.getChunk(world, chunkPos);
if (chunk != null) {
synchronized (chunk) {
Collection<IGreenhouseProvider> providers = chunk.getDirtyProviders();
Iterator<IGreenhouseProvider> dirtyProviders = providers.iterator();
while (dirtyProviders.hasNext()) {
IGreenhouseProvider provider = dirtyProviders.next();
provider.recreate();
dirtyProviders.remove();
}
}
}
dirtyChunksIterator.remove();
}
manager.tickUpdates(world);
}
}
use of forestry.greenhouse.api.greenhouse.IGreenhouseProvider in project ForestryMC by ForestryMC.
the class BlankBlockHandler method checkBlockFacing.
private IErrorState checkBlockFacing(IGreenhouseBlockStorage storage, IBlankBlock blockToCheck, BlockPos rootPos, EnumFacing facing, List<IGreenhouseBlock> newBlocksToCheck) {
if (!blockToCheck.isFaceTested(facing)) {
BlockPos facingPosition = rootPos.offset(facing);
IGreenhouseProvider provider = storage.getProvider();
IErrorState errorState = provider.checkPosition(facingPosition);
if (errorState != null) {
return errorState;
}
IGreenhouseBlock logicBlock = storage.getBlock(facingPosition);
for (IGreenhouseBlockHandler handler : provider.getHandlers()) {
if (handler.onCheckPosition(storage, blockToCheck, facingPosition, facing, logicBlock, newBlocksToCheck)) {
break;
}
}
}
return null;
}
Aggregations