Skip to content

Commit c31e267

Browse files
committed
feat(threading): Added tess bypass annotation
1 parent 1d78b09 commit c31e267

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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.api.threading;
24+
25+
import org.jetbrains.annotations.ApiStatus;
26+
27+
import net.minecraft.client.renderer.Tessellator;
28+
29+
import java.lang.annotation.ElementType;
30+
import java.lang.annotation.Retention;
31+
import java.lang.annotation.RetentionPolicy;
32+
import java.lang.annotation.Target;
33+
34+
35+
/**
36+
* Marks this class as "knowing what it's doing" touching the {@link Tessellator#instance} field directly and doesn't touch it.
37+
*/
38+
@ApiStatus.Experimental
39+
@Target(ElementType.TYPE)
40+
@Retention(RetentionPolicy.CLASS)
41+
public @interface BypassTessReplacement {
42+
}

src/main/java/com/falsepattern/falsetweaks/asm/modules/threadedupdates/Threading_TessellatorUseReplacement.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,15 @@ public boolean transformClass(@NotNull String className, @NotNull ClassNodeHandl
159159
if (cn == null) {
160160
return false;
161161
}
162+
163+
if (cn.invisibleAnnotations != null) {
164+
for (val ann : cn.invisibleAnnotations) {
165+
if ("Lcom/falsepattern/falsetweaks/api/threading/BypassTessReplacement;".equals(ann.desc)) {
166+
return false;
167+
}
168+
}
169+
}
170+
162171
boolean modified = false;
163172
val methods = cn.methods;
164173
for (val classMethod : methods) {

0 commit comments

Comments
 (0)