Gamebuster

FileConsumerMixin

Oct 20th, 2021 (edited)
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1. package com.wildermods.wilderforge.mixins;
  2.  
  3. import java.nio.channels.FileChannel;
  4. import java.nio.file.OpenOption;
  5. import java.nio.file.Path;
  6.  
  7. import org.spongepowered.asm.mixin.Mixin;
  8. import org.spongepowered.asm.mixin.injection.At;
  9. import org.spongepowered.asm.mixin.injection.Redirect;
  10.  
  11. import com.worldwalkergames.logging.FileConsumer;
  12.  
  13. @Mixin(value = FileConsumer.class, remap = false)
  14. public class FileConsumerMixin {
  15.    
  16.     @Redirect(
  17.             method = "<init>("                                                                              //method (constructor)
  18.                 + "Ljava/lang/String;"                                                                          //param1
  19.                 + "Lcom/worldwalkergames/logging/FileConsumer$FileConsumerConfig;"                              //param2
  20.                 + "[Lcom/worldwalkergames/logging/FilteringConsumer$Filter;)V",                                 //param3
  21.             at = @At(value = "INVOKE_ASSIGN",
  22.                 target = "Ljava/nio/channels/FileChannel;"                                                  //class
  23.                     + "open("                                                                               //method
  24.                         + "Ljava/nio/file/Path;"                                                                //param1
  25.                         + "[Ljava/nio/file/OpenOption;"                                                         //param2
  26.                     + ")Ljava/nio/channels/FileChannel;"                                                    //return type
  27.             )
  28.     )
  29.     public FileChannel dontCreateLogChannels(Path path, OpenOption... options) {
  30.         return null;
  31.     }
  32.    
  33. }
Add Comment
Please, Sign In to add comment