Skip to content

Instantly share code, notes, and snippets.

@sathonay
sathonay / InventorySerialization.java
Last active January 1, 2024 00:36
Utility to serialize itemstack array
import com.google.gson.Gson;
import org.bukkit.inventory.ItemStack;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
public class InventorySerialization {
@sathonay
sathonay / keybase.md
Last active September 24, 2023 19:40

Keybase proof

I hereby claim:

  • I am sathonay on github.
  • I am sathonay (https://keybase.io/sathonay) on keybase.
  • I have a public key ASB2LI6WBtvsi6T66JzOT9lkQK7mNT5pvnyDlIxgLHti0go

To claim this, I am signing this object:

@sathonay
sathonay / Fix NoCom.patch
Last active January 9, 2024 15:51
Fix NoCom exploit by reducing the unloaded chunk check to the playerview distance - NoCom Ref -> https://github.com/nerdsinspace/nocom-explanation/blob/main/README.md
From 6b0a93e2ddfdb13b7aff806e071e79173d20b13b Mon Sep 17 00:00:00 2001
From: Michael Himing <mhiming@gmail.com>
Date: Sun, 8 Jan 2017 18:50:35 +1100
Subject: [PATCH] Fix block break desync
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 4f8865d61..802008b4e 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
:start
@echo off
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
set /p var=yes(y) to enable hyper-v, no(n) to disable hyper-v:
if /i %var% == y goto enable
if /i %var% == yes goto enable
if /i %var% == n goto disable
if /i %var% == no goto disable
cls
goto start
{
"$schema": "https://aka.ms/terminal-profiles-schema",
// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
@sathonay
sathonay / ComponentBuilder.java
Last active June 30, 2023 15:51
my little ComponentAPI
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ClickEvent.Action;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
public class ComponentBuilder {
private TextComponent component;
@sathonay
sathonay / 0001-Minecraft-fullscreen-no-bound.patch
Last active February 16, 2021 12:42
Minecraft fullscreen no bound (in the toggleFullscreen() method)
From 7b00212f0c3ea867e427c087fabd6424b13801db Mon Sep 17 00:00:00 2001
From: Alexis <33222808+sathonay@users.noreply.github.com>
Date: Wed, 10 Feb 2021 18:27:02 +0100
Subject: [PATCH 1/3] FullScreen no bound FIX
---
net/minecraft/client/Minecraft.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/minecraft/client/Minecraft.java b/net/minecraft/client/Minecraft.java
#!/bin/bash
FILE="./BuildTools.jar"
if [ ! -f "$FILE" ] ;
then
echo "Downloading BuildTools.jar ..." >&2
curl https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar -O BuildTools.jar
fi
read -p "Which version do you want to build? : " ver && mkdir $ver && cp ./BuildTools.jar $ver && cd $ver && java -jar BuildTools.jar --rev $ver
package net.minecraft.client.gui.GuiIngame
private void renderPlayerStats(ScaledResolution p_180477_1_)
{
if (this.mc.getRenderViewEntity() instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity();
int i = MathHelper.ceiling_float_int(entityplayer.getHealth());
boolean flag = this.healthUpdateCounter > (long)this.updateCounter && (this.healthUpdateCounter - (long)this.updateCounter) / 3L % 2L == 1L;
@sathonay
sathonay / ResourcePackImageScaler.java
Last active May 8, 2024 10:48
Implement ResourcePackImageScaler (a class by @prplz) in mcp
import java.awt.Graphics;
import java.awt.image.BufferedImage;
public class ResourcePackImageScaler {
public static final int SIZE = 64;
public static BufferedImage scalePackImage(BufferedImage image) {
if (image == null) {
return null;