diff options
author | SHsuperCM <shsupercm@gmail.com> | 2021-08-20 15:48:24 +0300 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2021-08-20 15:48:24 +0300 |
commit | ec00a9307d3eadca3a7407173320f7f941401164 (patch) | |
tree | 3de50a3977a638dd796908d15e3a71852efcb1eb /src/main/java | |
download | CITResewn-ec00a9307d3eadca3a7407173320f7f941401164.tar.gz CITResewn-ec00a9307d3eadca3a7407173320f7f941401164.tar.bz2 CITResewn-ec00a9307d3eadca3a7407173320f7f941401164.zip |
Initial commit
Diffstat (limited to 'src/main/java')
3 files changed, 109 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 |