Skip to content

Instantly share code, notes, and snippets.

View SupremeMortal's full-sized avatar

Owen Howard SupremeMortal

View GitHub Profile
@SupremeMortal
SupremeMortal / make-baseline.sh
Last active February 15, 2024 22:56
A bash script to create a custom HPE baseline ISO by unpacking an existing SPP and adding the files to the `packages/` directory
#!/bin/bash
# Requires packages on Fedora: xorriso, syslinux and genisoimage
# $1: Name of ISO
# $2: Directory of extracted SPP with your added files
xorriso -as mkisofs -J -J -joliet-long -cache-inodes -R -V "$1" \
-o "$2/$1.iso" \
-isohybrid-mbr "/usr/share/syslinux/isohdpfx.bin" \
-b "system/isolinux.bin" \
@SupremeMortal
SupremeMortal / HashPaletteComparator.java
Created April 19, 2022 21:08
Bedrock's new block palette ordering
public class HashedPaletteComparator implements Comparator<String> {
public static final HashedPaletteComparator INSTANCE = new HashedPaletteComparator();
private static final long FNV1_64_INIT = 0xcbf29ce484222325L;
private static final long FNV1_PRIME_64 = 1099511628211L;
@Override
public int compare(String o1, String o2) {
byte[] bytes1 = o1.getBytes(StandardCharsets.UTF_8);
byte[] bytes2 = o2.getBytes(StandardCharsets.UTF_8);
@SupremeMortal
SupremeMortal / legacy_block_data_mappings.json
Last active March 19, 2021 22:50
Hardcoded legacy data map
{
"minecraft:stone": [
{"stone_type":"stone"},
{"stone_type":"granite"},
{"stone_type":"granite_smooth"},
{"stone_type":"diorite"},
{"stone_type":"diorite_smooth"},
{"stone_type":"andesite"},
{"stone_type":"andesite_smooth"},
{"stone_type":"stone"}
[
{"id":0,"meta":0,"name":"minecraft:air","states":{}},
{"id":1,"meta":0,"name":"minecraft:stone","states":{"stone_type":{"val":"stone","type":8}}},
{"id":1,"meta":1,"name":"minecraft:stone","states":{"stone_type":{"val":"granite","type":8}}},
{"id":1,"meta":2,"name":"minecraft:stone","states":{"stone_type":{"val":"granite_smooth","type":8}}},
{"id":1,"meta":3,"name":"minecraft:stone","states":{"stone_type":{"val":"diorite","type":8}}},
{"id":1,"meta":4,"name":"minecraft:stone","states":{"stone_type":{"val":"diorite_smooth","type":8}}},
{"id":1,"meta":5,"name":"minecraft:stone","states":{"stone_type":{"val":"andesite","type":8}}},
{"id":1,"meta":6,"name":"minecraft:stone","states":{"stone_type":{"val":"andesite_smooth","type":8}}},
{"id":2,"meta":0,"name":"minecraft:grass","states":{}},
@SupremeMortal
SupremeMortal / block_palette_1.13.json
Last active March 19, 2021 22:49
Block Palette without meta values
[
{"id":0,"name":"minecraft:air","states":{}},
{"id":1,"name":"minecraft:stone","states":{"stone_type":{"val":"andesite","type":8}}},
{"id":1,"name":"minecraft:stone","states":{"stone_type":{"val":"andesite_smooth","type":8}}},
{"id":1,"name":"minecraft:stone","states":{"stone_type":{"val":"diorite","type":8}}},
{"id":1,"name":"minecraft:stone","states":{"stone_type":{"val":"diorite_smooth","type":8}}},
{"id":1,"name":"minecraft:stone","states":{"stone_type":{"val":"granite","type":8}}},
{"id":1,"name":"minecraft:stone","states":{"stone_type":{"val":"granite_smooth","type":8}}},
{"id":1,"name":"minecraft:stone","states":{"stone_type":{"val":"stone","type":8}}},
{"id":2,"name":"minecraft:grass","states":{}},
{
"geometry.humanoid": {
"bones": [
{
"name": "body",
"pivot": [ 0.0, 24.0, 0.0 ],
"cubes": [
{
"origin": [ -4.0, 12.0, -2.0 ],
"size": [ 8, 12, 4 ],
{
"minecraft:air": 0,
"minecraft:stone": 1,
"minecraft:grass": 2,
"minecraft:dirt": 3,
"minecraft:cobblestone": 4,
"minecraft:planks": 5,
"minecraft:sapling": 6,
"minecraft:bedrock": 7,
"minecraft:flowing_water": 8,
@SupremeMortal
SupremeMortal / LevelDatReader.java
Last active June 23, 2022 08:57
level.dat Reader
package com.github.suprememortal.leveldatreader;
import com.nukkitx.nbt.stream.LittleEndianDataInputStream;
import com.nukkitx.nbt.stream.NBTInputStream;
import com.nukkitx.nbt.tag.Tag;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

package com.sk89q.worldedit.bukkit.adapter.impl;
import com.google.common.base.Preconditions;
import com.sk89q.jnbt.ByteArrayTag;
import com.sk89q.jnbt.ByteTag;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.DoubleTag;
import com.sk89q.jnbt.EndTag;
import com.sk89q.jnbt.FloatTag;
import com.sk89q.jnbt.IntArrayTag;