Recipes can now show in the recipe book
This commit is contained in:
parent
bdcb8bf327
commit
5536a6cd94
4 changed files with 43 additions and 7 deletions
|
@ -51,6 +51,7 @@ import techreborn.compat.ICompatModule;
|
|||
import techreborn.dispenser.BehaviorDispenseScrapbox;
|
||||
import techreborn.entities.EntityNukePrimed;
|
||||
import techreborn.events.BlockBreakHandler;
|
||||
import techreborn.events.TREventHandler;
|
||||
import techreborn.events.TRTickHandler;
|
||||
import techreborn.init.*;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
@ -118,6 +119,8 @@ public class Core {
|
|||
|
||||
versionChecker = new VersionChecker("TechReborn", new ModInfo());
|
||||
versionChecker.checkVersionThreaded();
|
||||
|
||||
ModRecipes.init();
|
||||
logHelper.info("PreInitialization Complete");
|
||||
}
|
||||
|
||||
|
@ -135,11 +138,11 @@ public class Core {
|
|||
}
|
||||
MinecraftForge.EVENT_BUS.register(new StackWIPHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new BlockBreakHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new TREventHandler());
|
||||
|
||||
// Recipes
|
||||
StopWatch watch = new StopWatch();
|
||||
watch.start();
|
||||
ModRecipes.init();
|
||||
logHelper.all(watch + " : main recipes");
|
||||
watch.stop();
|
||||
// Client only init, needs to be done before parts system
|
||||
|
|
32
src/main/java/techreborn/events/TREventHandler.java
Normal file
32
src/main/java/techreborn/events/TREventHandler.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package techreborn.events;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TREventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void pickupEvent(EntityItemPickupEvent entityItemPickupEvent){
|
||||
if(entityItemPickupEvent.getEntityPlayer() instanceof EntityPlayerMP){
|
||||
if(entityItemPickupEvent.getItem().getItem().getItem().getRegistryName().getResourceDomain().equals(ModInfo.MOD_ID)){
|
||||
List<IRecipe> recipeList = new ArrayList<>();
|
||||
for(IRecipe recipe : CraftingManager.REGISTRY){
|
||||
if(recipe.getRegistryName() != null && recipe.getRegistryName().getResourceDomain().equals(ModInfo.MOD_ID)){
|
||||
if(recipe.getRecipeOutput().getItem().getRegistryName().getResourceDomain().equals(ModInfo.MOD_ID)){
|
||||
recipeList.add(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
entityItemPickupEvent.getEntityPlayer().unlockRecipes(recipeList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -52,4 +52,5 @@ public class TRTickHandler {
|
|||
previouslyWearing = chestslot;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -314,14 +314,14 @@ public class CraftingTableRecipes extends RecipeMethods {
|
|||
ItemStack leggings,
|
||||
ItemStack boots,
|
||||
String material) {
|
||||
registerShaped(sword, "G", "G", "S", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(sword, " G ", " G ", " S ", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(pickaxe, "GGG", " S ", " S ", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(axe, "GG", "GS", " S", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(hoe, "GG", " S", " S", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(spade, "G", "S", "S", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(helmet, "GGG", "G G", 'G', material);
|
||||
registerShaped(axe, "GG ", "GS ", " S ", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(hoe, "GG ", " S ", " S ", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(spade, " G ", " S ", " S ", 'S', Items.STICK, 'G', material);
|
||||
registerShaped(helmet, "GGG", "G G", " ", 'G', material);
|
||||
registerShaped(chestplate, "G G", "GGG", "GGG", 'G', material);
|
||||
registerShaped(leggings, "GGG", "G G", "G G", 'G', material);
|
||||
registerShaped(boots, "G G", "G G", 'G', material);
|
||||
registerShaped(boots, " ", "G G", "G G", 'G', material);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue