diff options
Diffstat (limited to 'src/main')
5 files changed, 148 insertions, 0 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewnClient.java b/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewnClient.java new file mode 100644 index 0000000..57f628e --- /dev/null +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewnClient.java @@ -0,0 +1,44 @@ +package shcm.shsupercm.fabric.citresewn; + +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.AbstractClientPlayerEntity; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.item.ArmorItem; +import net.minecraft.resource.ReloadableResourceManager; +import net.minecraft.resource.ResourceManager; +import net.minecraft.resource.ResourceReloader; +import net.minecraft.util.profiler.Profiler; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; + +@Environment(EnvType.CLIENT) +public class CITResewnClient implements ClientModInitializer { + public static CITResewnClient INSTANCE; + + @Override + public void onInitializeClient() { + INSTANCE = this; + /*net.minecraft.client.render.model.json.ModelOverrideList#apply + eval override + */ + + /*net.minecraft.client.render.entity.feature.ArmorFeatureRenderer#renderArmor + take entity.getEquippedStack(armorSlot) + eval override + save shadow String cachedOverride /null + + /*net.minecraft.client.render.entity.feature.ArmorFeatureRenderer#getArmorTexture + if(shadow cachedOverride != null) + mxreturn shadow cachedOverride + + */ + + /* + + */ + } +} diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/IdentifierMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/IdentifierMixin.java new file mode 100644 index 0000000..2effef9 --- /dev/null +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/IdentifierMixin.java @@ -0,0 +1,17 @@ +package shcm.shsupercm.fabric.citresewn.mixin; + +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Identifier.class) +public class IdentifierMixin { + + @Inject(method = "isPathValid(Ljava/lang/String;)Z", cancellable = true, at = @At("HEAD")) + private static void isPathValid(String path, CallbackInfoReturnable<Boolean> ci) { + if(path.startsWith("optifine")) + ci.setReturnValue(true); return; + } +} diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ReloadableResourceManagerImplMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ReloadableResourceManagerImplMixin.java new file mode 100644 index 0000000..01b092b --- /dev/null +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ReloadableResourceManagerImplMixin.java @@ -0,0 +1,48 @@ +package shcm.shsupercm.fabric.citresewn.mixin; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.resource.*; +import net.minecraft.util.Identifier; +import net.minecraft.util.Unit; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.function.Predicate; +import java.util.stream.Stream; + +@Mixin(ReloadableResourceManagerImpl.class) +public abstract class ReloadableResourceManagerImplMixin implements ReloadableResourceManager { + @Shadow @Final private ResourceType type; + @Shadow public abstract Stream<ResourcePack> streamResourcePacks(); + + @Shadow public abstract Collection<Identifier> findResources(String startingPath, Predicate<String> pathPredicate); + + @Inject(method = "reload", at = @At("HEAD")) + private void onReload(Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage, List<ResourcePack> packs, CallbackInfoReturnable<ResourceReload> cir) { + if (this.type != ResourceType.CLIENT_RESOURCES) + return; + + Map<String, ResourcePack> citFiles = new HashMap<>(); + for (ResourcePack pack : packs) { + for (Identifier identifier : pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "citresewn/cit", 5, s -> true)) + citFiles.put(identifier.getPath(), pack); + for (Identifier identifier : pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "mcpatcher/cit", 5, s -> true)) + citFiles.put(identifier.getPath(), pack); + for (Identifier identifier : pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "optifine/cit", 5, s -> true)) + citFiles.put(identifier.getPath(), pack); + } + + for (Map.Entry<String, ResourcePack> citFile : citFiles.entrySet()) { + + } + + new String(); + } +}
\ No newline at end of file diff --git a/src/main/resources/citresewn.mixins.json b/src/main/resources/citresewn.mixins.json new file mode 100644 index 0000000..2baaf4b --- /dev/null +++ b/src/main/resources/citresewn.mixins.json @@ -0,0 +1,13 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "shcm.shsupercm.fabric.citresewn.mixin", + "compatibilityLevel": "JAVA_16", + "client": [ + "ReloadableResourceManagerImplMixin", + "IdentifierMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..b483bd9 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,26 @@ +{ + "schemaVersion": 1, + "id": "citresewn", + "version": "${version}", + "name": "CITResewn", + "description": "Re-implements MCPatcher's CIT", + "authors": [ + "SHsuperCM" + ], + "contact": {}, + "license": "MIT", + + "environment": "client", + "entrypoints": { + "client": [ + "shcm.shsupercm.fabric.citresewn.CITResewnClient" + ] + }, + "mixins": [ + "citresewn.mixins.json" + ], + "depends": { + "fabricloader": ">=0.11.6", + "minecraft": "1.17.1" + } +} |