Skip to content

Commit

Permalink
Add core:resource_loader
Browse files Browse the repository at this point in the history
  • Loading branch information
OroArmor committed Sep 27, 2024
1 parent 607a1d4 commit 1ea68f5
Show file tree
Hide file tree
Showing 44 changed files with 119 additions and 2,739 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import java.util.List;

import org.quiltmc.qsl.resource.loader.impl.QuiltBuiltinPackProfile;

import net.minecraft.component.ComponentType;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.registry.RegistryKey;
Expand All @@ -26,9 +28,7 @@

import net.fabricmc.fabric.api.item.v1.EnchantmentEvents;
import net.fabricmc.fabric.api.item.v1.EnchantmentSource;
import net.fabricmc.fabric.impl.resource.loader.BuiltinModResourcePackSource;
import net.fabricmc.fabric.impl.resource.loader.FabricResource;
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackCreator;
import net.fabricmc.fabric.mixin.item.EnchantmentBuilderAccessor;

public class EnchantmentUtil {
Expand Down Expand Up @@ -65,7 +65,7 @@ public static EnchantmentSource determineSource(Resource resource) {

if (packSource == ResourcePackSource.BUILTIN) {
return EnchantmentSource.VANILLA;
} else if (packSource == ModResourcePackCreator.RESOURCE_PACK_SOURCE || packSource instanceof BuiltinModResourcePackSource) {
} else if (packSource instanceof QuiltBuiltinPackProfile.BuiltinPackSource) {
return EnchantmentSource.MOD;
}
}
Expand Down
4 changes: 4 additions & 0 deletions fabric-loot-api-v3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ moduleDependencies(project, [
'fabric-api-base',
'fabric-resource-loader-v0'
])

dependencies {
modImplementation getQslModule("core", "resource_loader")
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
import java.util.HashMap;
import java.util.Map;

import org.quiltmc.qsl.resource.loader.impl.QuiltBuiltinPackProfile;

import net.minecraft.resource.Resource;
import net.minecraft.resource.ResourcePackSource;
import net.minecraft.util.Identifier;

import net.fabricmc.fabric.api.loot.v3.LootTableSource;
import net.fabricmc.fabric.impl.resource.loader.BuiltinModResourcePackSource;
import net.fabricmc.fabric.impl.resource.loader.FabricResource;
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackCreator;

public final class LootUtil {
public static final ThreadLocal<Map<Identifier, LootTableSource>> SOURCES = ThreadLocal.withInitial(HashMap::new);
Expand All @@ -37,7 +37,7 @@ public static LootTableSource determineSource(Resource resource) {

if (packSource == ResourcePackSource.BUILTIN) {
return LootTableSource.VANILLA;
} else if (packSource == ModResourcePackCreator.RESOURCE_PACK_SOURCE || packSource instanceof BuiltinModResourcePackSource) {
} else if (packSource instanceof QuiltBuiltinPackProfile.BuiltinPackSource) {
return LootTableSource.MOD;
}
}
Expand Down
4 changes: 4 additions & 0 deletions fabric-resource-loader-v0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ testDependencies(project, [
':fabric-api-base',
':fabric-resource-loader-v0'
])

dependencies {
modApi getQslModule("core", "resource_loader")
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1ea68f5

Please sign in to comment.