Skip to content

Instantly share code, notes, and snippets.

View Geolykt's full-sized avatar
🍴
Fork, fork

Geolykt

🍴
Fork, fork
View GitHub Profile
@Geolykt
Geolykt / ScienceChartManager.java
Created December 24, 2025 22:02
Modern age example on how to use Starloader-API's RollingChartData (as of SLAPI 2.0.0-a20251224)
package de.geolykt.graphs.science;
import java.util.Optional;
import org.jetbrains.annotations.NotNull;
import de.geolykt.starloader.api.Galimulator;
import de.geolykt.starloader.api.NamespacedKey;
import de.geolykt.starloader.api.dimension.Empire;
import de.geolykt.starloader.api.event.EventHandler;
@Geolykt
Geolykt / TestListener.java
Created December 20, 2025 21:14
Test class of SLAPI's chart API
package de.geolykt.starloader;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
import de.geolykt.starloader.api.Galimulator;
import de.geolykt.starloader.api.empire.ActiveEmpire;
import de.geolykt.starloader.api.empire.Empire;
import de.geolykt.starloader.api.event.EventHandler;
Classfile /home/geolykt/.local/share/Steam/steamapps/common/Galimulator_copy/classes/org/stianloader/micromixin/test/j8/targets/ConstructorMergingTest.class
Last modified Sep 15, 2024; size 2919 bytes
MD5 checksum bd0737909513baccd8a1e41eca37f54b
Compiled from "ConstructorMergingTest.java"
public class org.stianloader.micromixin.test.j8.targets.ConstructorMergingTest extends org.stianloader.micromixin.test.j8.MutableInt
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Utf8 org/stianloader/micromixin/test/j8/targets/ConstructorMergingTest
# Differential of the galimulator-desktop.jar file of the chinese translation of galimulator
# compared to the original galimulator jar.
# Command used: java -jar java-bytecode-differential-1.0.0.jar generate galimulator-desktop.jar galimulator-desktop-cn.jar 0
# Galimulator version: 5.0.2 (latest version as of 2024-08-08)
# This translation is not authored by me, but rather by nanami on steam.
# See: https://steamcommunity.com/workshop/filedetails/?id=3305178305
--- snoddasmannen/galimulator/actors/DropShip.class
+++ snoddasmannen/galimulator/actors/DropShip.class
@@ -28,1 +28,1 @@
"main" #1 prio=5 os_prio=0 cpu=1491007.44ms elapsed=3070.41s tid=0x00007f5c6c0267c0 nid=0x3c041 waiting on condition [0x00007f5c7251b000]
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x0000000400d276f0> (a java.util.concurrent.Semaphore$NonfairSync)
at java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:211)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire([email protected]/AbstractQueuedSynchronizer.java:715)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly([email protected]/AbstractQueuedSynchronizer.java:1047)
at java.util.concurrent.Semaphore.acquire([email protected]/Semaphore.java:475)
at de.geolykt.starloader.impl.util.SemaphoreLoopLock.acquire(SemaphoreLoopLock.java:101)
public class Beitrag {
private DateTime gepostet;
private String titel;
private int anzahlLikes;
private String text;
private ArrayList<Bild> bilder;
private Nutzer autor;
public Beitrag(Nutzer autor, String titel, Bild bild) {
this.gepostet = new DateTime();
@Geolykt
Geolykt / Geraet.java
Last active April 7, 2024 11:36
LA Hessen 2021 NT (SLZ) 2.2.2
public class Geraet {
private int geraeteNr;
private boolean einsatzBereit;
private Geraetetyp geraetetyp;
private ArrayList<Reservierung> reservierungen;
public Geraet(Geraetetyp typ) {
this.geraetetyp = typ;
this.gerateNr = typ.getGeraetetypNr() * 100 + typ.getGeraete().size();
this.einsatzBereit = true;
@Geolykt
Geolykt / gist:2297f64284eb4b744917d971d79f1f80
Created July 10, 2023 17:56
Manifesto for multi-currency systems without primary currencies
In a world where there isn't just one but multiple currencies, one has an acute problem of knowing what economy to use at all times. You can't just transfer 500 from A to B. You need to order the economy implementation to transfer 500 of currency C from A to B.
At first glance this may sound like not of an issue, until you realize that most inputs will be done in purely scalar values. The user will enter `/give minecraftplayer2 500`, not `/give minecraftplayer2 500 virtualGoldNugget`. Similarly all configuration files will probably only have a scalar value, but not a currency value.
The solution: Continue using scalars everywhere, where as the scalars values are implicitly assigned to a fallback currency. However, given that a not so small amount of API consumers will continue to only use that scalar system (after all, this is the system we all grew up with thanks to vault), one can say that this fallback currency is in fact a primary currency.
However the problem you seem to be oblivious to, is that in do
# This configuration file is written in HOCON - HOCON syntax applies.
[
{
"name" : "Generic Currency",
"id": "eca:generic",
"uuid": "00000000-086a-b989-0000-000000526bc6", # This specific UUID marks your primary currency. This UUID must be considered constant.
# The supply attribute describes the format that should be used when formatting a currency
"supply": [
{
"priority": 1, # Higher priority means applied later. In this case the format with the lowest applicable priority scalar value is choosen.
@Geolykt
Geolykt / build.gradle
Created June 8, 2023 16:31
GcmcStarplane example configuration
plugins {
id 'java'
id 'java-library'
id 'gcmc-starplane' version '0.1.0'
}
group 'de.geolykt'
def archivesBaseName = 'gcmc-test'
version '1.0.0-SNAPSHOT'