Skip to content

Commit b90d097

Browse files
committed
perf: Even faster item texturing
1 parent 754b3e8 commit b90d097

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed

src/main/java/com/falsepattern/falsetweaks/config/ModuleConfig.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,14 @@ public class ModuleConfig {
271271
@Config.RequiresMcRestart
272272
public static boolean UNLOCK_RENDER_DISTANCE;
273273

274-
@Config.Comment("Slightly improves item entity rendering performance. Disable if you get any texture weirdness!")
274+
@Config.Comment({"Slightly improves item entity rendering performance. Disable if you get any texture weirdness!",
275+
"Fast - Standard performance improvements",
276+
"Faster - More aggressive performance improvements, some dropped items might look odd"})
275277
@Config.LangKey
276278
@Config.Name("fastItemEntityTextureSwitching")
277-
@Config.DefaultBoolean(true)
279+
@Config.DefaultEnum("Faster")
278280
@Config.RequiresMcRestart
279-
public static boolean FAST_ITEM_ENTITY_TEXTURE_SWITCHING;
281+
public static ItemTexturing FAST_ITEM_ENTITY_TEXTURE_SWITCHING;
280282

281283
@Config.Comment({
282284
"Improves the performance of items significantly by not checking collisions against other entities for them.",
@@ -320,4 +322,10 @@ public static void init() {
320322

321323
}
322324

325+
public enum ItemTexturing {
326+
Disabled,
327+
Fast,
328+
Faster
329+
}
330+
323331
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* This file is part of FalseTweaks.
3+
*
4+
* Copyright (C) 2022-2025 FalsePattern
5+
* All Rights Reserved
6+
*
7+
* The above copyright notice and this permission notice shall be included
8+
* in all copies or substantial portions of the Software.
9+
*
10+
* FalseTweaks is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License as published by
12+
* the Free Software Foundation, only version 3 of the License.
13+
*
14+
* FalseTweaks is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public License
20+
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
21+
*/
22+
23+
package com.falsepattern.falsetweaks.mixin.mixins.client.misc;
24+
25+
import com.falsepattern.falsetweaks.modules.misc.ItemTexturingManager;
26+
import org.spongepowered.asm.mixin.Mixin;
27+
import org.spongepowered.asm.mixin.injection.At;
28+
import org.spongepowered.asm.mixin.injection.Redirect;
29+
30+
import net.minecraft.client.renderer.entity.RenderItem;
31+
32+
@Mixin(RenderItem.class)
33+
public class FastItemTexturing_RenderItem_FasterMixin {
34+
@Redirect(method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V",
35+
at = @At(value = "INVOKE",
36+
target = "Lnet/minecraft/client/renderer/texture/TextureUtil;func_152777_a(ZZF)V"),
37+
require = 1)
38+
private void setupTextureFlags(boolean a, boolean b, float c) {
39+
40+
}
41+
42+
@Redirect(method = "doRender(Lnet/minecraft/entity/item/EntityItem;DDDFF)V",
43+
at = @At(value = "INVOKE",
44+
target = "Lnet/minecraft/client/renderer/texture/TextureUtil;func_147945_b()V"),
45+
require = 1)
46+
private void resetTextureFlags() {
47+
48+
}
49+
}

src/main/java/com/falsepattern/falsetweaks/mixin/plugin/standard/Mixin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,12 @@ public enum Mixin implements IMixins {
321321
() -> ModuleConfig.ITEM_RENDER_LISTS,
322322
client("misc.ItemRenderList_ItemRendererMixin")),
323323
FastItemTexturing(Phase.EARLY,
324-
() -> ModuleConfig.FAST_ITEM_ENTITY_TEXTURE_SWITCHING,
324+
() -> ModuleConfig.FAST_ITEM_ENTITY_TEXTURE_SWITCHING == ModuleConfig.ItemTexturing.Fast,
325325
client("misc.FastItemTexturing_RenderGlobalMixin",
326326
"misc.FastItemTexturing_RenderItemMixin")),
327+
FastItemTexturing_Faster(Phase.EARLY,
328+
() -> ModuleConfig.FAST_ITEM_ENTITY_TEXTURE_SWITCHING == ModuleConfig.ItemTexturing.Faster,
329+
client("misc.FastItemTexturing_RenderItem_FasterMixin")),
327330
FastItemPhysics(Phase.EARLY,
328331
() -> ModuleConfig.FAST_ITEM_ENTITY_PHYSICS,
329332
common("misc.FastItemPhysics_WorldMixin")),

0 commit comments

Comments
 (0)