forked from MobiusFlip/CrimsonRevelations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Add registry handler and revamp how recipes are registered -Add creative tab -Implement crimson fabric and crimson plates -Lots of recipe changes
- Loading branch information
1 parent
ce99933
commit a9b2219
Showing
10 changed files
with
349 additions
and
221 deletions.
There are no files selected for viewing
18 changes: 6 additions & 12 deletions
18
src/main/java/com/mobiusflip/crimsonrevelations/CrimsonRevelations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/mobiusflip/crimsonrevelations/init/CRCreativeTabs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.mobiusflip.crimsonrevelations.init; | ||
|
||
import net.minecraft.creativetab.CreativeTabs; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
import thaumcraft.api.items.ItemsTC; | ||
|
||
public class CRCreativeTabs extends CreativeTabs { | ||
public CRCreativeTabs(int length, String name) { | ||
super(length, name); | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
public ItemStack createIcon() { | ||
return new ItemStack(ItemsTC.curio, 1, 6); | ||
} | ||
} |
393 changes: 187 additions & 206 deletions
393
...onrevelations/recipes/CrimsonRecipes.java → ...rimsonrevelations/init/RecipeHandler.java
Large diffs are not rendered by default.
Oops, something went wrong.
90 changes: 90 additions & 0 deletions
90
src/main/java/com/mobiusflip/crimsonrevelations/init/RegistryHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.mobiusflip.crimsonrevelations.init; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import com.google.common.base.Preconditions; | ||
import com.mobiusflip.crimsonrevelations.CrimsonRevelations; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockDoor; | ||
import net.minecraft.block.BlockSlab; | ||
import net.minecraft.client.renderer.block.model.ModelResourceLocation; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemBlock; | ||
import net.minecraft.item.crafting.IRecipe; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.client.event.ModelRegistryEvent; | ||
import net.minecraftforge.client.model.ModelLoader; | ||
import net.minecraftforge.event.RegistryEvent; | ||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraftforge.fml.common.registry.ForgeRegistries; | ||
import net.minecraftforge.fml.common.registry.GameRegistry; | ||
import net.minecraftforge.fml.relauncher.Side; | ||
import net.minecraftforge.fml.relauncher.SideOnly; | ||
import net.minecraftforge.registries.IForgeRegistry; | ||
import net.minecraftforge.registries.IForgeRegistryEntry; | ||
|
||
@SuppressWarnings("deprecation") | ||
@EventBusSubscriber(modid = CrimsonRevelations.MODID) | ||
@GameRegistry.ObjectHolder(CrimsonRevelations.MODID) | ||
public class RegistryHandler { | ||
@GameRegistry.ObjectHolder("crimson_fabric") | ||
public static Item crimsonFabric; | ||
@GameRegistry.ObjectHolder("crimson_plate") | ||
public static Item crimsonPlate; | ||
|
||
@SubscribeEvent | ||
public static void registerItems(RegistryEvent.Register<Item> event) { | ||
event.getRegistry().registerAll( | ||
setup(new Item(), "crimson_fabric"), | ||
setup(new Item(), "crimson_plate") | ||
); | ||
} | ||
|
||
@SubscribeEvent | ||
public static void registerRecipes(RegistryEvent.Register<IRecipe> event) { | ||
RecipeHandler.initArcaneCrafting(); | ||
RecipeHandler.initCrucible(); | ||
RecipeHandler.initInfusion(); | ||
} | ||
|
||
@SubscribeEvent | ||
public static void registerItemBlocks(RegistryEvent.Register<Item> event) { | ||
final IForgeRegistry<Item> registry = event.getRegistry(); | ||
ForgeRegistries.BLOCKS.getValues().stream() | ||
.filter(block -> block.getRegistryName().getNamespace().equals(CrimsonRevelations.MODID)) | ||
.filter(block -> !(block instanceof BlockDoor)) // Doors should not have an item block registered | ||
.filter(block -> !(block instanceof BlockSlab)) // Slabs should not have an item block registered | ||
.forEach(block -> registry.register(setup(new ItemBlock(block), block.getRegistryName()))); | ||
} | ||
|
||
@SideOnly(Side.CLIENT) | ||
@SubscribeEvent | ||
public static void registerModels(ModelRegistryEvent event) { | ||
for (Item item : ForgeRegistries.ITEMS.getValues()) { | ||
if (item.getRegistryName().getNamespace().equals(CrimsonRevelations.MODID)) { | ||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "normal")); | ||
} | ||
} | ||
} | ||
|
||
@Nonnull | ||
public static <T extends IForgeRegistryEntry<T>> T setup(T entry, String name) { | ||
return setup(entry, new ResourceLocation(CrimsonRevelations.MODID, name)); | ||
} | ||
|
||
@Nonnull | ||
public static <T extends IForgeRegistryEntry<T>> T setup(T entry, ResourceLocation registryName) { | ||
Preconditions.checkNotNull(entry, "Entry to setup must not be null!"); | ||
Preconditions.checkNotNull(registryName, "Registry name to assign must not be null!"); | ||
entry.setRegistryName(registryName); | ||
if (entry instanceof Block) { | ||
((Block) entry).setTranslationKey(registryName.getNamespace() + "." + registryName.getPath()).setCreativeTab(CrimsonRevelations.tabCR); | ||
} | ||
if (entry instanceof Item) { | ||
((Item) entry).setTranslationKey(registryName.getNamespace() + "." + registryName.getPath()).setCreativeTab(CrimsonRevelations.tabCR); | ||
} | ||
return entry; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/mobiusflip/crimsonrevelations/init/ResearchHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.mobiusflip.crimsonrevelations.init; | ||
|
||
import com.mobiusflip.crimsonrevelations.CrimsonRevelations; | ||
|
||
import net.minecraft.util.ResourceLocation; | ||
import thaumcraft.Thaumcraft; | ||
import thaumcraft.api.ThaumcraftApi; | ||
import thaumcraft.api.aspects.AspectList; | ||
import thaumcraft.api.research.ResearchCategories; | ||
|
||
public class ResearchHandler { | ||
public static void init() { | ||
ResearchCategories.registerCategory("REVELATIONS", "CrimsonRites", new AspectList(), new ResourceLocation(Thaumcraft.MODID, "textures/items/crimson_rites.png"), new ResourceLocation(CrimsonRevelations.MODID, "textures/gui/research_background.jpg"), new ResourceLocation(Thaumcraft.MODID, "textures/gui/gui_research_back_over.png")); | ||
ThaumcraftApi.registerResearchLocation(new ResourceLocation(CrimsonRevelations.MODID, "research/revelations")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/resources/assets/crimsonrevelations/models/item/crimson_fabric.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "item/generated", | ||
"textures": { | ||
"layer0": "crimsonrevelations:items/crimson_fabric" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/resources/assets/crimsonrevelations/models/item/crimson_plate.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "item/generated", | ||
"textures": { | ||
"layer0": "crimsonrevelations:items/crimson_plate" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/resources/assets/crimsonrevelations/recipes/ancient_stone_tile.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"type": "forge:ore_shapeless", | ||
"ingredients": [ | ||
{ | ||
"item": "thaumcraft:stone_ancient" | ||
} | ||
], | ||
"result": { | ||
"item": "thaumcraft:stone_ancient_tile" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters