weixin_39759270
weixin_39759270
2020-12-01 21:42

let citizens sleep close to their beds

Changes proposed in this pull request:

  • Like 1.0 of citizens sleep in beds
  • Citizens will go close to 1 bed and "reserve" it for the night in a building.
  • Or at least, will try to.

Review please

该提问来源于开源项目:ldtteam/minecolonies

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • weixin_39585070 weixin_39585070 5月前

    SonarQube analysis reported 55 issues * MAJOR 18 major * MINOR 35 minor * INFO 2 info

    Watch the comments in this conversation to review them.

    Top 10 extra issues

    Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

    1. MAJOR WindowHomeBuilding.java#L116: Remove this unused method parameter "button". rule
    2. MAJOR BuildingHome.java#L329: Reduce this class from 38 to the maximum allowed 30 or externalize it in a public class. rule
    3. MAJOR EntityCitizen.java: This file has 1.365 lines, which is greater than 1.000 authorized. Split it into smaller files. rule
    4. MAJOR EntityCitizen.java#L70: Split this class into smaller and more specialized ones to reduce its dependencies on other classes from 57 to the maximum authorized 30 or less. rule
    5. MAJOR EntityCitizen.java#L70: class "EntityCitizen" has 98 methods, which is greater than the 35 authorized. Split it into smaller classes. rule
    6. MAJOR EntityCitizen.java#L370: Assign this magic number 3.0F to a well-named constant, and use the constant instead. rule
    7. MAJOR EntityCitizen.java#L371: Assign this magic number 5.0F to a well-named constant, and use the constant instead. rule
    8. MAJOR EntityCitizen.java#L371: Assign this magic number 0.02F to a well-named constant, and use the constant instead. rule
    9. MAJOR EntityCitizen.java#L372: Assign this magic number 0.6D to a well-named constant, and use the constant instead. rule
    10. MAJOR EntityCitizen.java#L373: Assign this magic number 6.0F to a well-named constant, and use the constant instead. rule
    点赞 评论 复制链接分享
  • weixin_39979167 weixin_39979167 5月前

    :shipit: looks good!

    Approved with PullApprove

    点赞 评论 复制链接分享
  • weixin_39759270 weixin_39759270 5月前

    The thing is that the builder would have to place the bed there, and still, the only problem would be that the citizen wouldn't sleep there.

    2017-09-06 16:06 GMT+01:00 Marc Hermans :

    ** commented on this pull request.

    In src/main/java/com/minecolonies/coremod/entity/ ai/minimal/EntityAISleep.java https://github.com/Minecolonies/minecolonies/pull/1423#discussion_r137295993 :

    @@ -49,11 +64,51 @@ public boolean continueExecuting() { if (citizen.getDesiredActivity() == EntityCitizen.DesiredActivity.SLEEP) { - //TODO might search a bed? + final Colony colony = citizen.getColony(); + if(colony == null) + { + return true; + } + + if(usedBed.equals(BlockPos.ORIGIN))

    Theoretically not. It is not practical that it is there. But if for what ever reason one places a bed there we have a problem. So just use null makes it plain impossible to be mistaken.

    — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Minecolonies/minecolonies/pull/1423#discussion_r137295993, or mute the thread https://github.com/notifications/unsubscribe-auth/AGI9y-j-3ncZIyVD5FBTK_EdprrTZ5nbks5sfrUNgaJpZM4PLQPf .

    点赞 评论 复制链接分享
  • weixin_39759270 weixin_39759270 5月前

    Null

    On Sep 7, 2017 7:27 AM, "Asherslab" wrote:

    ** commented on this pull request.

    In src/main/java/com/minecolonies/coremod/entity/ ai/minimal/EntityAISleep.java https://github.com/Minecolonies/minecolonies/pull/1423#discussion_r137502262 :

    @@ -49,11 +64,51 @@ public boolean continueExecuting() { if (citizen.getDesiredActivity() == EntityCitizen.DesiredActivity.SLEEP) { - //TODO might search a bed? + final Colony colony = citizen.getColony(); + if(colony == null) + { + return true; + } + + if(usedBed.equals(BlockPos.ORIGIN))

    well what's another option for it?

    — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Minecolonies/minecolonies/pull/1423#discussion_r137502262, or mute the thread https://github.com/notifications/unsubscribe-auth/AGI9y-I2qwxx5V-wHpx0YT1QvWUS6dmaks5sf8T0gaJpZM4PLQPf .

    点赞 评论 复制链接分享
  • weixin_39759270 weixin_39759270 5月前

    adapted it.

    点赞 评论 复制链接分享

相关推荐