Skip to content

Instantly share code, notes, and snippets.

View maityyy's full-sized avatar
🐢
Lazily doing something

maityyy

🐢
Lazily doing something
  • My brain
View GitHub Profile
@Mixin(ShipwreckPiece.class)
class ShipwreckPieceMixin {
// Fix https://bugs.mojang.com/browse/MC-131745
@Redirect(method = "postProcess", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/RandomSource;nextInt(I)I"))
int usePositionalRandom(RandomSource random, int randomBound) {
var self = (ShipwreckPiece) (Object) this;
return self.placeSettings().getRandom(self.templatePosition().atY(0)).nextInt(randomBound);
}
}
@maityyy
maityyy / build.gradle
Last active January 31, 2024 19:10
Simple mixin hotswap for fabric development (works as far as I know from loom 1.2)
afterEvaluate {
loom.runs.configureEach {
// https://fabricmc.net/wiki/tutorial:mixin_hotswaps
vmArg "-javaagent:${ configurations.compileClasspath.find { it.name.contains("sponge-mixin") } }"
}
}
@maityyy
maityyy / build.gradle
Last active July 14, 2023 12:25
JSON comments in gralde (they will be removed at build time)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.groovy:groovy-json:4.0.0-beta-2'
}
}
import groovy.json.JsonOutput
@maityyy
maityyy / build.gradle
Last active July 14, 2023 12:28
Paper NMS dependency in gradle
import java.nio.channels.Channels
def paper = { String version ->
String paperPath = this.gradle.getGradleHomeDir().getAbsolutePath() + "\\papers\\paper-${version}.jar"
File paper = new File(paperPath)
if (paper.parentFile != null || !paper.parentFile.exists()) {
paper.parentFile.mkdir()
}