This repository has been archived by the owner on May 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow disabling of the internal resources, should allow for better re…
…source pack compatibility. Closes #156
- Loading branch information
Showing
5 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/me/modmuss50/optifabric/mixin/MixinGameOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package me.modmuss50.optifabric.mixin; | ||
|
||
import net.minecraft.client.options.GameOptions; | ||
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.CallbackInfo; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
@Mixin(GameOptions.class) | ||
public class MixinGameOptions { | ||
|
||
@Shadow public List<String> resourcePacks; | ||
|
||
@Shadow @Final private File optionsFile; | ||
|
||
@Inject(method = "load", at = @At("RETURN")) | ||
private void load(CallbackInfo info) { | ||
File optifabricOptions = new File(optionsFile.getParent(), "optifabric.txt"); | ||
if (!optifabricOptions.exists()) { | ||
|
||
//Add optifine to resource packs if optifabric.txt doesnt exist, makes it default on, but can be disabled. | ||
if (!resourcePacks.contains("optifine")) { | ||
resourcePacks.add("optifine"); | ||
} | ||
|
||
try { | ||
optifabricOptions.createNewFile(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters