Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
UnRealDinnerbone committed Jun 13, 2024
1 parent 2213868 commit 7fd6307
Show file tree
Hide file tree
Showing 29 changed files with 81 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
!contains(github.event.head_commit.message, '[ciskip]')
uses: nanite/workflows/.github/workflows/[email protected]
with:
java-version: 17
java-version: 21
changelog-file: "./CHANGELOG.md"
release-to-github: false
secrets:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ jobs:
secrets:
nanite-token: ${{ secrets.NANITE_DEPLOY }}
with:
java-version: 21
use-snapshots: true
gradle-tasks: build publish
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### 4.0.4
### 6.0.0

- Fix Advancement not working
- Update to Minecraft 1.21
30 changes: 14 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
plugins {
id("dev.nanite.mlp") version("0.1.1")
id("dev.nanite.mlp") version("0.1.10")
id("java-library")
id("maven-publish")
id("me.modmuss50.mod-publish-plugin") version "0.3.0"
}


java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

multiLoader.root() {
minecraftVersion.set(project.property("minecraft_version"))
modID.set(project.property("mod_id"))
splitSources.set(true)
convertAccessWidener.set(true)
accessWidenerFile.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
dataGen {
useFabric.set(project(":common").file("src/generated/resources"))
}

}

allprojects {
Expand All @@ -38,16 +38,20 @@ subprojects {

sourceSets.main.resources.srcDir project.file('src/generated/resources')

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.toolchain.languageVersion = JavaLanguageVersion.of(21)


base {
archivesName = "${project.property("mod_name")}-${project.name}".toLowerCase()
}
repositories {
maven {
name = "Creeperhost"
url = uri("https://maven.creeperhost.net/")
name = "NeoForge"
url = "https://maven.neoforged.net/"
}
maven {
name = "Fabric"
url = "https://maven.fabricmc.net/"
}
maven {
name = "Nanite"
Expand All @@ -58,6 +62,10 @@ subprojects {
outputs.upToDateWhen { false }
}

test {
enabled = false
}

publishing {
repositories {
if (providers.environmentVariable("NANITE_TOKEN").isPresent()) {
Expand Down Expand Up @@ -95,12 +103,6 @@ publishMods {
modLoaders.add("fabric")
}

def forgeOptions = publishOptions {
file = project.provider { project(":forge").tasks.jar }.flatMap { it.archiveFile }
displayName = "${project.name} Forge ${mod_version}+mc${minecraft_version}"
modLoaders.add("forge")
}

def neoOptions = publishOptions {
file = project.provider { project(":neo").tasks.jar }.flatMap { it.archiveFile }
displayName = "${project.name} Neo ${mod_version}+mc${minecraft_version}"
Expand All @@ -124,10 +126,6 @@ publishMods {
}
}

curseforge("curseforgeForge") {
from(curseForgeOptions, forgeOptions)
}

curseforge("curseforgeNeoForge") {
from(curseForgeOptions, neoOptions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

public class ObsidianBoatRender extends BoatRenderer {

public static final ModelLayerLocation LOCATION = new ModelLayerLocation(new ResourceLocation(ObsidianBoat.MOD_ID, "obsidian_boat"), "main");
public static final ModelLayerLocation LOCATION = new ModelLayerLocation(ObsidianBoat.rl( "obsidian_boat"), "main");


private final ResourceLocation texture;
public ObsidianBoatRender(EntityRendererProvider.Context dispatcher) {
super(dispatcher, false);
this.texture = new ResourceLocation(ObsidianBoat.MOD_ID, "textures/entity/obsidian_boat.png");
this.texture = ObsidianBoat.rl("textures/entity/obsidian_boat.png");
boatResources = Map.of(Boat.Type.OAK, Pair.of(texture, new BoatModel(dispatcher.bakeLayer(LOCATION))));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2023-08-09T14:45:43.8652388 Obsidian Boat/Model Definitions
// 1.21 2024-06-13T13:28:52.2696503 Obsidian Boat/Model Definitions
db54f38a1594a0f71ae2b4dd7367a72f9ba6d320 assets\obsidianboat\models\item\obsidian_boat.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2023-08-09T14:45:43.8648864 Obsidian Boat/Language (en_us)
// 1.21 2024-06-13T13:28:52.2691514 Obsidian Boat/Language (en_us)
a7d157e3941a596cf1a9fb9925adc58d085baaab assets\obsidianboat\lang\en_us.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2023-08-09T14:45:43.8633813 Obsidian Boat/Advancements
0add7ba9f9ed61d9dac42378e162dcd94f9bd98e data\obsidianboat\advancements\obsidianboat.json
// 1.21 2024-06-13T13:28:52.2682707 Obsidian Boat/Advancements
a3bb6ad0acd6d446a0a03d2af19e4a3249a8791c data\obsidianboat\advancement\obsidianboat.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// 1.20.1 2023-08-09T14:45:43.8657489 Obsidian Boat/Recipes
42167c87c3b2c9db6d765326f2c81d2ab816b20a data\obsidianboat\advancements\recipes\transportation\obsidian_boat.json
8d0abd28f06bfb7ca69ca3bd3ec89ab50b768085 data\obsidianboat\recipes\obsidian_boat.json
// 1.21 2024-06-13T13:28:52.2696503 Obsidian Boat/Recipes
88bfc7f370ddda39ba5b85ee4c9fae3e4a9420ee data\obsidianboat\advancement\recipes\transportation\obsidian_boat.json
aeb9d6e53f55eae54734aef38ef40191be6c6a44 data\obsidianboat\recipe\obsidian_boat.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.20.1 2023-08-09T14:45:43.8638815 Obsidian Boat/Pack Metadata
bf3a2399e4449bd8af5b7765ddce0ed0a7d28f19 pack.mcmeta
// 1.21 2024-06-13T13:28:52.2691514 Obsidian Boat/Pack Metadata
45d700dacf244919424ad2a9fbc4bf645abb3040 pack.mcmeta
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
},
"hidden": true,
"icon": {
"item": "obsidianboat:obsidian_boat"
"count": 1,
"id": "obsidianboat:obsidian_boat"
},
"title": {
"translate": "advancements.obsidianboat.root.title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"conditions": {
"items": [
{
"items": [
"minecraft:obsidian"
]
"items": "minecraft:obsidian"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"OOO"
],
"result": {
"item": "obsidianboat:obsidian_boat"
"count": 1,
"id": "obsidianboat:obsidian_boat"
}
}
2 changes: 1 addition & 1 deletion common/src/generated/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "obsidianboat",
"pack_format": 26
"pack_format": 48
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package com.unrealdinnerbone.obsidianboat;

import com.unrealdinnerbone.trenzalore.lib.RLUtils;
import net.minecraft.resources.ResourceLocation;

public class ObsidianBoat {
public static final String MOD_ID = "obsidianboat";


public static ResourceLocation rl(String path) {
return RLUtils.rl(MOD_ID, path);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,35 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.unrealdinnerbone.obsidianboat.ObsidianBoat;
import com.unrealdinnerbone.trenzalore.lib.RLUtils;
import net.minecraft.advancements.critereon.ContextAwarePredicate;
import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.ExtraCodecs;
import org.jetbrains.annotations.NotNull;

import java.util.Optional;

public class BoatTrigger extends SimpleCriterionTrigger<BoatTrigger.Instance> {

public static final ResourceLocation ID = new ResourceLocation(ObsidianBoat.MOD_ID, ObsidianBoat.MOD_ID);
public static final ResourceLocation ID = ObsidianBoat.rl(ObsidianBoat.MOD_ID);

public void trigger(ServerPlayer serverPlayerEntity) {
this.trigger(serverPlayerEntity, (value) -> true);
}

@Override
@NotNull
public Codec<Instance> codec() {
return Instance.CODEC;
}

public static record Instance(Optional<ContextAwarePredicate> player) implements SimpleCriterionTrigger.SimpleInstance {

public static final Codec<Instance> CODEC = RecordCodecBuilder.create((instance) ->
instance.group(ExtraCodecs.strictOptionalField(EntityPredicate.ADVANCEMENT_CODEC, "player")
.forGetter(Instance::player))
instance.group(EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("player").forGetter(Instance::player))
.apply(instance, Instance::new));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,28 @@
import net.minecraft.advancements.critereon.ChangeDimensionTrigger;
import net.minecraft.advancements.critereon.ContextAwarePredicate;
import net.minecraft.advancements.critereon.ItemUsedOnLocationTrigger;
import net.minecraft.core.HolderLookup;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;

import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;

public class AdvancementProvider extends FabricAdvancementProvider {

public AdvancementProvider(FabricDataOutput output) {
super(output);
public AdvancementProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registryLookup) {
super(output, registryLookup);
}

@Override
public void generateAdvancement(Consumer<AdvancementHolder> consumer) {
public void generateAdvancement(HolderLookup.Provider registryLookup, Consumer<AdvancementHolder> consumer) {


consumer.accept(Advancement.Builder.advancement()
.display(OBRegistry.BOAT_ITEM.get(), getTranslation("title"), getTranslation("description"), null, AdvancementType.TASK, true, true, true)
.addCriterion("placed_boat", OBRegistry.BOAT_TRIGGER.get().createCriterion(new BoatTrigger.Instance(Optional.empty())))
.build(new ResourceLocation(ObsidianBoat.MOD_ID, ObsidianBoat.MOD_ID)));
.build(ObsidianBoat.rl( ObsidianBoat.MOD_ID)));



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import com.unrealdinnerbone.obsidianboat.OBRegistry;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider;
import net.minecraft.core.HolderLookup;

import java.util.concurrent.CompletableFuture;

public class LangProvider extends FabricLanguageProvider {

protected LangProvider(FabricDataOutput dataOutput) {
super(dataOutput);
protected LangProvider(FabricDataOutput dataOutput, CompletableFuture<HolderLookup.Provider> registryLookup) {
super(dataOutput, registryLookup);
}

@Override
public void generateTranslations(TranslationBuilder translationBuilder) {
public void generateTranslations(HolderLookup.Provider registryLookup, TranslationBuilder translationBuilder) {
translationBuilder.add(OBRegistry.BOAT_ITEM.get(), "Obsidian Boat");
translationBuilder.add(OBRegistry.ENTITY_TYPE.get(), "Obsidian Boat");
translationBuilder.add("advancements.obsidianboat.root.description", "Did you really think that would work?");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
import com.unrealdinnerbone.obsidianboat.ObsidianBoat;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.ShapedRecipeBuilder;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;

import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;

public class RecipeProvider extends FabricRecipeProvider {

public RecipeProvider(FabricDataOutput output) {
super(output);
public RecipeProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registryLookup) {
super(output, registryLookup);
}

@Override
Expand All @@ -25,6 +27,6 @@ public void buildRecipes(RecipeOutput exporter) {
.pattern("O O")
.pattern("OOO")
.unlockedBy("has_obsidian", has(Blocks.OBSIDIAN))
.define('O', Blocks.OBSIDIAN).save(exporter, new ResourceLocation(ObsidianBoat.MOD_ID, "obsidian_boat"));
.define('O', Blocks.OBSIDIAN).save(exporter, ObsidianBoat.rl("obsidian_boat"));
}
}
33 changes: 0 additions & 33 deletions forge/build.gradle

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7fd6307

Please sign in to comment.