Skip to content

Commit abe8891

Browse files
committed
attempt 3 at fixing optifine D6
1 parent 2cf76be commit abe8891

10 files changed

Lines changed: 242 additions & 108 deletions

File tree

src/main/java/com/falsepattern/falsetweaks/mixin/bridge/occlison/IRenderGlobalOptiFastcraft.java

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/main/java/com/falsepattern/falsetweaks/mixin/mixins/client/cc/of/ChunkCacheOF_NonShaderMixin.java renamed to src/main/java/com/falsepattern/falsetweaks/mixin/mixins/client/cc/of/ChunkCacheOF_NonShader_DevMixin.java

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636

3737
@Mixin(targets = "ChunkCacheOF",
3838
remap = false)
39-
public abstract class ChunkCacheOF_NonShaderMixin extends ChunkCache {
40-
public ChunkCacheOF_NonShaderMixin(World p_i1964_1_, int p_i1964_2_, int p_i1964_3_, int p_i1964_4_, int p_i1964_5_, int p_i1964_6_, int p_i1964_7_, int p_i1964_8_) {
39+
public abstract class ChunkCacheOF_NonShader_DevMixin extends ChunkCache {
40+
public ChunkCacheOF_NonShader_DevMixin(World p_i1964_1_, int p_i1964_2_, int p_i1964_3_, int p_i1964_4_, int p_i1964_5_, int p_i1964_6_, int p_i1964_7_, int p_i1964_8_) {
4141
super(p_i1964_1_, p_i1964_2_, p_i1964_3_, p_i1964_4_, p_i1964_5_, p_i1964_6_, p_i1964_7_, p_i1964_8_);
4242
}
4343

@@ -46,70 +46,46 @@ public ChunkCacheOF_NonShaderMixin(World p_i1964_1_, int p_i1964_2_, int p_i1964
4646
at = @At(value = "INVOKE",
4747
target = "LConfig;isDynamicLights()Z",
4848
remap = false),
49-
require = 2)
50-
private boolean ftDynamicLights() {
49+
remap = false,
50+
expect = 0,
51+
require = 0)
52+
private boolean ftDynamicLightsDev() {
5153
return DynamicLightsDrivers.frontend.enabled();
5254
}
5355

5456
@Dynamic
5557
@Redirect(method = "getLightBrightnessForSkyBlocks",
5658
at = @At(value = "INVOKE",
57-
target = "LDynamicLights;getCombinedLight(IIII)I"),
59+
target = "LDynamicLights;getCombinedLight(IIII)I",
60+
remap = false),
61+
remap = false,
5862
expect = 0,
5963
require = 0)
6064
private int ftCombinedLightsDev(int x, int y, int z, int combinedLight) {
6165
return DynamicLightsDrivers.frontend.forWorldMesh().getCombinedLight(x, y, z, combinedLight);
6266
}
6367

64-
@Dynamic
65-
@Redirect(method = "func_72802_i",
66-
at = @At(value = "INVOKE",
67-
target = "LDynamicLights;getCombinedLight(IIII)I"),
68-
expect = 0,
69-
require = 0)
70-
private int ftCombinedLightsObf(int x, int y, int z, int combinedLight) {
71-
return DynamicLightsDrivers.frontend.forWorldMesh().getCombinedLight(x, y, z, combinedLight);
72-
}
73-
7468
@Dynamic
7569
@Redirect(method = "getLightBrightnessForSkyBlocks",
7670
at = @At(value = "INVOKE",
77-
target = "Lnet/minecraft/world/IBlockAccess;getLightBrightnessForSkyBlocks(IIII)I"),
71+
target = "Lnet/minecraft/world/IBlockAccess;getLightBrightnessForSkyBlocks(IIII)I",
72+
remap = true),
73+
remap = false,
7874
expect = 0,
7975
require = 0)
8076
private int brightnessFromSuperDev(IBlockAccess instance, int x, int y, int z, int lightValue) {
8177
return super.getLightBrightnessForSkyBlocks(x, y, z, lightValue);
8278
}
8379

84-
@Dynamic
85-
@Redirect(method = "func_72802_i",
86-
at = @At(value = "INVOKE",
87-
target = "Lnet/minecraft/world/IBlockAccess;getLightBrightnessForSkyBlocks(IIII)I"),
88-
expect = 0,
89-
require = 0)
90-
private int brightnessFromSuperObf(IBlockAccess instance, int x, int y, int z, int lightValue) {
91-
return super.getLightBrightnessForSkyBlocks(x, y, z, lightValue);
92-
}
93-
9480
@Dynamic
9581
@Redirect(method = "getBlock",
9682
at = @At(value = "INVOKE",
9783
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;",
9884
remap = true),
85+
remap = false,
9986
expect = 0,
10087
require = 0)
10188
private Block blockFromSuperDev(IBlockAccess instance, int x, int y, int z) {
10289
return super.getBlock(x, y, z);
10390
}
104-
105-
@Dynamic
106-
@Redirect(method = "func_147439_a",
107-
at = @At(value = "INVOKE",
108-
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;",
109-
remap = true),
110-
expect = 0,
111-
require = 0)
112-
private Block blockFromSuperObf(IBlockAccess instance, int x, int y, int z) {
113-
return super.getBlock(x, y, z);
114-
}
11591
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* This file is part of FalseTweaks.
3+
*
4+
* Copyright (C) 2022-2024 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, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* FalseTweaks is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
24+
package com.falsepattern.falsetweaks.mixin.mixins.client.cc.of;
25+
26+
import com.falsepattern.falsetweaks.modules.dynlights.DynamicLightsDrivers;
27+
import org.spongepowered.asm.mixin.Dynamic;
28+
import org.spongepowered.asm.mixin.Mixin;
29+
import org.spongepowered.asm.mixin.injection.At;
30+
import org.spongepowered.asm.mixin.injection.Redirect;
31+
32+
import net.minecraft.block.Block;
33+
import net.minecraft.world.ChunkCache;
34+
import net.minecraft.world.IBlockAccess;
35+
import net.minecraft.world.World;
36+
37+
@Mixin(targets = "ChunkCacheOF",
38+
remap = false)
39+
public abstract class ChunkCacheOF_NonShader_ObfMixin extends ChunkCache {
40+
public ChunkCacheOF_NonShader_ObfMixin(World p_i1964_1_, int p_i1964_2_, int p_i1964_3_, int p_i1964_4_, int p_i1964_5_, int p_i1964_6_, int p_i1964_7_, int p_i1964_8_) {
41+
super(p_i1964_1_, p_i1964_2_, p_i1964_3_, p_i1964_4_, p_i1964_5_, p_i1964_6_, p_i1964_7_, p_i1964_8_);
42+
}
43+
44+
@Dynamic
45+
@Redirect(method = "func_72802_i",
46+
at = @At(value = "INVOKE",
47+
target = "LConfig;isDynamicLights()Z",
48+
remap = false),
49+
remap = false,
50+
expect = 0,
51+
require = 0)
52+
private boolean ftDynamicLightsObf() {
53+
return DynamicLightsDrivers.frontend.enabled();
54+
}
55+
56+
@Dynamic
57+
@Redirect(method = "func_72802_i",
58+
at = @At(value = "INVOKE",
59+
target = "LDynamicLights;getCombinedLight(IIII)I",
60+
remap = false),
61+
remap = false,
62+
expect = 0,
63+
require = 0)
64+
private int ftCombinedLightsObf(int x, int y, int z, int combinedLight) {
65+
return DynamicLightsDrivers.frontend.forWorldMesh().getCombinedLight(x, y, z, combinedLight);
66+
}
67+
68+
@Dynamic
69+
@Redirect(method = "func_72802_i",
70+
at = @At(value = "INVOKE",
71+
target = "Lnet/minecraft/world/IBlockAccess;getLightBrightnessForSkyBlocks(IIII)I",
72+
remap = true),
73+
remap = false,
74+
expect = 0,
75+
require = 0)
76+
private int brightnessFromSuperObf(IBlockAccess instance, int x, int y, int z, int lightValue) {
77+
return super.getLightBrightnessForSkyBlocks(x, y, z, lightValue);
78+
}
79+
80+
@Dynamic
81+
@Redirect(method = "func_147439_a",
82+
at = @At(value = "INVOKE",
83+
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;",
84+
remap = true),
85+
remap = false,
86+
expect = 0,
87+
require = 0)
88+
private Block blockFromSuperObf(IBlockAccess instance, int x, int y, int z) {
89+
return super.getBlock(x, y, z);
90+
}
91+
}

src/main/java/com/falsepattern/falsetweaks/mixin/mixins/client/cc/of/ChunkCacheOF_ShaderMixin.java

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424
package com.falsepattern.falsetweaks.mixin.mixins.client.cc.of;
2525

2626
import com.falsepattern.falsetweaks.modules.dynlights.DynamicLightsDrivers;
27-
import org.spongepowered.asm.mixin.Dynamic;
2827
import org.spongepowered.asm.mixin.Mixin;
2928
import org.spongepowered.asm.mixin.injection.At;
3029
import org.spongepowered.asm.mixin.injection.Redirect;
3130

32-
import net.minecraft.block.Block;
3331
import net.minecraft.world.ChunkCache;
3432
import net.minecraft.world.IBlockAccess;
3533
import net.minecraft.world.World;
@@ -43,7 +41,9 @@ public ChunkCacheOF_ShaderMixin(World p_i1964_1_, int p_i1964_2_, int p_i1964_3_
4341

4442
@Redirect(method = "getLightBrightnessForSkyBlocksRaw",
4543
at = @At(value = "INVOKE",
46-
target = "LConfig;isDynamicLights()Z"),
44+
target = "LConfig;isDynamicLights()Z",
45+
remap = false),
46+
remap = false,
4747
expect = 0,
4848
require = 0)
4949
private boolean ftDynamicLights() {
@@ -52,7 +52,8 @@ private boolean ftDynamicLights() {
5252

5353
@Redirect(method = "getLightBrightnessForSkyBlocksRaw",
5454
at = @At(value = "INVOKE",
55-
target = "LDynamicLights;getCombinedLight(IIII)I"),
55+
target = "LDynamicLights;getCombinedLight(IIII)I",
56+
remap = false),
5657
remap = false,
5758
expect = 0,
5859
require = 0)
@@ -64,29 +65,10 @@ private int ftCombinedLights(int x, int y, int z, int combinedLight) {
6465
at = @At(value = "INVOKE",
6566
target = "Lnet/minecraft/world/IBlockAccess;getLightBrightnessForSkyBlocks(IIII)I",
6667
remap = true),
68+
remap = false,
6769
expect = 0,
6870
require = 0)
6971
private int brightnessFromSuper(IBlockAccess instance, int x, int y, int z, int lightValue) {
7072
return super.getLightBrightnessForSkyBlocks(x, y, z, lightValue);
7173
}
72-
73-
@Dynamic
74-
@Redirect(method = "getBlock",
75-
at = @At(value = "INVOKE",
76-
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;"),
77-
expect = 0,
78-
require = 0)
79-
private Block blockFromSuperDev(IBlockAccess instance, int x, int y, int z) {
80-
return super.getBlock(x, y, z);
81-
}
82-
83-
@Dynamic
84-
@Redirect(method = "func_147439_a",
85-
at = @At(value = "INVOKE",
86-
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;"),
87-
expect = 0,
88-
require = 0)
89-
private Block blockFromSuperObf(IBlockAccess instance, int x, int y, int z) {
90-
return super.getBlock(x, y, z);
91-
}
9274
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* This file is part of FalseTweaks.
3+
*
4+
* Copyright (C) 2022-2024 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, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* FalseTweaks is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
24+
package com.falsepattern.falsetweaks.mixin.mixins.client.cc.of;
25+
26+
import org.spongepowered.asm.mixin.Dynamic;
27+
import org.spongepowered.asm.mixin.Mixin;
28+
import org.spongepowered.asm.mixin.injection.At;
29+
import org.spongepowered.asm.mixin.injection.Redirect;
30+
31+
import net.minecraft.block.Block;
32+
import net.minecraft.world.ChunkCache;
33+
import net.minecraft.world.IBlockAccess;
34+
import net.minecraft.world.World;
35+
36+
@Mixin(targets = "ChunkCacheOF",
37+
remap = false)
38+
public abstract class ChunkCacheOF_Shader_DevMixin extends ChunkCache {
39+
public ChunkCacheOF_Shader_DevMixin(World p_i1964_1_, int p_i1964_2_, int p_i1964_3_, int p_i1964_4_, int p_i1964_5_, int p_i1964_6_, int p_i1964_7_, int p_i1964_8_) {
40+
super(p_i1964_1_, p_i1964_2_, p_i1964_3_, p_i1964_4_, p_i1964_5_, p_i1964_6_, p_i1964_7_, p_i1964_8_);
41+
}
42+
43+
@Dynamic
44+
@Redirect(method = "getBlock",
45+
at = @At(value = "INVOKE",
46+
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;",
47+
remap = true),
48+
remap = false,
49+
expect = 0,
50+
require = 0)
51+
private Block blockFromSuperDev(IBlockAccess instance, int x, int y, int z) {
52+
return super.getBlock(x, y, z);
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* This file is part of FalseTweaks.
3+
*
4+
* Copyright (C) 2022-2024 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, either version 3 of the License, or
13+
* (at your option) any later version.
14+
*
15+
* FalseTweaks is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* along with FalseTweaks. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
24+
package com.falsepattern.falsetweaks.mixin.mixins.client.cc.of;
25+
26+
import org.spongepowered.asm.mixin.Dynamic;
27+
import org.spongepowered.asm.mixin.Mixin;
28+
import org.spongepowered.asm.mixin.injection.At;
29+
import org.spongepowered.asm.mixin.injection.Redirect;
30+
31+
import net.minecraft.block.Block;
32+
import net.minecraft.world.ChunkCache;
33+
import net.minecraft.world.IBlockAccess;
34+
import net.minecraft.world.World;
35+
36+
@Mixin(targets = "ChunkCacheOF",
37+
remap = false)
38+
public abstract class ChunkCacheOF_Shader_ObfMixin extends ChunkCache {
39+
public ChunkCacheOF_Shader_ObfMixin(World p_i1964_1_, int p_i1964_2_, int p_i1964_3_, int p_i1964_4_, int p_i1964_5_, int p_i1964_6_, int p_i1964_7_, int p_i1964_8_) {
40+
super(p_i1964_1_, p_i1964_2_, p_i1964_3_, p_i1964_4_, p_i1964_5_, p_i1964_6_, p_i1964_7_, p_i1964_8_);
41+
}
42+
43+
@Dynamic
44+
@Redirect(method = "func_147439_a",
45+
at = @At(value = "INVOKE",
46+
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;",
47+
remap = true),
48+
remap = false,
49+
expect = 0,
50+
require = 0)
51+
private Block blockFromSuperObf(IBlockAccess instance, int x, int y, int z) {
52+
return super.getBlock(x, y, z);
53+
}
54+
}

0 commit comments

Comments
 (0)