diff --git a/winterly-fabric/build.gradle.kts b/winterly-fabric/build.gradle.kts index d5dcf53..8f86a62 100644 --- a/winterly-fabric/build.gradle.kts +++ b/winterly-fabric/build.gradle.kts @@ -37,7 +37,8 @@ dependencies { modImplementation("net.fabricmc:fabric-loader:${rootProject.property("fabric_loader_version")}") modApi("net.fabricmc.fabric-api:fabric-api:${rootProject.property("fabric_api_version")}") - modCompileOnly("dev.emi:trinkets:${rootProject.property("trinkets_version")}") +// modLocalRuntime("dev.emi:trinkets:${rootProject.property("trinkets_version")}") + modApi(files("trinkets-3.10.0.jar")) modImplementation("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${rootProject.property("cca_version")}") modImplementation("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${rootProject.property("cca_version")}") diff --git a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/WinterlyFabric.java b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/WinterlyFabric.java index 765dfe7..e33b2c5 100644 --- a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/WinterlyFabric.java +++ b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/WinterlyFabric.java @@ -29,19 +29,19 @@ public void onInitialize() { WinterlyBlockEntities.init(); WinterlyFeatures.init(); - if(FabricLoader.getInstance().isModLoaded("owo")) { - WinterlyOwoLibIntegration.initItemGroup(); - ItemGroupEvents.modifyEntriesEvent(BuiltInRegistries.CREATIVE_MODE_TAB.getResourceKey(itemGroup).get()).register(entries -> { - CommonWinterlyItems.ITEMS.forEach((id, sup) -> entries.accept(BuiltInRegistries.ITEM.get(id))); - CommonWinterlyBlocks.BLOCKS.forEach((id, sup) -> entries.accept(BuiltInRegistries.ITEM.get(id))); - }); - } +// if(FabricLoader.getInstance().isModLoaded("owo")) { +// WinterlyOwoLibIntegration.initItemGroup(); +// ItemGroupEvents.modifyEntriesEvent(BuiltInRegistries.CREATIVE_MODE_TAB.getResourceKey(itemGroup).get()).register(entries -> { +// CommonWinterlyItems.ITEMS.forEach((id, sup) -> entries.accept(BuiltInRegistries.ITEM.get(id))); +// CommonWinterlyBlocks.BLOCKS.forEach((id, sup) -> entries.accept(BuiltInRegistries.ITEM.get(id))); +// }); +// } } private static CreativeModeTab createItemGroup() { - if(FabricLoader.getInstance().isModLoaded("owo")) { - return WinterlyOwoLibIntegration.createItemGroup(); - } +// if(FabricLoader.getInstance().isModLoaded("owo")) { +// return WinterlyOwoLibIntegration.createItemGroup(); +// } var group = FabricItemGroup.builder().title(Component.translatable("itemGroup.winterly.items")) .icon(() -> BuiltInRegistries.ITEM.get(Winterly.id("snowguy")).getDefaultInstance()) .displayItems((displayContext, entries) -> { diff --git a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/client/WinterlyFabricClient.java b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/client/WinterlyFabricClient.java index dc98c0f..71c5ec5 100644 --- a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/client/WinterlyFabricClient.java +++ b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/client/WinterlyFabricClient.java @@ -49,11 +49,11 @@ public void onInitializeClient() { map.putBlock(BuiltInRegistries.BLOCK.get(Winterly.id("icicle_bars")), RenderType.cutout()); if(FabricLoader.getInstance().isModLoaded("trinkets")) { - CommonWinterlyItems.ITEMS.forEach((id, item) -> { - if(item instanceof CommonScarfItem scarf) { + CommonWinterlyItems.ITEMS.forEach((id, sup) -> { + if(BuiltInRegistries.ITEM.get(id) instanceof CommonScarfItem scarf) { WinterlyTrinketsIntegration.registerScarfRenderer(scarf); } - if(item instanceof CommonSantaHatItem hat) { + if(BuiltInRegistries.ITEM.get(id) instanceof CommonSantaHatItem hat) { WinterlyTrinketsIntegration.registerSantaHatRenderer(hat); } }); diff --git a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/compat/WinterlyTrinketsIntegration.java b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/compat/WinterlyTrinketsIntegration.java index 9868a6a..9c366de 100644 --- a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/compat/WinterlyTrinketsIntegration.java +++ b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/compat/WinterlyTrinketsIntegration.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer; import dev.emi.trinkets.api.SlotReference; import dev.emi.trinkets.api.Trinket; +import dev.emi.trinkets.api.TrinketComponent; import dev.emi.trinkets.api.TrinketsApi; import dev.emi.trinkets.api.client.TrinketRenderer; import dev.emi.trinkets.api.client.TrinketRendererRegistry; @@ -12,15 +13,19 @@ import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.util.Tuple; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import ru.pinkgoosik.winterly.Winterly; import ru.pinkgoosik.winterly.client.model.WinterlyModels; +import ru.pinkgoosik.winterly.fabric.item.SantaHatItem; import ru.pinkgoosik.winterly.item.CommonSantaHatItem; import ru.pinkgoosik.winterly.item.CommonScarfItem; +import java.util.Optional; + public class WinterlyTrinketsIntegration { public static void registerTrinket(Item item) { @@ -28,12 +33,12 @@ public static void registerTrinket(Item item) { } public static boolean hasHatOn(Player player) { -// Optional component = TrinketsApi.getTrinketComponent(player); -// if(component.isPresent()) { -// for(Tuple pair : component.get().getAllEquipped()) { -// if(pair.getB().getItem() instanceof SantaHatItem) return true; -// } -// } + Optional component = TrinketsApi.getTrinketComponent(player); + if(component.isPresent()) { + for(Tuple pair : component.get().getAllEquipped()) { + if(pair.getB().getItem() instanceof SantaHatItem) return true; + } + } return false; } diff --git a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/data/WorldData.java b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/data/WorldData.java index 91abde9..a35207e 100644 --- a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/data/WorldData.java +++ b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/data/WorldData.java @@ -10,6 +10,7 @@ import org.ladysnake.cca.api.v3.component.ComponentV3; import ru.pinkgoosik.winterly.data.CachedFlowers; +@SuppressWarnings("NullableProblems") public class WorldData implements ComponentV3 { public Level world; diff --git a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/item/SantaHatItem.java b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/item/SantaHatItem.java index 7c35c4b..a021fb9 100644 --- a/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/item/SantaHatItem.java +++ b/winterly-fabric/src/main/java/ru/pinkgoosik/winterly/fabric/item/SantaHatItem.java @@ -13,6 +13,7 @@ import java.util.List; +@SuppressWarnings("NullableProblems") public class SantaHatItem extends CommonSantaHatItem { public SantaHatItem(Item.Properties settings, String color) { diff --git a/winterly-fabric/src/main/resources/data/trinkets/entity/winterly.json b/winterly-fabric/src/main/resources/data/trinkets/entities/winterly.json similarity index 100% rename from winterly-fabric/src/main/resources/data/trinkets/entity/winterly.json rename to winterly-fabric/src/main/resources/data/trinkets/entities/winterly.json diff --git a/winterly-fabric/trinkets-3.10.0.jar b/winterly-fabric/trinkets-3.10.0.jar new file mode 100644 index 0000000..f5f9924 Binary files /dev/null and b/winterly-fabric/trinkets-3.10.0.jar differ diff --git a/winterly-neoforge/src/main/resources/data/winterly/curios/entity/winterly.json b/winterly-neoforge/src/main/resources/data/winterly/curios/entities/winterly.json similarity index 100% rename from winterly-neoforge/src/main/resources/data/winterly/curios/entity/winterly.json rename to winterly-neoforge/src/main/resources/data/winterly/curios/entities/winterly.json