-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
c5802bc
commit f1a59ef
Showing
96 changed files
with
1,555 additions
and
99 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,10 +1,38 @@ | ||
# AnimatedFreeze | ||
# AnimatedFreeze - 动画冻结 | ||
|
||
**中文**| [**English**](README_en.md) | ||
|
||
## 简介 | ||
- 这个模组增加了一个内置的资源包,可以禁用海灯、海带和海草的动画效果。 | ||
- 这个模组增加了一些内置资源包,用于禁用一些材质的动画效果亦或是改变其渲染方式来提高游戏的性能。 | ||
|
||
|
||
|
||
- 可能和部分资源包不兼容且关于这方面的问题将不会被处理。 | ||
|
||
|
||
|
||
## 材质包 | ||
|
||
- **af_mod/chest_optimization(箱子优化)** | ||
|
||
改变了箱子的渲染方式,大幅提升FPS(使用时请将该材质放在第一位)。 | ||
|
||
该实现方式与 [FastChest](https://github.com/FakeDomi/FastChest) 模组基本相同,因此有关于此材质的问题可以参考 [FastChest README](https://github.com/FakeDomi/FastChest/blob/master/README.md)。 | ||
|
||
|
||
|
||
- **af_mod/kelp_freeze(静止海带)** | ||
|
||
移除了海带的摇晃动画。 | ||
|
||
|
||
|
||
- **af_mod/sea_lantern_freeze(静止海晶灯)** | ||
|
||
移除了海晶灯的动画。 | ||
|
||
|
||
- 可能和部分资源包不兼容,具体表现为动画依然存在。 | ||
|
||
## Intro | ||
- This mod has added a built-in resource pack to disable the animation effects of s1ea lanterns, kelp, and seagrass. | ||
- **af_mod/seagrass_freeze(静止海草)** | ||
|
||
- May be incompatible with some resource packages, specifically manifested as the animation still exists. | ||
移除了海草的摇晃动画。 |
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 @@ | ||
# AnimatedFreeze | ||
|
||
[**中文**](README.md) **|** [**English**] | ||
|
||
## Into | ||
|
||
- This module adds some built-in resource packs designed to disable certain texture animations or change their rendering approach to improve game performance. | ||
|
||
|
||
|
||
- It may be incompatible with some resource packs, and issues related to these incompatibilities will not be addressed. | ||
|
||
|
||
|
||
## Resource Packs | ||
|
||
- **af_mod/chest_optimization** | ||
|
||
Changes the rendering method for chests, significantly boosting FPS (when using this, place this resource pack first in the list). | ||
|
||
This implementation is essentially the same as the [FastChest](https://github.com/FakeDomi/FastChest) mod, so any issues related to this resource pack can refer to the [FastChest README](https://github.com/FakeDomi/FastChest/blob/master/README.md). | ||
|
||
|
||
|
||
- **af_mod/kelp_freeze** | ||
|
||
Removes the swaying animation of kelp. | ||
|
||
|
||
|
||
- **af_mod/sea_lantern_freeze** | ||
|
||
Removes the animation from sea lanterns. | ||
|
||
|
||
|
||
- **af_mod/seagrass_freeze** | ||
|
||
Removes the swaying animation of seagrass. |
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
44 changes: 44 additions & 0 deletions
44
src/main/java/top/byteeeee/AnimatedFreeze/AnimatedFreezeClient.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,44 @@ | ||
/* | ||
* This file is part of the AnimatedFreeze project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 1024_byteeeee and contributors | ||
* | ||
* AnimatedFreeze is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* AnimatedFreeze is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with AnimatedFreeze. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package top.byteeeee.AnimatedFreeze; | ||
|
||
import net.fabricmc.api.ClientModInitializer; | ||
|
||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.resource.ResourcePackManager; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import top.byteeeee.AnimatedFreeze.utils.BuiltinResourcesPackAdder; | ||
|
||
public class AnimatedFreezeClient implements ClientModInitializer { | ||
public static final String modName = "AnimatedFreeze"; | ||
public static final Logger LOGGER = LogManager.getLogger(modName); | ||
public static MinecraftClient minecraftClient = MinecraftClient.getInstance(); | ||
public static ResourcePackManager resourcePackManager = minecraftClient.getResourcePackManager(); | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
LOGGER.info(modName + " " + "loaded!"); | ||
BuiltinResourcesPackAdder.add(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/top/byteeeee/AnimatedFreeze/AnimatedFreezeSetting.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,33 @@ | ||
/* | ||
* This file is part of the AnimatedFreeze project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 1024_byteeeee and contributors | ||
* | ||
* AnimatedFreeze is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* AnimatedFreeze is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with AnimatedFreeze. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package top.byteeeee.AnimatedFreeze; | ||
|
||
import top.byteeeee.AnimatedFreeze.helpers.NeedReloadResources; | ||
|
||
public class AnimatedFreezeSetting { | ||
public static boolean chestOptimization; | ||
|
||
public static void changeValue() { | ||
AnimatedFreezeClient.resourcePackManager.getEnabledProfiles().forEach( | ||
chestProfile -> AnimatedFreezeSetting.chestOptimization = NeedReloadResources.isOf(chestProfile.getName()) | ||
); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/top/byteeeee/AnimatedFreeze/helpers/EntityRenderBlock.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,47 @@ | ||
/* | ||
* This file is part of the AnimatedFreeze project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 1024_byteeeee and contributors | ||
* | ||
* AnimatedFreeze is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* AnimatedFreeze is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with AnimatedFreeze. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package top.byteeeee.AnimatedFreeze.helpers; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
|
||
import net.minecraft.block.entity.ChestBlockEntity; | ||
import net.minecraft.block.entity.EnderChestBlockEntity; | ||
import net.minecraft.block.entity.TrappedChestBlockEntity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Predicate; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class EntityRenderBlock { | ||
private static final List<Predicate<Class<?>>> entityRenderBlockPredicates = new ArrayList<>(); | ||
|
||
public static boolean isOf(Class<?> blockEntity) { | ||
return entityRenderBlockPredicates.stream().anyMatch(predicate -> predicate.test(blockEntity)); | ||
} | ||
|
||
static { | ||
entityRenderBlockPredicates.add(blockEntity -> blockEntity.equals(ChestBlockEntity.class)); | ||
entityRenderBlockPredicates.add(blockEntity -> blockEntity.equals(TrappedChestBlockEntity.class)); | ||
entityRenderBlockPredicates.add(blockEntity -> blockEntity.equals(EnderChestBlockEntity.class)); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/top/byteeeee/AnimatedFreeze/helpers/NeedReloadResources.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,47 @@ | ||
/* | ||
* This file is part of the AnimatedFreeze project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 1024_byteeeee and contributors | ||
* | ||
* AnimatedFreeze is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* AnimatedFreeze is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with AnimatedFreeze. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package top.byteeeee.AnimatedFreeze.helpers; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
|
||
import top.byteeeee.AnimatedFreeze.utils.RegexTools; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class NeedReloadResources { | ||
private static final List<String> needReload = new ArrayList<>(); | ||
|
||
public static boolean isOf(String profileName) { | ||
return needReload.contains(profileName); | ||
} | ||
|
||
@SuppressWarnings("SameParameterValue") | ||
private static String setCompatName(String sourceName) { | ||
return RegexTools.createCompatProfileName(sourceName); | ||
} | ||
|
||
static { | ||
needReload.add(setCompatName("af_mod:chest_optimization")); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...main/java/top/byteeeee/AnimatedFreeze/mixin/changeSettingsValue/MinecraftClientMixin.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,53 @@ | ||
/* | ||
* This file is part of the AnimatedFreeze project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 1024_byteeeee and contributors | ||
* | ||
* AnimatedFreeze is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* AnimatedFreeze is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with AnimatedFreeze. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package top.byteeeee.AnimatedFreeze.mixin.changeSettingsValue; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
|
||
import net.minecraft.client.MinecraftClient; | ||
|
||
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; | ||
|
||
import top.byteeeee.AnimatedFreeze.AnimatedFreezeSetting; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Mixin(value = MinecraftClient.class, priority = 1688) | ||
public abstract class MinecraftClientMixin { | ||
@Inject( | ||
//#if MC>=12002 | ||
//$$ method = "reloadResources(ZLnet/minecraft/client/MinecraftClient$LoadingContext;)Ljava/util/concurrent/CompletableFuture;", | ||
//#elseif MC>=11800 | ||
//$$ method = "reloadResources(Z)Ljava/util/concurrent/CompletableFuture;", | ||
//#else | ||
method = "reloadResources", | ||
//#endif | ||
at = @At("HEAD") | ||
) | ||
private void reloadResources(CallbackInfoReturnable<CompletableFuture<Void>> cir) { | ||
AnimatedFreezeSetting.changeValue(); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...top/byteeeee/AnimatedFreeze/mixin/chestOptimization/BlockEntityRenderDispatcherMixin.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,45 @@ | ||
/* | ||
* This file is part of the AnimatedFreeze project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 1024_byteeeee and contributors | ||
* | ||
* AnimatedFreeze is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* AnimatedFreeze is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with AnimatedFreeze. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package top.byteeeee.AnimatedFreeze.mixin.chestOptimization; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
|
||
import net.minecraft.block.entity.BlockEntity; | ||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; | ||
import net.minecraft.client.render.block.entity.BlockEntityRenderer; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
import top.byteeeee.AnimatedFreeze.helpers.EntityRenderBlock; | ||
import top.byteeeee.AnimatedFreeze.AnimatedFreezeSetting; | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Mixin(BlockEntityRenderDispatcher.class) | ||
public abstract class BlockEntityRenderDispatcherMixin { | ||
@ModifyReturnValue(method = "get", at = @At("RETURN")) | ||
private <E extends BlockEntity> BlockEntityRenderer<E> get(BlockEntityRenderer<E> original, E blockEntity) { | ||
return EntityRenderBlock.isOf(blockEntity.getClass()) && AnimatedFreezeSetting.chestOptimization ? null : original; | ||
} | ||
} |
Oops, something went wrong.