Skip to content

Commit

Permalink
be less stupid about bwm errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadows-of-Fire committed Apr 17, 2019
1 parent 91d26a7 commit 7ebabf4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
apply plugin: 'net.minecraftforge.gradle.forge'


version = "1.12.2-1.2.2"
version = "1.12.2-1.2.3"
group= "shadows.fastfurnace"
archivesBaseName = "FastFurnace"

Expand All @@ -20,9 +20,9 @@ compileJava {
}

minecraft {
version = "1.12.2-14.23.4.2739"
version = "1.12.2-14.23.5.2836"
runDir = "run"
mappings = "snapshot_20180720"
mappings = "stable_39"
makeObfSourceJar = false
}

Expand Down
Binary file added libs/BetterWithMods-1.12-2.3.20-1027.jar
Binary file not shown.
12 changes: 12 additions & 0 deletions src/main/java/shadows/fastfurnace/BWMCompat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package shadows.fastfurnace;

import betterwithmods.module.ModuleLoader;
import betterwithmods.module.hardcore.crafting.HCFurnace;

public class BWMCompat {

public static boolean isBWMFurnaceEnabled() {
return ModuleLoader.isFeatureEnabled(HCFurnace.class);
}

}
39 changes: 27 additions & 12 deletions src/main/java/shadows/fastfurnace/FastFurnace.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
import org.apache.logging.log4j.Logger;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent.Register;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import shadows.fastfurnace.block.BlockFastFurnace;
import shadows.fastfurnace.block.TileFastFurnace;
Expand All @@ -23,7 +25,7 @@ public class FastFurnace {

public static final String MODID = "fastfurnace";
public static final String MODNAME = "FastFurnace";
public static final String VERSION = "1.2.2";
public static final String VERSION = "1.2.3";

public static final Logger LOG = LogManager.getLogger(MODID);

Expand All @@ -33,16 +35,29 @@ public void preInit(FMLPreInitializationEvent e) {
GameRegistry.registerTileEntity(TileFastFurnace.class, new ResourceLocation("minecraft", "furnace"));
}

@SubscribeEvent(priority = EventPriority.LOWEST)
@SubscribeEvent
public void blockBois(Register<Block> e) {
Block b = new BlockFastFurnace(false).setRegistryName("minecraft", "furnace");
e.getRegistry().registerAll(b, new BlockFastFurnace(true).setRegistryName("minecraft", "lit_furnace"));
ForgeRegistries.ITEMS.register(new ItemBlock(b) {
@Override
public String getCreatorModId(net.minecraft.item.ItemStack itemStack) {
return MODID;
}
}.setRegistryName(b.getRegistryName()));
if (shouldRun()) {
Block b = new BlockFastFurnace(false).setRegistryName("minecraft", "furnace");
e.getRegistry().registerAll(b, new BlockFastFurnace(true).setRegistryName("minecraft", "lit_furnace"));
}
}

@SubscribeEvent
public void items(Register<Item> e) {
if (shouldRun()) {
e.getRegistry().register(new ItemBlock(Blocks.FURNACE) {
@Override
public String getCreatorModId(ItemStack itemStack) {
return MODID;
}
}.setRegistryName(Blocks.FURNACE.getRegistryName()));
}
}

static boolean shouldRun() {
boolean bwm = Loader.isModLoaded("betterwithmods");
return !bwm || bwm && !BWMCompat.isBWMFurnaceEnabled();
}

}

0 comments on commit 7ebabf4

Please sign in to comment.