Skip to content

Instantly share code, notes, and snippets.

View TehBrian's full-sized avatar
🦆
quamck

TehBrian TehBrian

🦆
quamck
View GitHub Profile
@TehBrian
TehBrian / SuperDuperEventListener.java
Created October 21, 2023 20:14
SuperDuperEventListener
public final class SuperDuperEventListener implements Listener {
private final JavaPlugin plugin;
@Inject
public SuperDuperEventListener(
final JavaPlugin plugin
) {
this.plugin = plugin;
}
<?xml version="1.0" encoding="UTF-8"?>
<migrationMap>
<name value="Minecraft 1.16 to 1.18 (Forge)"/>
<order value="0"/>
<description value="Minecraft class rename plus some Forge classes"/>
<entry oldName="com.mojang.blaze3d.matrix.MatrixStack" newName="com.mojang.blaze3d.vertex.PoseStack" type="class"/>
<entry oldName="com.mojang.blaze3d.vertex.IVertexBuilder" newName="com.mojang.blaze3d.vertex.VertexConsumer" type="class"/>
<entry oldName="net.minecraft.block.AbstractBlock.Properties" newName="net.minecraft.world.level.block.state.BlockBehaviour.Properties" type="class"/>
<entry oldName="net.minecraft.block.Block" newName="net.minecraft.world.level.block.Block" type="class"/>
<entry oldName="net.minecraft.block.Blocks" newName="net.minecraft.world.level.block.Blocks" type="class"/>
- was immutable by default (parameters, variables, and fields. make mutable with `mut` keyword. `final` only applies to classes to prevent subclassing.)
- was non-null by default (to allow a variable to be null, mark it with `?`)
- removed legacy API (java.io, java.util.Date, java.util.Calendar)
@TehBrian
TehBrian / final-cut-pro-trial-reset.sh
Created June 21, 2022 19:33
Final Cut Pro Trial Reset
mv -v ~/Library/Application\ Support/.ffuserdata ~/.Trash
https://github.com/VSCodium/vscodium/issues/892#issuecomment-986663776
But, really, as much as it pains me to say: just use Visual Studio Code.
I've fought the good battle for well over three years now, and I've given up.
I've conceded. Microsoft wins. Trying to install the plethora of Microsoft's
propriertary VSCode extensions onto VSCodium is an absolute hell. Visual Studio Code,
with its telemetry and whatnot is the better experience.
/* Prefer using adventure or something, but if you need something tiny.. */
public static final Pattern HEX_PATTERN = Pattern.compile("&(#[A-Fa-f0-9]{6})");
public static String color(String string) {
return string == null ? null : replaceHex(ChatColor.translateAlternateColorCodes('&', string));
}
public static String replaceHex(String str) {
Matcher matcher = HEX_PATTERN.matcher(str);
while (matcher.find()) {
@TehBrian
TehBrian / 1-16-minecraft-map-palette.gpl
Created July 7, 2020 00:56
Allowed colors in maps for Minecraft 1.16.
GIMP Palette
67 94 29 Untitled
89 125 39 Untitled
109 153 48 Untitled
127 178 56 Untitled
130 123 86 Untitled
174 164 115 Untitled
213 201 140 Untitled
247 233 163 Untitled
@TehBrian
TehBrian / google_sheets
Last active April 27, 2020 16:00
Nice little formulas I use in Google Sheets.
This little string sets the cell to the amount of words in another cell, relative to that cell.
I don't know why this was so hard to find, I feel like it should be easier than this, but whatever.
Replace "-2" with however many to the left or right you want to go in that column, or use row, or whatever.
=IF(INDIRECT(ADDRESS(ROW(), COLUMN()-2))="", "", COUNTA(SPLIT(INDIRECT(ADDRESS(ROW(), COLUMN()-2)), " ")))
This thing puts the first word of the cell to the left by one, you can change the numbers as usual.
=IF(INDIRECT(ADDRESS(ROW(), COLUMN()-1))="", "", LEFT(INDIRECT(ADDRESS(ROW(), COLUMN()-1)), FIND(" ", INDIRECT(ADDRESS(ROW(), COLUMN()-1)))-1))
@TehBrian
TehBrian / debug.sh
Last active July 3, 2020 20:56
Minecraft Server debug script.
#!/bin/sh
echo Debug script activated!
cd "$( dirname "$0" )"
RAM=3G
SERVER_JAR=server.jar
DEBUG_PORT=30024
# Line below uses Aikar's flags. Keep it updated.
@TehBrian
TehBrian / start.sh
Last active July 3, 2020 20:53
Minecraft Server start script.
#!/bin/sh
echo Start script activated!
cd "$( dirname "$0" )"
RAM=3G
SERVER_JAR=server.jar
# Line below uses Aikar's flags. Keep it updated.
java -Xms$RAM -Xmx$RAM -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar $SERVER_JAR nogui