forked from FoundationGames/Animatica
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
159 additions
and
148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
# Animatica | ||
A Minecraft mod for the Fabric mod loader intended to load the MCPatcher/OptiFine [animated texture format](https://github.com/sp614x/optifine/blob/master/OptiFineDoc/doc/custom_animations.txt). <br/> | ||
# Animatica Foxified | ||
Animatica unofficial NeoForge port. | ||
|
||
A Minecraft mod for the NeoForge intended to load the MCPatcher/OptiFine [animated texture format](https://github.com/sp614x/optifine/blob/master/OptiFineDoc/doc/custom_animations.txt). <br/> | ||
## What resource packs does this support? | ||
Animatica adds support for resource packs that use **custom animated textures** <br/> | ||
Animatica Foxified adds support for resource packs that use **custom animated textures** <br/> | ||
This includes: | ||
- Animated GUI textures | ||
- Animated entity textures | ||
- Animated block entity textures | ||
- Animated armor textures | ||
- Other animated textures (Animated blocks and items are a vanilla feature) | ||
## Animatica DOES NOT support: | ||
## Animatica Foxified DOES NOT support: | ||
- Fully Custom GUI ([OptiGUI for Fabric](https://www.curseforge.com/minecraft/mc-mods/optigui)) | ||
- Custom entity models ([CEM for Fabric](https://www.curseforge.com/minecraft/mc-mods/custom-entity-models-cem)) | ||
- Custom entity model part animations in 3D ([CEM for Fabric](https://www.curseforge.com/minecraft/mc-mods/custom-entity-models-cem)) | ||
- Any other MCPatcher/OptiFine resource pack feature such as connected textures, etc | ||
|
||
**These features WILL NEVER be implemented in Animatica.** <br/> | ||
### Animatica is ONLY for ANIMATED TEXTURES. | ||
### Animatica Foxified is ONLY for ANIMATED TEXTURES. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
org.gradle.jvmargs=-Xmx1G | ||
|
||
loom.platform=neoforge | ||
|
||
minecraft_version=1.20.4 | ||
yarn_mappings=1.20.4+build.3 | ||
loader_version=0.15.11 | ||
|
||
# Fabric API | ||
fabric_version=0.97.1+1.20.4 | ||
neoforge_version=20.4.237 | ||
|
||
mod_version = 0.6.1+1.20.4 | ||
mod_version = 0.0.1+1.20.4 | ||
maven_group = io.github.foundationgames | ||
archives_base_name = animatica | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
pluginManagement { | ||
repositories { | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
maven { url "https://maven.fabricmc.net/" } | ||
maven { url "https://maven.architectury.dev/" } | ||
maven { url "https://maven.neoforged.net/releases/" } | ||
gradlePluginPortal() | ||
} | ||
} |
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
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
119 changes: 50 additions & 69 deletions
119
src/main/java/io/github/foundationgames/animatica/config/AnimaticaConfig.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 |
---|---|---|
@@ -1,87 +1,68 @@ | ||
package io.github.foundationgames.animatica.config; | ||
|
||
import io.github.foundationgames.animatica.Animatica; | ||
import net.fabricmc.loader.api.FabricLoader; | ||
import me.jellysquid.mods.sodium.client.gui.options.OptionFlag; | ||
import me.jellysquid.mods.sodium.client.gui.options.OptionGroup; | ||
import me.jellysquid.mods.sodium.client.gui.options.OptionImpact; | ||
import me.jellysquid.mods.sodium.client.gui.options.OptionImpl; | ||
import me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl; | ||
import me.jellysquid.mods.sodium.client.gui.options.storage.SodiumOptionsStorage; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.option.SimpleOption; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.Properties; | ||
import net.minecraft.text.Text; | ||
import net.neoforged.neoforge.common.ModConfigSpec; | ||
|
||
public class AnimaticaConfig { | ||
public static String ANIMATED_TEXTURES_KEY = "animated_textures"; | ||
|
||
public static final String FILE_NAME = "animatica.properties"; | ||
|
||
private final SimpleOption<Boolean> animatedTexturesOption; | ||
public boolean animatedTextures; | ||
|
||
public AnimaticaConfig() { | ||
try { | ||
load(); | ||
} catch (IOException e) { | ||
Animatica.LOG.error("Error loading config during initialization!", e); | ||
} | ||
|
||
this.animatedTexturesOption = SimpleOption.ofBoolean( | ||
"option.animatica.animated_textures", | ||
this.animatedTextures, | ||
value -> { | ||
this.animatedTextures = value; | ||
try { | ||
this.save(); | ||
} catch (IOException e) { Animatica.LOG.error("Error saving config while changing in game!", e); } | ||
MinecraftClient.getInstance().reloadResources(); | ||
} | ||
); | ||
} | ||
|
||
public void writeTo(Properties properties) { | ||
properties.put(ANIMATED_TEXTURES_KEY, Boolean.toString(animatedTextures)); | ||
} | ||
|
||
public void readFrom(Properties properties) { | ||
this.animatedTextures = boolFrom(properties.getProperty(ANIMATED_TEXTURES_KEY), true); | ||
private static final ModConfigSpec.Builder BUILDER; | ||
public static final ModConfigSpec.BooleanValue ANIMATED_TEXTURES; | ||
public static final ModConfigSpec SPEC; | ||
|
||
static { | ||
BUILDER = new ModConfigSpec.Builder(); | ||
BUILDER.push("animatica"); | ||
ANIMATED_TEXTURES = BUILDER.translation("option.animatica.animated_textures").define("animated_textures", true); | ||
SPEC = BUILDER.build(); | ||
} | ||
|
||
public Path getFile() throws IOException { | ||
var file = FabricLoader.getInstance().getConfigDir().resolve(FILE_NAME); | ||
if (!Files.exists(file)) { | ||
Files.createFile(file); | ||
public static class VanillaExtendedConfig { | ||
private static final SimpleOption<Boolean> animatedTexturesOption; | ||
|
||
static { | ||
animatedTexturesOption = SimpleOption.ofBoolean( | ||
"option.animatica.animated_textures", | ||
AnimaticaConfig.ANIMATED_TEXTURES.getAsBoolean(), | ||
value -> { | ||
AnimaticaConfig.ANIMATED_TEXTURES.set(value); | ||
MinecraftClient.getInstance().reloadResources(); | ||
} | ||
); | ||
} | ||
|
||
return file; | ||
} | ||
|
||
public SimpleOption<Boolean> getAnimatedTexturesOption() { | ||
return animatedTexturesOption; | ||
} | ||
|
||
public void save() throws IOException { | ||
var file = getFile(); | ||
var properties = new Properties(); | ||
|
||
writeTo(properties); | ||
|
||
try (var out = Files.newOutputStream(file)) { | ||
properties.store(out, "Configuration file for Animatica"); | ||
public static SimpleOption<Boolean> getAnimatedTexturesOption() { | ||
return animatedTexturesOption; | ||
} | ||
} | ||
|
||
public void load() throws IOException { | ||
var file = getFile(); | ||
var properties = new Properties(); | ||
|
||
try (var in = Files.newInputStream(file)) { | ||
properties.load(in); | ||
public static class EmbeddiumExtendedConfig { | ||
private static final SodiumOptionsStorage sodiumOpts = new SodiumOptionsStorage(); | ||
private static final OptionGroup animatedTextures; | ||
|
||
static { | ||
animatedTextures = OptionGroup.createBuilder() | ||
.setId(Animatica.id("animated_textures")) | ||
.add(OptionImpl.createBuilder(Boolean.TYPE, sodiumOpts) | ||
.setName(Text.translatable("option.animatica.animated_textures")) | ||
.setTooltip(Text.of("")) | ||
.setControl(TickBoxControl::new) | ||
.setBinding((sodiumGameOptions, aBoolean) -> AnimaticaConfig.ANIMATED_TEXTURES.set(aBoolean), sodiumGameOptions -> AnimaticaConfig.ANIMATED_TEXTURES.get()) | ||
.setImpact(OptionImpact.VARIES) | ||
.setFlags(new OptionFlag[]{OptionFlag.REQUIRES_ASSET_RELOAD}) | ||
.build() | ||
).build(); | ||
} | ||
|
||
readFrom(properties); | ||
} | ||
|
||
private static boolean boolFrom(String s, boolean defaultVal) { | ||
return s == null ? defaultVal : "true".equals(s); | ||
public static OptionGroup getAnimatedTextures() { | ||
return animatedTextures; | ||
} | ||
} | ||
} |
Oops, something went wrong.