Skip to content

Instantly share code, notes, and snippets.

View Machine-Maker's full-sized avatar
🇺🇸
Developing

Jake Potrebic Machine-Maker

🇺🇸
Developing
View GitHub Profile
#!/usr/bin/env bash
shopt -s extglob
ARCH=
VERSION=
RAM=6G
function confirm () {
printf "$1 [Y/n]: "
read -n 1 RES
@Machine-Maker
Machine-Maker / ghsync.sh
Last active July 31, 2022 04:55
Script that tracks remotes and open PRs on GitHub
#!/bin/zsh
(
YELLOW="\e[33m"
LIGHT_YELLOW="\e[93m"
MAGENTA="\e[35m"
ENDCOLOR="\e[0m"
if git rev-parse --is-inside-git-dir > /dev/null 2>&1; then
echo "${YELLOW}Local Only Branches${ENDCOLOR}"
git branch --format "%(refname:short) %(upstream:trackshort)" | awk '{if (!$2) print "- \033[35m"$1"\033[0m";}' | cat
@Machine-Maker
Machine-Maker / make_super_repo.sh
Last active August 4, 2022 16:46
Combine Craftbukkit, Bukkit, Spigot, and Paper
rm -rf nms Paper
mkdir -p work && cd work
repo=https://github.com/PaperMC/Paper.git
if [[ -n $1 ]]; then
repo=https://github.com/$1.git
fi
branch=master
if [[ -n $2 ]]; then
branch=$2
fi
@Machine-Maker
Machine-Maker / registry-modification-api.md
Last active January 3, 2024 15:35
Registry Modification

Registry Modification API

The Registry Modification API is a framework for adding future API which easily allows mutating or adding entries into both the built-in registries and the data-driven registries.

There are several definitions to cover first:

Definitions

Built-in Registry: A registry that is unmodifiable by datapacks. They are created/loaded via static initializers

// ==UserScript==
// @name Github AutoView
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Automatically mark file renames and minor diffs as viewed
// @author Machine Maker
// @match https://github.com/*/*/pull/*
// @icon https://www.google.com/s2/favicons?domain=mozilla.org
// @grant none
// @license MIT
@Machine-Maker
Machine-Maker / lifecycle-event-system.md
Last active January 9, 2024 21:42
Lifecycle Event System

Lifecycle Event System

Pull Request

What is this?

A new event system for plugins to register handlers for specific events that relate to the startup or reload of servers.

Why is this needed?

We already have an event system, why do we need another one? Fair question. The answer is in the lifecycle part of the name. Some of these events fire well before JavaPlugin instances are created, before the MinecraftServer instance is created, right at the very start of server startup, even before all the registries have been initialized which is like the 2nd thing to happen on a vanilla server. The existing Bukkit event system is not designed to exist at this time, and modifying it to support this environment is more trouble than just having a separate system for specific events that can fire during this early initialization.

@Machine-Maker
Machine-Maker / git_fixup.zsh
Created April 25, 2024 02:52
git fixup fuzzy finding
_fix()
{
local all=()
if [[ "all" == $1 ]]; then
all=("--all")
fi
local extra=()
if [ $(git tag -l "base") ]; then
extra=("base..HEAD")
fi
@Machine-Maker
Machine-Maker / stuff.md
Created June 17, 2024 02:15
Lifecycle Tag Modification API

The need to modify tags within the game is increasing every update as more functionality is controlled by them.

Tags are registered after all registries have been frozen but before the JavaPlugin system has been initialized which requires, then, hooking into it with our Lifecycle Event API. Tags are then reloaded on a /minecraft:reload. Tags can also be changed at runtime with updating the client to these changes as simple as sending an update tags packet. For now, we will just focus on the event for handling regisration, and focus on modifcatons at any time later.

There are at least 3 spots that plugins might want to hook into tag loading and I'm not sure which combination should have specific events.