Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/less ticks #3283

Merged
merged 4 commits into from
Jan 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/main/java/com/minecolonies/coremod/colony/Colony.java
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,16 @@ public void onWorldUnload(@NotNull final World w)
*/
public void onServerTick(@NotNull final TickEvent.ServerTickEvent event)
{
packageManager.updateSubscribers();

if (packageManager.getSubscribers().isEmpty())
{
return;
}

buildingManager.tick(event);

getRequestManager().update();
packageManager.updateSubscribers();

final List<EntityPlayer> visitors = new ArrayList<>(visitingPlayers);

Expand Down Expand Up @@ -740,15 +746,16 @@ public void onWorldTick(@NotNull final TickEvent.WorldTickEvent event)
return;
}

// Cleanup Buildings whose Blocks have gone AWOL
buildingManager.cleanUpBuildings(event);

// Clean up or spawn citizens.
if (!packageManager.getSubscribers().isEmpty())
if (packageManager.getSubscribers().isEmpty())
{
citizenManager.onWorldTick(event);
return;
}

// Cleanup Buildings whose Blocks have gone AWOL
buildingManager.cleanUpBuildings(event);
citizenManager.onWorldTick(event);

if (shallUpdate(world, TICKS_SECOND)
&& event.world.getDifficulty() != EnumDifficulty.PEACEFUL
&& Configurations.gameplay.doBarbariansSpawn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ public IAIState pickUpMaterial()
needsCurrently = neededItemsList.get(pickUpCount);
pickUpCount++;

if (currentStructure == null)
{
return IDLE;
}

if (currentStructure.getStage() != Structure.Stage.DECORATE)
{
needsCurrently = needsCurrently.and(stack -> !ItemStackUtils.isDecoration(stack));
Expand Down