From 7bc670426ca7c38354968f488f80c93e13eba67f Mon Sep 17 00:00:00 2001 From: orifu Date: Sun, 2 Jun 2024 09:29:00 -0500 Subject: [PATCH] 1.21 era --- build.gradle | 2 ++ gradle.properties | 10 +++++----- src/main/java/io/ix0rai/rainglow/Rainglow.java | 2 +- .../io/ix0rai/rainglow/config/CustomModeScreen.java | 4 ++-- .../java/io/ix0rai/rainglow/data/RainglowColour.java | 6 +++--- .../io/ix0rai/rainglow/mixin/GlowSquidEntityMixin.java | 10 +++++----- src/main/resources/fabric.mod.json | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index 6a48f21..17c2b86 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,8 @@ repositories { maven { url = "https://maven.terraformersmc.com/releases/" } maven { url = "https://maven.quiltmc.org/repository/release/" } maven { url = "https://repo.sleeping.town/" } + + flatDir { dirs 'lib' } } configurations { diff --git a/gradle.properties b/gradle.properties index ab82f98..d21b847 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G # minecraft, mappings and loader dependencies # check these on https://modmuss50.me/fabric.html -minecraft_version=1.20.6 -quilt_mappings=6 +minecraft_version=1.21 +quilt_mappings=1 loader_version=0.15.11 # mod properties -mod_version=1.3.1+mc1.20.6 +mod_version=1.3.2+mc1.21 maven_group=rainglow archives_base_name=rainglow # other dependencies java_version=21 -mod_menu_version=10.0.0-beta.1 -fabric_api_version=0.98.0+1.20.6 +mod_menu_version=11.0.0-beta.1 +fabric_api_version=0.100.1+1.21 diff --git a/src/main/java/io/ix0rai/rainglow/Rainglow.java b/src/main/java/io/ix0rai/rainglow/Rainglow.java index 7999547..fd2c00a 100644 --- a/src/main/java/io/ix0rai/rainglow/Rainglow.java +++ b/src/main/java/io/ix0rai/rainglow/Rainglow.java @@ -50,7 +50,7 @@ public void onInitialize() { } public static Identifier id(String id) { - return new Identifier(MOD_ID, id); + return Identifier.of(MOD_ID, id); } public static String generateRandomColourId(RandomGenerator random) { diff --git a/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java b/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java index 02df6b1..0f4d6bf 100644 --- a/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java +++ b/src/main/java/io/ix0rai/rainglow/config/CustomModeScreen.java @@ -76,12 +76,12 @@ private void save() { } @Override - public void init() { + public void method_60325() { HeaderFooterLayoutWidget headerFooterWidget = new HeaderFooterLayoutWidget(this, 61, 33); headerFooterWidget.addToHeader(new TextWidget(TITLE, this.textRenderer), settings -> settings.alignHorizontallyCenter().setBottomPadding(28)); if (!this.isConfirming) { - ButtonListWidget buttonListWidget = headerFooterWidget.addToContents(new ButtonListWidget(this.client, this.width, this.height, this)); + ButtonListWidget buttonListWidget = headerFooterWidget.addToContents(new ButtonListWidget(this.client, this.width, this)); createColourToggles(); buttonListWidget.addEntries(this.options.toArray(new Option[0])); diff --git a/src/main/java/io/ix0rai/rainglow/data/RainglowColour.java b/src/main/java/io/ix0rai/rainglow/data/RainglowColour.java index f87b2e9..0b29c6b 100644 --- a/src/main/java/io/ix0rai/rainglow/data/RainglowColour.java +++ b/src/main/java/io/ix0rai/rainglow/data/RainglowColour.java @@ -58,15 +58,15 @@ public Identifier getTexture(RainglowEntity entityType) { switch (entity) { case GLOW_SQUID -> { String textureName = RainglowEntity.GLOW_SQUID.getDefaultColour() == this ? "glow_squid" : this.getId(); - this.textures.put(entity, new Identifier("textures/entity/squid/" + textureName + ".png")); + this.textures.put(entity, Identifier.ofDefault("textures/entity/squid/" + textureName + ".png")); } case ALLAY -> { String textureName = RainglowEntity.ALLAY.getDefaultColour() == this ? "allay" : this.getId(); - this.textures.put(entity, new Identifier("textures/entity/allay/" + textureName + ".png")); + this.textures.put(entity, Identifier.ofDefault("textures/entity/allay/" + textureName + ".png")); } case SLIME -> { String textureName = RainglowEntity.SLIME.getDefaultColour() == this ? "slime" : this.getId(); - this.textures.put(entity, new Identifier("textures/entity/slime/" + textureName + ".png")); + this.textures.put(entity, Identifier.ofDefault("textures/entity/slime/" + textureName + ".png")); } } } diff --git a/src/main/java/io/ix0rai/rainglow/mixin/GlowSquidEntityMixin.java b/src/main/java/io/ix0rai/rainglow/mixin/GlowSquidEntityMixin.java index a74ff8b..b83a68d 100644 --- a/src/main/java/io/ix0rai/rainglow/mixin/GlowSquidEntityMixin.java +++ b/src/main/java/io/ix0rai/rainglow/mixin/GlowSquidEntityMixin.java @@ -34,13 +34,13 @@ protected void initDataTracker(Builder builder, CallbackInfo ci) { @Inject(method = "writeCustomDataToNbt", at = @At("TAIL")) public void writeCustomDataToNbt(NbtCompound nbt, CallbackInfo ci) { - RainglowColour colour = Rainglow.getColour(RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.getRandom()); + RainglowColour colour = Rainglow.getColour(RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.random); nbt.putString(Rainglow.CUSTOM_NBT_KEY, colour.getId()); } @Inject(method = "readCustomDataFromNbt", at = @At("TAIL")) public void readCustomDataFromNbt(NbtCompound nbt, CallbackInfo ci) { - this.setVariant(RainglowEntity.GLOW_SQUID.readNbt(nbt, this.getRandom())); + this.setVariant(RainglowEntity.GLOW_SQUID.readNbt(nbt, this.random)); } /** @@ -49,7 +49,7 @@ public void readCustomDataFromNbt(NbtCompound nbt, CallbackInfo ci) { */ @Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V"), cancellable = true) public void tickMovement(CallbackInfo ci) { - RainglowColour colour = Rainglow.getColour(RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.getRandom()); + RainglowColour colour = Rainglow.getColour(RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.random); if (colour != RainglowColour.BLUE) { // we add 100 to g to let the mixin know that we want to override the method @@ -60,7 +60,7 @@ public void tickMovement(CallbackInfo ci) { @Override public RainglowColour getVariant() { - return Rainglow.getColour(RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.getRandom()); + return Rainglow.getColour(RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.random); } @Override @@ -85,7 +85,7 @@ protected SquidEntityMixin(EntityType entityType, private int spawnParticles(ServerWorld instance, ParticleEffect particle, double x, double y, double z, int count, double deltaX, double deltaY, double deltaZ, double speed) { if (((Object) this) instanceof GlowSquidEntity) { // send in custom colour data - RainglowColour colour = Rainglow.getColour(RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.getRandom()); + RainglowColour colour = Rainglow.getColour(RainglowEntity.GLOW_SQUID, this.getDataTracker(), this.random); int index = colour.ordinal(); // round x to 1 decimal place and append index data to the next two return ((ServerWorld) this.getWorld()).spawnParticles(particle, (Math.round(x * 10)) / 10D + index / 1000D, y + 0.5, z, 0, deltaX, deltaY, deltaZ, speed); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index e183bb0..580f8fd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -40,7 +40,7 @@ "fabricloader": ">=0.14.19", "fabric-resource-loader-v0": "*", "fabric-networking-api-v1": "*", - "minecraft": ">=1.20.6" + "minecraft": ">=1.21-" }, "suggests": {