Skip to content

Commit

Permalink
Partially fix floor-ceiling button Multipart incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Roadhog360 committed Dec 19, 2023
1 parent 6f26e20 commit bc4859f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/main/java/ganymedes01/etfuturum/EtFuturum.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import ganymedes01.etfuturum.compat.nei.IMCSenderGTNH;
import ganymedes01.etfuturum.configuration.ConfigBase;
import ganymedes01.etfuturum.configuration.configs.*;
import ganymedes01.etfuturum.core.handlers.WorldEventHandler;
import ganymedes01.etfuturum.core.proxy.CommonProxy;
import ganymedes01.etfuturum.entities.ModEntityList;
import ganymedes01.etfuturum.items.ItemWoodSign;
Expand Down Expand Up @@ -255,6 +256,22 @@ public void init(FMLInitializationEvent event) {
proxy.registerEntities();
proxy.registerRenderers();
IMCSenderGTNH.IMCSender();

if (ModsList.MULTIPART.isLoaded()) {
int[] metaSideMap = new int[]{0, 4, 5, 2, 3, 1, -1, -1};
int[] sideMetaMap = new int[]{0, 5, 3, 4, 1, 2};

try {
Class button = ReflectionHelper.getClass(getClass().getClassLoader(), "codechicken.multipart.minecraft.ButtonPart");
Field metaSideMapField = ReflectionHelper.findField(button, "metaSideMap");
metaSideMapField.setAccessible(true);
metaSideMapField.set(null, metaSideMap);
Field sideMetaMapField = ReflectionHelper.findField(button, "sideMetaMap");
sideMetaMapField.setAccessible(true);
sideMetaMapField.set(null, sideMetaMap);
} catch (Exception ignored) {
}
}
}

@EventHandler
Expand Down Expand Up @@ -354,6 +371,7 @@ public void onLoadComplete(FMLLoadCompleteEvent e) {
ConfigBase.postInit();

EtFuturumWorldGenerator.INSTANCE.postInit();
WorldEventHandler.INSTANCE.postInit();

if (ConfigSounds.newBlockSounds) {
//Because NP+ uses its own (worse) step sounds for this and it causes the check below that replaces these blocks to fail.
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/ganymedes01/etfuturum/compat/ModsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public enum ModsList {
BIOMES_O_PLENTY("BiomesOPlenty"),
EXTRA_UTILITIES("ExtraUtilities"),
APPLIED_ENERGISTICS_2("appliedenergistics2"),
MULTIPART("McMultipart"),
;

private final String modID;
Expand All @@ -43,7 +44,11 @@ public enum ModsList {

public boolean isLoaded() {
if (isLoaded == null) {
isLoaded = Loader.isModLoaded(modID);
if (Loader.instance() != null) {
isLoaded = Loader.isModLoaded(modID);
} else {
return false;
}
}
return isLoaded;
}
Expand Down

0 comments on commit bc4859f

Please sign in to comment.