侧边栏壁纸
  • 累计撰写 781 篇文章
  • 累计创建 1 个标签
  • 累计收到 1 条评论
标签搜索
MC

Building

Dettan
2021-07-10 / 0 评论 / 0 点赞 / 88 阅读 / 1,360 字
温馨提示:
本文最后更新于 2022-04-30,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。
BuildingSawmill 存一些建筑信息,最大等级,第一 ,二适用技能, getJobName,canRecipeBeAdded,

都有一个这个方法,会给无业游民自动分配工作
@Override
public void onColonyTick(@NotNull final IColony colony)
{
    super.onColonyTick(colony);
// If we have no active worker, grab one from the Colony
if (!isFull() && ((getBuildingLevel() > 0 && isBuilt()) || this instanceof BuildingBuilder)
      && (this.hiringMode == HiringMode.DEFAULT && !this.getColony().isManualHiring() || this.hiringMode == HiringMode.AUTO))
{
    final ICitizenData joblessCitizen = getColony().getCitizenManager().getJoblessCitizen();
    if (joblessCitizen != null)
    {
        assignCitizen(joblessCitizen);
    }
}

}




会在BuildingManager 里调用
/**
 * Ticks all buildings when this building manager receives a tick.
 *
 * @param colony the colony which is being ticked.
 */
@Override
public void onColonyTick(final IColony colony)
{
    //  Tick Buildings
    for (@NotNull final IBuilding building : buildings.values())
    {
        if (colony.getWorld().isBlockPresent(building.getPosition()))
        {
            building.onColonyTick(colony);
        }
    }
}

在 Colony 里调用
/**
     * Called every 500 ticks, for slower updates.
     *
     * @return false
     */
    private boolean worldTickSlow()
    {
        buildingManager.cleanUpBuildings(this);
        raidManager.tryToRaidColony(this);
        citizenManager.onColonyTick(this);
        updateAttackingPlayers();
        eventManager.onColonyTick(this);
        buildingManager.onColonyTick(this);
        workManager.onColonyTick(this);
    updateChildTime();
    return false;
}</code></pre></div></div>
0

评论区