Skip to content

Commit

Permalink
Update to Fabric 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
MattCzyr committed Jun 21, 2024
1 parent be20b33 commit 263bb8e
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 72 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
## Version 3.0.2
#### NeoForge 1.20.6
#### NeoForge 1.21, 1.20.6
- Updated to NeoForge 1.21
- Fixed uncraftable Nature's Compass recipe

# Version 2.2.5
#### Fabric 1.20.6
#### Fabric 1.21, 1.20.6
- Updated to Fabric 1.21
- Fixed uncraftable Nature's Compass recipe

## Version 1.11.6
#### Forge 1.20.6
#### Forge 1.21, 1.20.6
- Updated to Forge 1.21
- Fixed uncraftable Nature's Compass recipe

## Version 3.0.1
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.10
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11

# Mod Properties
mod_version=1.20.6-2.2.5-fabric
mod_version=1.21-2.2.5-fabric
maven_group=com.chaosthedude.naturescompass
archives_base_name=naturescompass

# Dependencies
fabric_version=0.97.8+1.20.6
fabric_version=0.100.3+1.21
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
32 changes: 16 additions & 16 deletions src/main/java/com/chaosthedude/naturescompass/NaturesCompass.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.component.DataComponentType;
import net.minecraft.component.ComponentType;
import net.minecraft.item.ItemGroups;
import net.minecraft.network.codec.PacketCodecs;
import net.minecraft.registry.Registries;
Expand All @@ -34,13 +34,13 @@ public class NaturesCompass implements ModInitializer {

public static final NaturesCompassItem NATURES_COMPASS_ITEM = new NaturesCompassItem();

public static final DataComponentType<String> BIOME_ID_COMPONENT = DataComponentType.<String>builder().codec(Codec.STRING).packetCodec(PacketCodecs.STRING).build();
public static final DataComponentType<Integer> COMPASS_STATE_COMPONENT = DataComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final DataComponentType<Integer> FOUND_X_COMPONENT = DataComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final DataComponentType<Integer> FOUND_Z_COMPONENT = DataComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final DataComponentType<Integer> SEARCH_RADIUS_COMPONENT = DataComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final DataComponentType<Integer> SAMPLES_COMPONENT = DataComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final DataComponentType<Boolean> DISPLAY_COORDS_COMPONENT = DataComponentType.<Boolean>builder().codec(Codec.BOOL).packetCodec(PacketCodecs.BOOL).build();
public static final ComponentType<String> BIOME_ID_COMPONENT = ComponentType.<String>builder().codec(Codec.STRING).packetCodec(PacketCodecs.STRING).build();
public static final ComponentType<Integer> COMPASS_STATE_COMPONENT = ComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final ComponentType<Integer> FOUND_X_COMPONENT = ComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final ComponentType<Integer> FOUND_Z_COMPONENT = ComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final ComponentType<Integer> SEARCH_RADIUS_COMPONENT = ComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final ComponentType<Integer> SAMPLES_COMPONENT = ComponentType.<Integer>builder().codec(Codec.INT).packetCodec(PacketCodecs.INTEGER).build();
public static final ComponentType<Boolean> DISPLAY_COORDS_COMPONENT = ComponentType.<Boolean>builder().codec(Codec.BOOL).packetCodec(PacketCodecs.BOOL).build();

public static boolean canTeleport;
public static List<Identifier> allowedBiomes;
Expand All @@ -50,15 +50,15 @@ public class NaturesCompass implements ModInitializer {
public void onInitialize() {
NaturesCompassConfig.load();

Registry.register(Registries.ITEM, new Identifier(MODID, "naturescompass"), NATURES_COMPASS_ITEM);
Registry.register(Registries.ITEM, Identifier.of(MODID, "naturescompass"), NATURES_COMPASS_ITEM);

Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(MODID, "biome_id"), BIOME_ID_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(MODID, "compass_state"), COMPASS_STATE_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(MODID, "found_x"), FOUND_X_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(MODID, "found_z"), FOUND_Z_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(MODID, "search_radius"), SEARCH_RADIUS_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(MODID, "samples"), SAMPLES_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, new Identifier(MODID, "display_coords"), DISPLAY_COORDS_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(MODID, "biome_id"), BIOME_ID_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(MODID, "compass_state"), COMPASS_STATE_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(MODID, "found_x"), FOUND_X_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(MODID, "found_z"), FOUND_Z_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(MODID, "search_radius"), SEARCH_RADIUS_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(MODID, "samples"), SAMPLES_COMPONENT);
Registry.register(Registries.DATA_COMPONENT_TYPE, Identifier.of(MODID, "display_coords"), DISPLAY_COORDS_COMPONENT);

ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(entries -> entries.add(NATURES_COMPASS_ITEM));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class NaturesCompassClient implements ClientModInitializer {
public void onInitializeClient() {
ClientPlayNetworking.registerGlobalReceiver(SyncPacket.PACKET_ID, SyncPacket::apply);

ModelPredicateProviderRegistry.register(NaturesCompass.NATURES_COMPASS_ITEM, new Identifier("angle"), new ClampedModelPredicateProvider() {
ModelPredicateProviderRegistry.register(NaturesCompass.NATURES_COMPASS_ITEM, Identifier.of(NaturesCompass.MODID, "angle"), new ClampedModelPredicateProvider() {
private double rotation;
private double rota;
private long lastUpdateTick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ public int getFoundBiomeZ(ItemStack stack) {

public Identifier getBiomeID(ItemStack stack) {
if (ItemUtils.isCompass(stack) && stack.contains(NaturesCompass.BIOME_ID_COMPONENT)) {
return new Identifier(stack.get(NaturesCompass.BIOME_ID_COMPONENT));
return Identifier.of(stack.get(NaturesCompass.BIOME_ID_COMPONENT));
}

return new Identifier("");
return Identifier.of("", "");
}

public int getSearchRadius(ItemStack stack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
Expand All @@ -32,8 +33,8 @@ public class HUDMixin {
@Final
private MinecraftClient client;

@Inject(method = "render(Lnet/minecraft/client/gui/DrawContext;F)V", at = @At(value = "TAIL"))
private void renderCompassInfo(DrawContext context, float tickDelta, CallbackInfo info) {
@Inject(method = "render(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/client/render/RenderTickCounter;)V", at = @At(value = "TAIL"))
private void renderCompassInfo(DrawContext context, RenderTickCounter tickCounter, CallbackInfo info) {
if (client.player != null && client.world != null && !client.options.hudHidden && !client.getDebugHud().shouldShowDebugHud() && (client.currentScreen == null || (NaturesCompassConfig.displayWithChatOpen && client.currentScreen instanceof ChatScreen))) {
final PlayerEntity player = client.player;
final ItemStack stack = ItemUtils.getHeldNatureCompass(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

public record SearchPacket(Identifier biomeID, BlockPos pos) implements CustomPayload {

public static final CustomPayload.Id<SearchPacket> PACKET_ID = new CustomPayload.Id<>(new Identifier(NaturesCompass.MODID, "search"));
public static final CustomPayload.Id<SearchPacket> PACKET_ID = new CustomPayload.Id<>(Identifier.of(NaturesCompass.MODID, "search"));

public static final PacketCodec<RegistryByteBuf, SearchPacket> PACKET_CODEC = PacketCodec.of(SearchPacket::write, SearchPacket::read);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

public record SyncPacket(boolean canTeleport, List<Identifier> allowedBiomeIDs, ListMultimap<Identifier, Identifier> dimensionIDsForAllowedBiomeIDs) implements CustomPayload {

public static final CustomPayload.Id<SyncPacket> PACKET_ID = new CustomPayload.Id<>(new Identifier(NaturesCompass.MODID, "sync"));
public static final CustomPayload.Id<SyncPacket> PACKET_ID = new CustomPayload.Id<>(Identifier.of(NaturesCompass.MODID, "sync"));

public static final PacketCodec<RegistryByteBuf, SyncPacket> PACKET_CODEC = PacketCodec.of(SyncPacket::write, SyncPacket::read);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public record TeleportPacket() implements CustomPayload {

public static final CustomPayload.Id<TeleportPacket> PACKET_ID = new CustomPayload.Id<>(new Identifier(NaturesCompass.MODID, "teleport"));
public static final CustomPayload.Id<TeleportPacket> PACKET_ID = new CustomPayload.Id<>(Identifier.of(NaturesCompass.MODID, "teleport"));

public static final PacketCodec<RegistryByteBuf, TeleportPacket> PACKET_CODEC = PacketCodec.of(TeleportPacket::write, TeleportPacket::read);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ public static String getBiomeTags(World world, Biome biome) {
if (fixedPath.contains("/")) {
fixedPath = fixedPath.substring(0, fixedPath.indexOf("/"));
}
String biomeKey = Util.createTranslationKey("biome", new Identifier(tag.id().getNamespace(), fixedPath));
String biomeKey = Util.createTranslationKey("biome", Identifier.of(tag.id().getNamespace(), fixedPath));
String translatedBiomeKey = I18n.translate(biomeKey);
if (!biomeKey.equals(translatedBiomeKey)) {
return translatedBiomeKey;
}
String categoryKey = Util.createTranslationKey("category", new Identifier(tag.id().getNamespace(), fixedPath));
String categoryKey = Util.createTranslationKey("category", Identifier.of(tag.id().getNamespace(), fixedPath));
String translatedCategoryKey = I18n.translate(categoryKey);
if (!categoryKey.equals(translatedCategoryKey)) {
return translatedCategoryKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,38 @@
"layer0": "naturescompass:item/naturescompass_16"
},
"overrides": [
{ "predicate": { "angle": 0.000000 }, "model": "naturescompass:item/naturescompass" },
{ "predicate": { "angle": 0.015625 }, "model": "naturescompass:item/naturescompass_17" },
{ "predicate": { "angle": 0.046875 }, "model": "naturescompass:item/naturescompass_18" },
{ "predicate": { "angle": 0.078125 }, "model": "naturescompass:item/naturescompass_19" },
{ "predicate": { "angle": 0.109375 }, "model": "naturescompass:item/naturescompass_20" },
{ "predicate": { "angle": 0.140625 }, "model": "naturescompass:item/naturescompass_21" },
{ "predicate": { "angle": 0.171875 }, "model": "naturescompass:item/naturescompass_22" },
{ "predicate": { "angle": 0.203125 }, "model": "naturescompass:item/naturescompass_23" },
{ "predicate": { "angle": 0.234375 }, "model": "naturescompass:item/naturescompass_24" },
{ "predicate": { "angle": 0.265625 }, "model": "naturescompass:item/naturescompass_25" },
{ "predicate": { "angle": 0.296875 }, "model": "naturescompass:item/naturescompass_26" },
{ "predicate": { "angle": 0.328125 }, "model": "naturescompass:item/naturescompass_27" },
{ "predicate": { "angle": 0.359375 }, "model": "naturescompass:item/naturescompass_28" },
{ "predicate": { "angle": 0.390625 }, "model": "naturescompass:item/naturescompass_29" },
{ "predicate": { "angle": 0.421875 }, "model": "naturescompass:item/naturescompass_30" },
{ "predicate": { "angle": 0.453125 }, "model": "naturescompass:item/naturescompass_31" },
{ "predicate": { "angle": 0.484375 }, "model": "naturescompass:item/naturescompass_00" },
{ "predicate": { "angle": 0.515625 }, "model": "naturescompass:item/naturescompass_01" },
{ "predicate": { "angle": 0.546875 }, "model": "naturescompass:item/naturescompass_02" },
{ "predicate": { "angle": 0.578125 }, "model": "naturescompass:item/naturescompass_03" },
{ "predicate": { "angle": 0.609375 }, "model": "naturescompass:item/naturescompass_04" },
{ "predicate": { "angle": 0.640625 }, "model": "naturescompass:item/naturescompass_05" },
{ "predicate": { "angle": 0.671875 }, "model": "naturescompass:item/naturescompass_06" },
{ "predicate": { "angle": 0.703125 }, "model": "naturescompass:item/naturescompass_07" },
{ "predicate": { "angle": 0.734375 }, "model": "naturescompass:item/naturescompass_08" },
{ "predicate": { "angle": 0.765625 }, "model": "naturescompass:item/naturescompass_09" },
{ "predicate": { "angle": 0.796875 }, "model": "naturescompass:item/naturescompass_10" },
{ "predicate": { "angle": 0.828125 }, "model": "naturescompass:item/naturescompass_11" },
{ "predicate": { "angle": 0.859375 }, "model": "naturescompass:item/naturescompass_12" },
{ "predicate": { "angle": 0.890625 }, "model": "naturescompass:item/naturescompass_13" },
{ "predicate": { "angle": 0.921875 }, "model": "naturescompass:item/naturescompass_14" },
{ "predicate": { "angle": 0.953125 }, "model": "naturescompass:item/naturescompass_15" },
{ "predicate": { "angle": 0.984375 }, "model": "naturescompass:item/naturescompass" }
{ "predicate": { "naturescompass:angle": 0.000000 }, "model": "naturescompass:item/naturescompass" },
{ "predicate": { "naturescompass:angle": 0.015625 }, "model": "naturescompass:item/naturescompass_17" },
{ "predicate": { "naturescompass:angle": 0.046875 }, "model": "naturescompass:item/naturescompass_18" },
{ "predicate": { "naturescompass:angle": 0.078125 }, "model": "naturescompass:item/naturescompass_19" },
{ "predicate": { "naturescompass:angle": 0.109375 }, "model": "naturescompass:item/naturescompass_20" },
{ "predicate": { "naturescompass:angle": 0.140625 }, "model": "naturescompass:item/naturescompass_21" },
{ "predicate": { "naturescompass:angle": 0.171875 }, "model": "naturescompass:item/naturescompass_22" },
{ "predicate": { "naturescompass:angle": 0.203125 }, "model": "naturescompass:item/naturescompass_23" },
{ "predicate": { "naturescompass:angle": 0.234375 }, "model": "naturescompass:item/naturescompass_24" },
{ "predicate": { "naturescompass:angle": 0.265625 }, "model": "naturescompass:item/naturescompass_25" },
{ "predicate": { "naturescompass:angle": 0.296875 }, "model": "naturescompass:item/naturescompass_26" },
{ "predicate": { "naturescompass:angle": 0.328125 }, "model": "naturescompass:item/naturescompass_27" },
{ "predicate": { "naturescompass:angle": 0.359375 }, "model": "naturescompass:item/naturescompass_28" },
{ "predicate": { "naturescompass:angle": 0.390625 }, "model": "naturescompass:item/naturescompass_29" },
{ "predicate": { "naturescompass:angle": 0.421875 }, "model": "naturescompass:item/naturescompass_30" },
{ "predicate": { "naturescompass:angle": 0.453125 }, "model": "naturescompass:item/naturescompass_31" },
{ "predicate": { "naturescompass:angle": 0.484375 }, "model": "naturescompass:item/naturescompass_00" },
{ "predicate": { "naturescompass:angle": 0.515625 }, "model": "naturescompass:item/naturescompass_01" },
{ "predicate": { "naturescompass:angle": 0.546875 }, "model": "naturescompass:item/naturescompass_02" },
{ "predicate": { "naturescompass:angle": 0.578125 }, "model": "naturescompass:item/naturescompass_03" },
{ "predicate": { "naturescompass:angle": 0.609375 }, "model": "naturescompass:item/naturescompass_04" },
{ "predicate": { "naturescompass:angle": 0.640625 }, "model": "naturescompass:item/naturescompass_05" },
{ "predicate": { "naturescompass:angle": 0.671875 }, "model": "naturescompass:item/naturescompass_06" },
{ "predicate": { "naturescompass:angle": 0.703125 }, "model": "naturescompass:item/naturescompass_07" },
{ "predicate": { "naturescompass:angle": 0.734375 }, "model": "naturescompass:item/naturescompass_08" },
{ "predicate": { "naturescompass:angle": 0.765625 }, "model": "naturescompass:item/naturescompass_09" },
{ "predicate": { "naturescompass:angle": 0.796875 }, "model": "naturescompass:item/naturescompass_10" },
{ "predicate": { "naturescompass:angle": 0.828125 }, "model": "naturescompass:item/naturescompass_11" },
{ "predicate": { "naturescompass:angle": 0.859375 }, "model": "naturescompass:item/naturescompass_12" },
{ "predicate": { "naturescompass:angle": 0.890625 }, "model": "naturescompass:item/naturescompass_13" },
{ "predicate": { "naturescompass:angle": 0.921875 }, "model": "naturescompass:item/naturescompass_14" },
{ "predicate": { "naturescompass:angle": 0.953125 }, "model": "naturescompass:item/naturescompass_15" },
{ "predicate": { "naturescompass:angle": 0.984375 }, "model": "naturescompass:item/naturescompass" }
]
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
],
"accessWidener" : "naturescompass.accesswidener",
"depends": {
"fabricloader": ">=0.15.10",
"fabricloader": ">=0.15.11",
"fabric-api": "*",
"minecraft": "~1.20.6",
"minecraft": "~1.21",
"java": ">=21"
},
"suggests": {
Expand Down

0 comments on commit 263bb8e

Please sign in to comment.