Giter Site home page Giter Site logo

clo4 / datapacks Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 875 KB

clo4's Minecraft SMP datapacks

Home Page: https://modrinth.com/user/clo4/datapacks

License: MIT License

mcfunction 85.30% Nix 4.24% Shell 10.46%
datapack minecraft minecraft-server

datapacks's Introduction

clo4's Minecraft datapacks

Collection of all of my datapacks. These are typically focused on SMP server administration because that's what I find myself needing more tooling for.

Keeping everything in the same repository makes it easier to build stuff fast!

Table of Contents

Datapacks

Pause Day Cycle

View and download on Modrinth

A very lightweight datapack that disables doDaylightCycle when nobody is online or everyone online is tagged as afk (see #detect-afk-players). It's best suited for small to medium sized servers where there are large stretches of time that nobody will be online, or long periods where players may be AFK (eg. at a mob grinder overnight). This is to prevent the local difficulty and day count from becoming excessive and not representative of the amount of time that players have actually played on the server.

The following gamerules are affected:

  • doDaylightCycle
  • doWeatherCycle

The gamerule mobSpawning is unaffected to allow mob grinders and automatic farms to function with nobody present or an AFK player loading the chunk.

You can hook into the pause and resume events using the pause_day_cycle:pause and pause_day_cycle:resume function tags, which will be called whenever the day cycle pauses or resumes.

Chickenfix

View and download on Modrinth

A simple but effective brute force fix to chickens suffocating in walls when they grow up in a cramped, inhumane chicken farm.

It works by teleporting chickens to the center of the block they're in, on the tick where they grow into an adult. This prevents them from being shoved into a wall and suffocating. This is only done if the chicken is withing five blocks of any entity named exactly chickenfix, to prevent normal (humane) chicken farms from being broken by the same logic that fixes the inhumane ones.

Detect AFK Players

View and download on Modrinth

A simple way to detect AFK players for vanilla or modded servers, which allows you to build additional social signalling mechanics and improve the experience for all players.

Players are marked as AFK (afk) after 3 minutes of without moving the mouse.

The base afk datapack implements the AFK detection behavior, acting as a library for other datapacks. Players are treated as AFK after not touching the mouse for between 180 and 185 seconds (about 3 minutes).

This datapack also gives players the afk tag when they become AFK, and removes it when they return. This allows you to detect AFK players without having to install any other datapacks, making it very easy to integrate with.

Documentation

Information on how to integrate with Detect AFK Players is in afk/README.md. There are example datapacks below, which also contain examples of the functionality you can build.

AFK Sleep

View and download on Modrinth

Changes the playersSleepingPercentage to allow sleeping while there are AFK players on the server.

When the datapack is initially installed, the playersSleepingPercentage is stored and used as the percentage of players that aren't AFK that need to sleep for a night to pass.

Players online Players not AFK Initial playersSleepingPercentage Players required to pass a night
3 3 100% 3
3 2 100% 2
3 2 50% 1

AFK Message

View and download on Modrinth

Using this datapack will announce to all players on the server when someone becomes AFK or returns to the game.

AFK Dim Names

View and download on Modrinth

Using this datapack colors the names of AFK players gray and moves them to the bottom of the player list.

Contributing

I value composability over functionality, preferring to have less built in to datapacks and allowing you to build the features you need on top of it. Each piece of functionality can be small and performant, and they can be combined together to create something more complicated without sacrificing on maintainability or performance.

I typically only work on what I feel motivated to work on, because this isn't my job. I just do it for fun and to make my own life easier. But if there's a feature that you want added, either create an issue for it and I'll take a look or just contribute it and we'll get it merged and released!

If you're on an operating system where bash is available, the build script is executable as ./build.sh. All the required development tools are included in the Nix flake via nix develop (but if you're not using Nix, make sure you have jq and zip available). Data files are formatted with Prettier.

datapacks's People

Contributors

clo4 avatar

Watchers

 avatar

datapacks's Issues

Release new versions with support up to 1.20.6

  • AFK
  • AFK Dim Names
  • AFK Message
  • AFK Sleep
  • Chickenfix
  • Pause Day Cycle

Things I need to look into: how are other datapacks releasing versions where the only thing that changes is the version? Are they incrementing the version number? Are there other versioning systems that might solve this for me?

Values over 100% don't work as expected

Just noting this as a potential issue, I don't have any need to resolve it personally but I'm happy to fix this if someone else is having trouble with it. Please reply and let me know!

Set a team to restore to

If you can execute a command from a book and quill, you can definitely set a storage value to a string... right?

Don't run if player is a spectator

Currently even spectators will be announced as AFK, which is not very useful to the other players online because they can't interact with you at all anyway so there's no point in them seeing it in chat. And in the context of a server where players that aren't whitelisted are put into spectator mode, that would be annoying for everyone.

Release new version of afk

Updated to guarantee ordering, so it's no longer implemented using itself. Instead it now adds the afk tag and then executes the away/back function tags.

Make a better icon for chickenfix

It's currently intentionally low effort, but I'd like to make it at least not look like garbage on my Modrinth profile.

I'm thinking a piece of raw chicken with a big ๐Ÿšซ through it. That's still easy, still low effort enough that I don't think people will download it, but also decent enough that it looks like I care at least a little bit.

Rewrite to guarantee ordering

Currently the datapack uses its own function tags to run the pause/resume logic, I'd prefer it to invert the order and have the pause/resume call the function tags (like I did for afk)

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.