Skip to content

Instantly share code, notes, and snippets.

View robere2's full-sized avatar
🏒

Erik Roberts robere2

🏒
View GitHub Profile
@robere2
robere2 / Shotgun.java
Last active April 14, 2018 00:45
1.8.9 Sounds System Example
public void playFireSound() {
playSound("gun.shotgun.fire");
}
public void playReloadSound() {
playSound("gun.shotgun.reload");
}
/**
* Play sound
@robere2
robere2 / hypixel-tag-calculator.js
Last active November 29, 2023 03:18
Calculates the currently displayed player tag on the Hypixel Network, given a response from the API
const ranks = {
"ADMIN": [
[
'c',
"[ADMIN]"
]
],
"MODERATOR": [
[
'2',
@robere2
robere2 / scrollableGuiExample.java
Last active March 28, 2019 17:46
Example of how to set up a very simple scrollable GUI in Minecraft
class ScrollableGui extends GuiScreen {
int scrollDistance = 0;
final int x = 10;
final int y = 10;
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
@robere2
robere2 / unzip_nbt.js
Last active March 12, 2020 10:03
Example on how to unzip (but not parse) compressed NBT data in Javascript
let fs = require('fs');
let zlib = require('zlib');
let invData = [31, -117, 8, 0, 0, 0, 0, 0, 0, 0, -29, 98, 96, -32, 100, 96, -52, -28, 98, 96, 96, 80, 97, 98, 96, -54, 76, 97, 100, 98, 100, 96,
117, -50, 47, -51, 43, 97, -28, 98, 96, 46, 73, 76, 103, 100, -32, 14, -51, 75, 42, 74, 77, -52, 78, 76, -54, 73, 101, 100, 102, -32, -12,
-56, 76, 73, 117, -53, 73, 76, 47, 6, 106, -6, -57, -59, -64, -98, -110, 89, 92, -112, -109, 88, -55, -55, -64, -30, -109, 95, -108, -54, 1,
20, 101, 97, -32, 57, -76, -36, 60, 32, -75, 40, 91, 33, -77, 36, 53, 23, 40, 34, 124, 104, -71, -91, -74, -71, -126, 99, 73, 73, 98, 114,
-74, -126, 75, 98, 110, 98, 122, 42, 3, 31, 80, 16, -55, 108, 6, 6, 38, 6, 54, -88, 20, -120, 13, 114, 13, 43, 126, -41, -96, -24, -128, 0,
-120, 62, 54, -104, 62, 5, 76, 21, -40, 1, 0, 111, 21, -87, 83, 10, 1, 0, 0];
@robere2
robere2 / parse_nbt.js
Created August 9, 2019 03:53
Example on how to parse compressed or uncompressed Minecraft NBT data in Javascript
let fs = require('fs');
let nbt = require('prismarine-nbt');
let invData = [31, -117, 8, 0, 0, 0, 0, 0, 0, 0, -29, 98, 96, -32, 100, 96, -52, -28, 98, 96, 96, 80, 97, 98, 96, -54, 76, 97, 100, 98, 100, 96,
117, -50, 47, -51, 43, 97, -28, 98, 96, 46, 73, 76, 103, 100, -32, 14, -51, 75, 42, 74, 77, -52, 78, 76, -54, 73, 101, 100, 102, -32, -12,
-56, 76, 73, 117, -53, 73, 76, 47, 6, 106, -6, -57, -59, -64, -98, -110, 89, 92, -112, -109, 88, -55, -55, -64, -30, -109, 95, -108, -54, 1,
20, 101, 97, -32, 57, -76, -36, 60, 32, -75, 40, 91, 33, -77, 36, 53, 23, 40, 34, 124, 104, -71, -91, -74, -71, -126, 99, 73, 73, 98, 114,
-74, -126, 75, 98, 110, 98, 122, 42, 3, 31, 80, 16, -55, 108, 6, 6, 38, 6, 54, -88, 20, -120, 13, 114, 13, 43, 126, -41, -96, -24, -128, 0,
-120, 62, 54, -104, 62, 5, 76, 21, -40, 1, 0, 111, 21, -87, 83, 10, 1, 0, 0];
let buf = Buffer.from(invData);
@robere2
robere2 / index.html
Last active August 27, 2023 14:20
Vite & PrismarineNBT Example
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>body { white-space: pre ; display: block; unicode-bidi: embed }</style>
</head>
<body>
<div id="app"></div>
<script type="module" src="/main.js"></script>
@robere2
robere2 / HypixelAuctions.js
Last active March 14, 2025 02:28
Fetching auction data from the Hypixel API
/*
Copyright 2025 https://github.com/robere2
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions
of the Software.
@robere2
robere2 / hypixel-cf-worker-example.js
Last active November 20, 2024 19:29
Example of a simple Cloudflare Worker script which proxies the Hypixel API
/**
* Copyright 2024 https://ecr.dev/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the “Software”), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.