mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Optimise Worldgen Hives (#2063)
This commit is contained in:
1 parent
36ccd5c3e1
commit
8c39ad956e
3 files changed
+18
-7
No files matched your search
@@ -33,8 +33,9 @@ import forestry.core.utils.TickHelper;
|
||||
|
||||
public class WorldgenBeekeepingLogic implements IBeekeepingLogic {
|
||||
private final TileHive housing;
|
||||
private IBee queen;
|
||||
private IEffectData effectData[] = new IEffectData[2];
|
||||
private final HasFlowersCache hasFlowersCache = new HasFlowersCache();
|
||||
private final HasFlowersCache hasFlowersCache = new HasFlowersCache(2);
|
||||
private final TickHelper tickHelper = new TickHelper();
|
||||
|
||||
// Client
|
||||
@@ -92,10 +93,11 @@ public class WorldgenBeekeepingLogic implements IBeekeepingLogic {
|
||||
public boolean canWork() {
|
||||
tickHelper.onTick();
|
||||
|
||||
IBee queen = housing.getContainedBee();
|
||||
hasFlowersCache.update(queen, housing);
|
||||
|
||||
if (tickHelper.updateOnInterval(200)) {
|
||||
if (queen == null) { //Trying to set this in constructor causes crash
|
||||
queen = housing.getContainedBee();
|
||||
}
|
||||
hasFlowersCache.update(queen, housing);
|
||||
World world = housing.getWorldObj();
|
||||
boolean canWork = (world.isDaytime() || queen.getGenome().getNeverSleeps()) &&
|
||||
(!housing.isRaining() || queen.getGenome().getToleratesRain());
|
||||
|
||||
Reference in new issue
Block a user