Skip to content

Commit 830b768

Browse files
authored
Merge pull request #595 from SymmetricDevs/bru-bdsm-cme
fix: CME in BDS&M
2 parents 198cec5 + 2cf9b37 commit 830b768

File tree

6 files changed

+60
-18
lines changed

6 files changed

+60
-18
lines changed

dependencies.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
2121
*/
2222
dependencies {
23-
implementation 'org.reflections:reflections:0.10.2'
24-
2523
// # Fix crashes on macOS with Narrator
2624
runtimeOnly 'com.cleanroommc:osxnarratorblocker:1.0'
2725

src/main/java/supersymmetry/Supersymmetry.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import net.minecraftforge.fml.relauncher.SideOnly;
1010

1111
import org.jetbrains.annotations.NotNull;
12-
import org.reflections.Reflections;
1312

1413
import gregtech.GTInternalTags;
1514
import supersymmetry.api.capability.SuSyCapabilities;
@@ -48,8 +47,6 @@ public class Supersymmetry {
4847
@Mod.Instance(Supersymmetry.MODID)
4948
public static Supersymmetry instance;
5049

51-
public static Reflections reflectionHandler;
52-
5350
@Mod.EventHandler
5451
public void onModConstruction(FMLConstructionEvent event) {
5552
// This is now a config option I think
@@ -65,8 +62,6 @@ public void onModConstruction(FMLConstructionEvent event) {
6562
public void onPreInit(@NotNull FMLPreInitializationEvent event) {
6663
proxy.preLoad();
6764

68-
reflectionHandler = new Reflections("supersymmetry");
69-
7065
SuSyMetaBlocks.init();
7166
SuSyMetaItems.initMetaItems();
7267
SuSyBlocks.init();

src/main/java/supersymmetry/api/rocketry/fuels/RocketFuelEntry.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,43 @@ public class RocketFuelEntry {
1212

1313
public static class RocketFuelEntryBuilder {
1414

15-
private RocketFuelEntry rfe;
15+
private String registryName;
16+
private ArrayList<Tuple<Material, Integer>> composition;
17+
private double density;
18+
private double sIVacuum;
19+
private double sIPerPressure;
1620

1721
public RocketFuelEntryBuilder(String name) {
18-
this.rfe.registryName = name;
19-
this.rfe.composition = new ArrayList<>();
22+
this.registryName = name;
23+
this.composition = new ArrayList<>();
2024
}
2125

2226
public RocketFuelEntryBuilder addComponent(Material mat, int proportion) {
23-
rfe.composition.add(new Tuple<Material, Integer>(mat, proportion));
27+
composition.add(new Tuple<>(mat, proportion));
2428
return this;
2529
}
2630

2731
public RocketFuelEntryBuilder density(double density) {
28-
rfe.density = density;
32+
this.density = density;
2933
return this;
3034
}
3135

3236
public RocketFuelEntryBuilder sIVacuum(double sIVacuum) {
33-
rfe.sIVacuum = sIVacuum;
37+
this.sIVacuum = sIVacuum;
3438
return this;
3539
}
3640

3741
public RocketFuelEntryBuilder sIPerPressure(double sIPerPressure) {
38-
rfe.sIPerPressure = sIPerPressure;
42+
this.sIPerPressure = sIPerPressure;
3943
return this;
4044
}
4145

4246
public void register() {
43-
if (rfe.composition.isEmpty()) {
47+
if (this.composition.isEmpty()) {
4448
throw new IllegalStateException("empty list of fuel component entries");
4549
}
46-
RocketFuelEntry.registerFuel(rfe);
50+
RocketFuelEntry.registerFuel(new RocketFuelEntry(this.registryName, this.composition, this.density,
51+
this.sIVacuum, this.sIPerPressure));
4752
}
4853
}
4954

src/main/java/supersymmetry/common/materials/SuSyHighDegreeMaterials.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public class SuSyHighDegreeMaterials {
1111

1212
public static void init() {
1313
// The gold content is much less than this
14-
MetallizedBoPET = new Material.Builder(15289, SuSyUtility.susyId("metallized_bopet"))
14+
// Placed at the end of ThirdDegreeMaterials.groovy
15+
MetallizedBoPET = new Material.Builder(24999, SuSyUtility.susyId("metallized_bopet"))
1516
.polymer()
1617
.flags(GENERATE_FOIL)
1718
.components(Carbon, 10, Hydrogen, 6, Oxygen, 4, Gold, 1)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package supersymmetry.mixins.bdsandm;
2+
3+
import net.minecraft.block.state.IBlockState;
4+
import net.minecraft.entity.player.EntityPlayerMP;
5+
import net.minecraft.util.EnumFacing;
6+
import net.minecraft.util.EnumHand;
7+
import net.minecraft.util.IThreadListener;
8+
import net.minecraft.util.math.BlockPos;
9+
import net.minecraft.world.World;
10+
import net.minecraftforge.fml.common.FMLCommonHandler;
11+
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
12+
13+
import org.spongepowered.asm.mixin.Mixin;
14+
import org.spongepowered.asm.mixin.injection.At;
15+
16+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
17+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
18+
19+
import funwayguy.bdsandm.blocks.IStorageBlock;
20+
import funwayguy.bdsandm.network.PacketBdsm;
21+
22+
// I will PR this to UniversalTweaks as well.
23+
@Mixin(value = PacketBdsm.ServerHandler.class, remap = false, priority = Integer.MAX_VALUE)
24+
public class ServerHandlerMixin {
25+
26+
@WrapOperation(method = "onMessage(Lfunwayguy/bdsandm/network/PacketBdsm;Lnet/minecraftforge/fml/common/network/simpleimpl/MessageContext;)Lfunwayguy/bdsandm/network/PacketBdsm;",
27+
at = @At(target = "Lfunwayguy/bdsandm/blocks/IStorageBlock;onPlayerInteract(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/EnumFacing;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/util/EnumHand;ZZI)V",
28+
value = "INVOKE"))
29+
public void threadSafeInteract(IStorageBlock instance, World world, BlockPos blockPos, IBlockState iBlockState,
30+
EnumFacing enumFacing, EntityPlayerMP entityPlayerMP, EnumHand enumHand,
31+
boolean isHit, boolean altMode, int delay, Operation<Void> original,
32+
PacketBdsm message, MessageContext ctx) {
33+
IThreadListener threadListener = FMLCommonHandler.instance().getWorldThread(ctx.netHandler);
34+
if (threadListener.isCallingFromMinecraftThread()) {
35+
original.call(instance, world, blockPos, iBlockState, enumFacing, entityPlayerMP, enumHand, isHit, altMode,
36+
delay);
37+
} else {
38+
threadListener.addScheduledTask(() -> original.call(instance, world, blockPos, iBlockState, enumFacing,
39+
entityPlayerMP, enumHand, isHit, altMode, delay));
40+
}
41+
}
42+
}

src/main/resources/mixins.susy.bdsandm.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"compatibilityLevel" : "JAVA_8",
77
"mixins" : [
88
"BlockBarrelBaseMixin",
9-
"ItemBarrelMixin"
9+
"ItemBarrelMixin",
10+
"ServerHandlerMixin"
1011
]
1112
}

0 commit comments

Comments
 (0)