Skip to content

Commit

Permalink
Make cake block <-> item conversion work with registry overrides
Browse files Browse the repository at this point in the history
Fixes #113, solves incompatibility with Persistent Cake mod
  • Loading branch information
squeek502 committed Feb 13, 2018
1 parent 5c04d31 commit 0515815
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions java/squeek/applecore/AppleCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
Expand Down Expand Up @@ -45,6 +46,12 @@ public void preInit(FMLPreInitializationEvent event)
FMLInterModComms.sendRuntimeMessage(ModInfo.MODID, "versionchecker", "addVersionCheck", "http://www.ryanliptak.com/minecraft/versionchecker/squeek502/AppleCore");
}

@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
AppleCoreRegistryImpl.INSTANCE.init();
}

@EventHandler
public void init(FMLInitializationEvent event)
{
Expand Down
14 changes: 12 additions & 2 deletions java/squeek/applecore/api_impl/AppleCoreRegistryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;
import squeek.applecore.api.AppleCoreAPI;
import squeek.applecore.api.IAppleCoreRegistry;

Expand All @@ -20,7 +20,17 @@ public enum AppleCoreRegistryImpl implements IAppleCoreRegistry
private AppleCoreRegistryImpl()
{
AppleCoreAPI.registry = this;
registerEdibleBlock(Blocks.CAKE, Items.CAKE);
}

@GameRegistry.ObjectHolder("minecraft:cake")
public static final Block CAKE_BLOCK = null;

@GameRegistry.ObjectHolder("minecraft:cake")
public static final Item CAKE_ITEM = null;

public void init()
{
registerEdibleBlock(CAKE_BLOCK, CAKE_ITEM);
}

@Override
Expand Down

0 comments on commit 0515815

Please sign in to comment.