mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 14:24:42 +00:00
Speed up the check for if a block position is currently in a greenhouse
This commit is contained in:
1 parent
33d1685713
commit
ca17801c86
2 files changed
+59
-8
No files matched your search
@@ -19,6 +19,7 @@ import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.core.multiblock.IMultiblockControllerInternal;
|
||||
import forestry.core.multiblock.MultiblockRegistry;
|
||||
import forestry.greenhouse.multiblock.IGreenhouseControllerInternal;
|
||||
import forestry.greenhouse.multiblock.InternalBlockCheck;
|
||||
|
||||
public class GreenhouseHelper implements IGreenhouseHelper {
|
||||
|
||||
@@ -28,7 +29,7 @@ public class GreenhouseHelper implements IGreenhouseHelper {
|
||||
for (IMultiblockControllerInternal controllerInternal : MultiblockRegistry.getControllersFromWorld(world)) {
|
||||
if (controllerInternal instanceof IGreenhouseControllerInternal) {
|
||||
if (controllerInternal.isAssembled()) {
|
||||
if (isPosiotionInGreenhouse((IGreenhouseControllerInternal) controllerInternal, pos)) {
|
||||
if (isPositionInGreenhouse((IGreenhouseControllerInternal) controllerInternal, pos)) {
|
||||
return ((IGreenhouseControllerInternal) controllerInternal).createState();
|
||||
}
|
||||
}
|
||||
@@ -38,13 +39,9 @@ public class GreenhouseHelper implements IGreenhouseHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isPosiotionInGreenhouse(IGreenhouseControllerInternal controller, BlockPos pos) {
|
||||
for (IInternalBlock internalBlock : controller.getInternalBlocks()) {
|
||||
if (internalBlock.getPos().equals(pos)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
private static boolean isPositionInGreenhouse(IGreenhouseControllerInternal controller, BlockPos pos) {
|
||||
IInternalBlock checkBlock = new InternalBlockCheck(pos);
|
||||
return controller.getInternalBlocks().contains(checkBlock);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user