Skip to content

Instantly share code, notes, and snippets.

View kvverti's full-sized avatar

Thalia Nero kvverti

View GitHub Profile
@kvverti
kvverti / Entities.java
Created June 4, 2016 01:20
Current non-server-friendly workaround
package kvverti.enim.entity;
/* imports... */
/** Utility class for working with Entitys and TileEntitys. */
public final class Entities {
/* methods... */
public static class TickEventHandler {
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@kvverti
kvverti / crash.txt
Last active May 11, 2019 03:10
Structure Crash
---- Minecraft Crash Report ----
// Why is it breaking :(
Time: 5/10/19, 10:55 PM
Description: Exception generating new chunk
java.util.ConcurrentModificationException
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
at net.minecraft.structure.StructureManager.getStructure(StructureManager.java:58)
at net.minecraft.structure.StructureManager.getStructureOrBlank(StructureManager.java:47)
/*********************************************************************************************************************************************************************************************************************/
/* SpongePowered MIXIN */
/*********************************************************************************************************************************************************************************************************************/
/* Code source : file:/home/.gradle/caches/modules-2/files-2.1/net.fabricmc/sponge-mixin/0.7.11.36/b0d9944f2b77f1ce952a1179e595037332910a82/sponge-mixin-0.7.11.36.jar */
/* Internal Version : 0.7.11
@kvverti
kvverti / AccessTest.java
Created February 26, 2020 06:16
Java Access Control
package access;
public class AccessTest {
public static void main(String[] args) {
UseM.use(new q.Sub()); // prints "Subclass"
// new q.Sub().m(); // compiler error - cannot access protected method m
((p.Super)new q.Sub()).m(); // prints "Subclass"
}
}
@kvverti
kvverti / config-meanderings.md
Last active April 12, 2020 06:20
A brainstorm of Fabric Config schema and behavior

Config categories (environments?)

  • Prelaunch, for configuring mixin plugins (immutable)
  • Instance, for configuring registration and other things that happen at load time (immutable)
  • Server, for things that control server-side behavior (mutable)
  • Client, for client side behavior (mutable)

Config Schema

  • Defined in mod root
  • Version flagged (in case more types or constraints are added)
  • Config value types and constraints are likely locked down
@kvverti
kvverti / module.md
Last active June 24, 2023 01:48
The Fabric API Problem

Fabric API

Fabric API is supposed to be modular. This means that mod devs should be able to pick and choose which Fabric API modules to depend on in their mods, both in the development environment and in production.

Fabric API is also supposed to be just another mod. Fabric API should not have special support in Fabric tooling, nor should it be a required install for players. Basically, Fabric API is simply a collection of mostly independent modules that happen to be maintained by the same organization that maintains Fabric tooling.

The Problem

The fabric example mod contains a hard dependency on the entire Fabric API. Since most mod devs do not remove this dependency, most players have to download an additional mod (Fabric API) in order to play a Fabric mod, which many players do not expect. This means mod devs often assume that players have installed Fabric API in the production evnironment.

@kvverti
kvverti / TernarySurfaceConfigMixin.java
Created October 18, 2020 19:26
Extending Codecs with Mixin
package robosky.uplands.mixin;
import java.util.function.Function;
import com.mojang.datafixers.kinds.App;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
@kvverti
kvverti / monads.md
Last active October 15, 2023 23:57
What the heck are monads anyway?

What the Heck is a Monad, Anyway?

Querying one's favorite search engine with the text "a monad is" yields this answer on StackOverflow, which explains, in excruciating mathematical symbology, what a monad in fact is. But, don't worry. Understanding monads doesn't require you to learn the nuances of such concepts as moirails and eigenfunctors. I would suggest that the concept of monads can be distilled into a clearer single sentence.

A monad is a control abstraction that defines a composition of effectful functions.

Let's unpack.