Git Product home page Git Product logo

villageroptimizer's Introduction

VillagerOptimizer

Combat server lag caused by lots of ticking villagers

This plugin enables you and your playerbase to optimize villagers in trading halls or other setups so they still remain their function but don't take up large amounts of resources.

There are 4 methods to do so:

  • Using commands to optimize/unoptimize all villagers in a given block radius
  • Using nametags with a specific name to optimize/unoptimize a single villager (recommended)
  • Using specific blocks and placing/removing them near a villager
  • Using the corresponding workstation block and placing/removing them near a villager

It aims to be highly customizable and performant. Offering a multilang system, which displays messages based on the player client's language setting as well as an optimize- and unoptimize event, so you may extend the plugin with your own custom solutions.

Commands:

Command Aliases Description
/villageroptimizer [reload, version, disable] voptimizer, vo VillagerOptimizer admin commands
/optimizevillagers noai, optvils Optmize villagers in a radius around you
/unoptimizevillagers noaiundo, unoptvils Unoptmize villagers in a radius around you

Other features:

  • Prevent trading with unoptimized villagers to encourage players to optimize them
  • Smart villager chunk limit with configurable max numbers for optimized and unoptimized villagers and a villager profession based priorisation system (you can configure what kind of villagers should be deleted first, like for example nitwits or jobless villagers.)
  • Make villagers spawn as adults so players can optimize them sooner
  • Prevent other mobs from targeting optimized villagers
  • Prevent damage of specific, configurable causes to optimized villagers
  • Comes with prepackaged translations for en_us, de_de, it_it, ru_ru
  • All plugin messages support the usage of multiple lines and use MiniMessage formatting. This means you can use hex colors, custom click events and much more without needing to be a programmer!

Found a bug or got an idea for an enhancement? Open an issue or join the discord!

Supports Paper/Folia 1.16 - 1.20.4

villageroptimizer's People

Contributors

bonn2 avatar jd07159 avatar xginko avatar xiaoyueyoqwq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

villageroptimizer's Issues

Villagers sometimes disapper

Villagers sometimes disappear, but i'm not sure that's your issue

Also I have this error in logs, probably related:

[11:45:39] [Region Scheduler Thread #3/ERROR]: [ca.spottedleaf.moonrise.common.util.TickThread] Thread Region Scheduler Thread #3 failed main thread check: Accessing poi chunk off-main
java.lang.Throwable: null
at ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(TickThread.java:51) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.ai.village.poi.PoiManager.getOrLoad(PoiManager.java:90) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.ai.village.poi.PoiManager.exists(PoiManager.java:350) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.ai.behavior.GoToPotentialJobSite.lambda$stop$2(GoToPotentialJobSite.java:52) ~[folia-1.21.jar:1.21-DEV-177c892]
at java.base/java.util.Optional.ifPresent(Optional.java:178) ~[?:?]
at net.minecraft.world.entity.ai.behavior.GoToPotentialJobSite.stop(GoToPotentialJobSite.java:47) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.ai.behavior.GoToPotentialJobSite.stop(GoToPotentialJobSite.java:20) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.ai.behavior.Behavior.doStop(Behavior.java:91) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.ai.behavior.Behavior.tickOrStop(Behavior.java:80) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.ai.Brain.tickEachRunningBehavior(Brain.java:463) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.ai.Brain.tick(Brain.java:404) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.npc.Villager.customServerAiStep(Villager.java:258) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.npc.Villager.customServerAiStep(Villager.java:253) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.Mob.serverAiStep(Mob.java:966) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.LivingEntity.aiStep(LivingEntity.java:3489) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.Mob.aiStep(Mob.java:698) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.AgeableMob.aiStep(AgeableMob.java:155) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.LivingEntity.tick(LivingEntity.java:3192) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.Mob.tick(Mob.java:465) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.npc.Villager.tick(Villager.java:300) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.Entity.rideTick(Entity.java:2985) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.world.entity.LivingEntity.rideTick(LivingEntity.java:3745) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.server.level.ServerLevel.tickPassenger(ServerLevel.java:1446) ~[folia-1.21.jar:1.21-DEV-177c892]
at net.minecraft.server.level.ServerLevel.tickNonPassenger(ServerLevel.java:1411) ~[folia-1.21.jar:1.21-DEV-177c892]

Folia: 177c892
VillagerOptimizer: 1.6.1

1.21 Villager Enum Changes

As of the latest builds of paper and spigot Villager types and profession enums are no longer enums and are instead constants of their interface.

KennyTV
Plugin Developer An upstream update was just merged that moves cat and frog variants, map cursor types, and villager types+profession from enums to constants of an interface. There are basic compatibility measures in place, so you only need to do something now if:
you put any of these into an EnumMap/EnumSet or work on them with switch statements (make sure you also remove such use of them for similar type enums โ—),
you are using Paper-plugins (with the paper-plugin.yml), being exempt from the compatibility code, or
you are disabling plugin rewriting via the startup flag.
Going beyond this, please especially make sure you move away from Material.values() calls and instead get them via the Registry API (or the upstream compatible one)

Quote from the paper discord

It seems that whatever compatibility mitigations they tried to implement do not work for VillagerOptimizer as it now produces several Badtype on operand stack errors on startup.
Trimmed Error:

[16:44:32 ERROR]: [VillagerOptimizer] Failed initialising module 'OptimizeByWorkstation'.
java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    me/xginko/villageroptimizer/modules/optimization/OptimizeByWorkstation.lambda$onBlockPlace$2(Ljava/util/concurrent/atomic/AtomicBoolean;Ljava/util/concurrent/atomic/AtomicInteger;Lorg/bukkit/Location;Lorg/bukkit/entity/Villager$Profession;Lorg/bukkit/entity/Player;Lorg/bukkit/event/block/BlockPlaceEvent;Lorg/bukkit/block/Block;Lme/xginko/villageroptimizer/libs/morepaperlib/scheduling/ScheduledTask;)V @336: invokestatic
  Reason:
    Type 'org/bukkit/entity/Villager$Profession' (current frame, stack[1]) is not assignable to 'java/lang/Enum'

The workaround I have found for now is not update paper past paper-1.21-89. Which is still available on their Builds Explorer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.