Skip to content

Commit f15d2ea

Browse files
committed
Made thermal expansion thread-safer
1 parent 057f0df commit f15d2ea

18 files changed

Lines changed: 771 additions & 0 deletions

build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,10 @@ dependencies {
105105
compileOnly(deobfCurse("securitycraft-64760:2818228"))
106106
// Storage Drawers 1.7.10-1.10.9
107107
compileOnly(deobfCurse("storage-drawers-223852:2469586"))
108+
// CoFH Core [1.7.10]3.1.4-329
109+
compileOnly(deobfCurse("cofh-core-69162:2388750"))
110+
// Thermal Foundation [1.7.10]1.2.6-118
111+
compileOnly(deobfCurse("thermal-foundation-222880:2388752"))
112+
// Thermal Expansion [1.7.10]4.1.5-248
113+
compileOnly(deobfCurse("thermal-expansion-69163:2388758"))
108114
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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.threadedupdates.thermalexpansion;
25+
26+
import cofh.thermalexpansion.block.cache.BlockCache;
27+
import com.falsepattern.falsetweaks.modules.threadedupdates.interop.ThermalExpansionCompat;
28+
import org.objectweb.asm.Opcodes;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Redirect;
32+
33+
@Mixin(value = BlockCache.class)
34+
public abstract class BlockCacheMixin {
35+
@Redirect(method = "canRenderInPass",
36+
at = @At(value = "FIELD",
37+
opcode = Opcodes.PUTSTATIC,
38+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I"),
39+
remap = false,
40+
require = 1)
41+
private void redirectSetRenderPass(int pass) {
42+
ThermalExpansionCompat.setCofhBlockRenderPass(pass);
43+
}
44+
45+
@Redirect(method = "getIcon(Lnet/minecraft/world/IBlockAccess;IIII)Lnet/minecraft/util/IIcon;",
46+
at = @At(value = "FIELD",
47+
opcode = Opcodes.GETSTATIC,
48+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I"),
49+
require = 1)
50+
private int redirectGetRenderPass() {
51+
return ThermalExpansionCompat.getCofhBlockRenderPass();
52+
}
53+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.threadedupdates.thermalexpansion;
25+
26+
import cofh.thermalexpansion.block.cell.BlockCell;
27+
import com.falsepattern.falsetweaks.modules.threadedupdates.interop.ThermalExpansionCompat;
28+
import org.objectweb.asm.Opcodes;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Redirect;
32+
33+
@Mixin(value = BlockCell.class,
34+
remap = false)
35+
public abstract class BlockCellMixin {
36+
@Redirect(method = "canRenderInPass",
37+
at = @At(value = "FIELD",
38+
opcode = Opcodes.PUTSTATIC,
39+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I"),
40+
require = 1)
41+
private void redirectSetRenderPass(int pass) {
42+
ThermalExpansionCompat.setCofhBlockRenderPass(pass);
43+
}
44+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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.threadedupdates.thermalexpansion;
25+
26+
import cofh.thermalexpansion.block.device.BlockDevice;
27+
import com.falsepattern.falsetweaks.modules.threadedupdates.interop.ThermalExpansionCompat;
28+
import org.objectweb.asm.Opcodes;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Redirect;
32+
33+
@Mixin(value = BlockDevice.class)
34+
public abstract class BlockDeviceMixin {
35+
@Redirect(method = "canRenderInPass",
36+
at = @At(value = "FIELD",
37+
opcode = Opcodes.PUTSTATIC,
38+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I",
39+
remap = false),
40+
remap = false,
41+
require = 1)
42+
private void redirectSetRenderPass(int pass) {
43+
ThermalExpansionCompat.setCofhBlockRenderPass(pass);
44+
}
45+
46+
@Redirect(method = "getIcon(Lnet/minecraft/world/IBlockAccess;IIII)Lnet/minecraft/util/IIcon;",
47+
at = @At(value = "FIELD",
48+
opcode = Opcodes.GETSTATIC,
49+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I",
50+
remap = false),
51+
require = 1)
52+
private int redirectGetRenderPass() {
53+
return ThermalExpansionCompat.getCofhBlockRenderPass();
54+
}
55+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.threadedupdates.thermalexpansion;
25+
26+
import cofh.thermalexpansion.block.ender.BlockEnder;
27+
import com.falsepattern.falsetweaks.modules.threadedupdates.interop.ThermalExpansionCompat;
28+
import org.objectweb.asm.Opcodes;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Redirect;
32+
33+
@Mixin(BlockEnder.class)
34+
public abstract class BlockEnderMixin {
35+
@Redirect(method = "canRenderInPass",
36+
at = @At(value = "FIELD",
37+
opcode = Opcodes.PUTSTATIC,
38+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I",
39+
remap = false),
40+
remap = false,
41+
require = 1)
42+
private void redirectSetRenderPass(int pass) {
43+
ThermalExpansionCompat.setCofhBlockRenderPass(pass);
44+
}
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.threadedupdates.thermalexpansion;
25+
26+
import cofh.thermalexpansion.block.simple.BlockFrame;
27+
import com.falsepattern.falsetweaks.modules.threadedupdates.interop.ThermalExpansionCompat;
28+
import org.objectweb.asm.Opcodes;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Redirect;
32+
33+
@Mixin(BlockFrame.class)
34+
public abstract class BlockFrameMixin {
35+
@Redirect(method = "canRenderInPass",
36+
at = @At(value = "FIELD",
37+
opcode = Opcodes.PUTSTATIC,
38+
target = "Lcofh/thermalexpansion/block/simple/BlockFrame;renderPass:I",
39+
remap = false),
40+
remap = false,
41+
require = 1)
42+
private void redirectSetRenderPass(int pass) {
43+
ThermalExpansionCompat.setFrameBlockRenderPass(pass);
44+
}
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.threadedupdates.thermalexpansion;
25+
26+
import cofh.thermalexpansion.block.light.BlockLight;
27+
import com.falsepattern.falsetweaks.modules.threadedupdates.interop.ThermalExpansionCompat;
28+
import org.objectweb.asm.Opcodes;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Redirect;
32+
33+
@Mixin(BlockLight.class)
34+
public abstract class BlockLightMixin {
35+
@Redirect(method = "canRenderInPass",
36+
at = @At(value = "FIELD",
37+
opcode = Opcodes.PUTSTATIC,
38+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I",
39+
remap = false),
40+
remap = false,
41+
require = 1)
42+
private void redirectSetRenderPass(int pass) {
43+
ThermalExpansionCompat.setCofhBlockRenderPass(pass);
44+
}
45+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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.threadedupdates.thermalexpansion;
25+
26+
import cofh.thermalexpansion.block.machine.BlockMachine;
27+
import com.falsepattern.falsetweaks.modules.threadedupdates.interop.ThermalExpansionCompat;
28+
import org.objectweb.asm.Opcodes;
29+
import org.spongepowered.asm.mixin.Mixin;
30+
import org.spongepowered.asm.mixin.injection.At;
31+
import org.spongepowered.asm.mixin.injection.Redirect;
32+
33+
@Mixin(BlockMachine.class)
34+
public abstract class BlockMachineMixin {
35+
@Redirect(method = "canRenderInPass",
36+
at = @At(value = "FIELD",
37+
opcode = Opcodes.PUTSTATIC,
38+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I",
39+
remap = false),
40+
remap = false,
41+
require = 1)
42+
private void redirectSetRenderPass(int pass) {
43+
ThermalExpansionCompat.setCofhBlockRenderPass(pass);
44+
}
45+
46+
@Redirect(method = "getIcon(Lnet/minecraft/world/IBlockAccess;IIII)Lnet/minecraft/util/IIcon;",
47+
at = @At(value = "FIELD",
48+
opcode = Opcodes.GETSTATIC,
49+
target = "Lcofh/core/block/BlockCoFHBase;renderPass:I",
50+
remap = false),
51+
require = 1)
52+
private int redirectGetRenderPass() {
53+
return ThermalExpansionCompat.getCofhBlockRenderPass();
54+
}
55+
}

0 commit comments

Comments
 (0)