mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Add crafting recipes for RBMK fuel cooling, rod disassembly, and waste decaying
This commit is contained in:
parent
20bd424cd4
commit
a2f5eeada7
@ -0,0 +1,85 @@
|
|||||||
|
package com.hbm.handler.nei;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||||
|
import com.hbm.items.machine.ItemRBMKRod;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class RBMKRodDisassemblyHandler extends NEIUniversalHandler {
|
||||||
|
|
||||||
|
public RBMKRodDisassemblyHandler() {
|
||||||
|
super("RBMK Rod Disassembly", Blocks.crafting_table, getRecipes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return "ntmRBMKDisassembly";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<ComparableStack, ItemStack> getRecipes() {
|
||||||
|
HashMap<ComparableStack, ItemStack> map = new HashMap<>();
|
||||||
|
|
||||||
|
for(ItemRBMKRod rod : ItemRBMKRod.craftableRods) {
|
||||||
|
for(int enrichment = 0; enrichment <= 4; enrichment++) {
|
||||||
|
ItemStack result = new ItemStack(rod.pellet, 8, enrichment);
|
||||||
|
map.put(new ComparableStackHeat(rod, false, enrichment, false), result);
|
||||||
|
|
||||||
|
if(rod.pellet.isXenonEnabled()) {
|
||||||
|
ItemStack resultPoison = new ItemStack(rod.pellet, 8, enrichment + 5);
|
||||||
|
map.put(new ComparableStackHeat(rod, false, enrichment, true), resultPoison);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ComparableStackHeat extends ComparableStack {
|
||||||
|
|
||||||
|
// I was going to filter by these, but found it is just best to show all possible recipes for everything but heat
|
||||||
|
// that and... I'm actually stumped on how to filter by NBT, seeing as both `isApplicable` and `matchesRecipe` don't seem to work
|
||||||
|
private final boolean matchHot;
|
||||||
|
private final int matchEnrichment;
|
||||||
|
private final boolean matchPoison;
|
||||||
|
|
||||||
|
public ComparableStackHeat(Item item, boolean matchHot) {
|
||||||
|
this(item, matchHot, -1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComparableStackHeat(Item item, boolean matchHot, int matchEnrichment, boolean matchPoison) {
|
||||||
|
super(item);
|
||||||
|
this.matchHot = matchHot;
|
||||||
|
this.matchEnrichment = matchEnrichment;
|
||||||
|
this.matchPoison = matchPoison;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack toStack() {
|
||||||
|
ItemStack stack = super.toStack();
|
||||||
|
ItemRBMKRod rod = (ItemRBMKRod) stack.getItem();
|
||||||
|
if(matchEnrichment >= 0) {
|
||||||
|
ItemRBMKRod.setYield(stack, Math.max(1 - ((double) matchEnrichment) / 5, 0.05) * rod.yield);
|
||||||
|
} else {
|
||||||
|
ItemRBMKRod.setYield(stack, 0.2 * rod.yield);
|
||||||
|
}
|
||||||
|
if(matchPoison) ItemRBMKRod.setPoison(stack, 50);
|
||||||
|
if(!matchHot) return stack;
|
||||||
|
ItemRBMKRod.setCoreHeat(stack, 100);
|
||||||
|
ItemRBMKRod.setHullHeat(stack, 50);
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + matchEnrichment;
|
||||||
|
result = prime * result + (matchPoison ? 1 : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/main/java/com/hbm/handler/nei/RBMKWasteDecayHandler.java
Normal file
40
src/main/java/com/hbm/handler/nei/RBMKWasteDecayHandler.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package com.hbm.handler.nei;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||||
|
import com.hbm.items.ModItems;
|
||||||
|
import com.hbm.items.special.ItemWasteLong;
|
||||||
|
import com.hbm.items.special.ItemWasteShort;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class RBMKWasteDecayHandler extends NEIUniversalHandler {
|
||||||
|
|
||||||
|
public RBMKWasteDecayHandler() {
|
||||||
|
super("Nuclear Waste Decay", ModBlocks.machine_storage_drum, getRecipes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return "ntmRBMKWaste";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<ComparableStack, ItemStack> getRecipes() {
|
||||||
|
HashMap<ComparableStack, ItemStack> map = new HashMap<>();
|
||||||
|
|
||||||
|
for(ItemWasteShort.WasteClass waste : ItemWasteShort.WasteClass.values()) {
|
||||||
|
map.put(new ComparableStack(ModItems.nuclear_waste_short, 1, waste), new ItemStack(ModItems.nuclear_waste_short_depleted, 1, waste.ordinal()));
|
||||||
|
map.put(new ComparableStack(ModItems.nuclear_waste_short_tiny, 1, waste), new ItemStack(ModItems.nuclear_waste_short_depleted_tiny, 1, waste.ordinal()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(ItemWasteLong.WasteClass waste : ItemWasteLong.WasteClass.values()) {
|
||||||
|
map.put(new ComparableStack(ModItems.nuclear_waste_long, 1, waste), new ItemStack(ModItems.nuclear_waste_long_depleted, 1, waste.ordinal()));
|
||||||
|
map.put(new ComparableStack(ModItems.nuclear_waste_long_tiny, 1, waste), new ItemStack(ModItems.nuclear_waste_long_depleted_tiny, 1, waste.ordinal()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -8,10 +8,12 @@ import com.google.gson.JsonArray;
|
|||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import com.hbm.handler.nei.RBMKRodDisassemblyHandler;
|
||||||
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
import com.hbm.items.machine.ItemPWRFuel.EnumPWRFuel;
|
import com.hbm.items.machine.ItemPWRFuel.EnumPWRFuel;
|
||||||
|
import com.hbm.items.machine.ItemRBMKRod;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
@ -40,6 +42,12 @@ public class FuelPoolRecipes extends SerializableRecipe {
|
|||||||
recipes.put(new ComparableStack(ModItems.waste_plate_pu238be, 1, 1), new ItemStack(ModItems.waste_plate_pu238be));
|
recipes.put(new ComparableStack(ModItems.waste_plate_pu238be, 1, 1), new ItemStack(ModItems.waste_plate_pu238be));
|
||||||
|
|
||||||
for(EnumPWRFuel pwr : EnumPWRFuel.values()) recipes.put(new ComparableStack(ModItems.pwr_fuel_hot, 1, pwr.ordinal()), new ItemStack(ModItems.pwr_fuel_depleted, 1, pwr.ordinal()));
|
for(EnumPWRFuel pwr : EnumPWRFuel.values()) recipes.put(new ComparableStack(ModItems.pwr_fuel_hot, 1, pwr.ordinal()), new ItemStack(ModItems.pwr_fuel_depleted, 1, pwr.ordinal()));
|
||||||
|
|
||||||
|
for(ItemRBMKRod rod : ItemRBMKRod.craftableRods) {
|
||||||
|
ItemStack result = new ItemStack(rod);
|
||||||
|
ItemRBMKRod.setYield(result, 0.2 * rod.yield);
|
||||||
|
recipes.put(new RBMKRodDisassemblyHandler.ComparableStackHeat(rod, true), result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -32,6 +32,10 @@ public class ItemRBMKPellet extends ItemNuclearWaste {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isXenonEnabled() {
|
||||||
|
return hasXenon;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.items.machine;
|
package com.hbm.items.machine;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
@ -56,9 +57,13 @@ public class ItemRBMKRod extends Item {
|
|||||||
* i drew a fuel rod yay
|
* i drew a fuel rod yay
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public static List<ItemRBMKRod> craftableRods = new ArrayList<>();
|
||||||
|
|
||||||
public ItemRBMKRod(ItemRBMKPellet pellet) {
|
public ItemRBMKRod(ItemRBMKPellet pellet) {
|
||||||
this(pellet.fullName);
|
this(pellet.fullName);
|
||||||
this.pellet = pellet;
|
this.pellet = pellet;
|
||||||
|
|
||||||
|
craftableRods.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemRBMKRod(String fullName) {
|
public ItemRBMKRod(String fullName) {
|
||||||
@ -420,6 +425,10 @@ public class ItemRBMKRod extends Item {
|
|||||||
|
|
||||||
if(this == ModItems.rbmk_fuel_drx) {
|
if(this == ModItems.rbmk_fuel_drx) {
|
||||||
|
|
||||||
|
if(ItemRBMKRod.getHullHeat(stack) >= 50 && ItemRBMKRod.getCoreHeat(stack) >= 50) {
|
||||||
|
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("desc.item.wasteCooling"));
|
||||||
|
}
|
||||||
|
|
||||||
if(selfRate > 0 || this.function == EnumBurnFunc.SIGMOID) {
|
if(selfRate > 0 || this.function == EnumBurnFunc.SIGMOID) {
|
||||||
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmx.source"));
|
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmx.source"));
|
||||||
}
|
}
|
||||||
@ -440,6 +449,10 @@ public class ItemRBMKRod extends Item {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if(ItemRBMKRod.getHullHeat(stack) >= 50 && ItemRBMKRod.getCoreHeat(stack) >= 50) {
|
||||||
|
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("desc.item.wasteCooling"));
|
||||||
|
}
|
||||||
|
|
||||||
if(selfRate > 0 || this.function == EnumBurnFunc.SIGMOID) {
|
if(selfRate > 0 || this.function == EnumBurnFunc.SIGMOID) {
|
||||||
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmk.source"));
|
list.add(EnumChatFormatting.RED + I18nUtil.resolveKey("trait.rbmk.source"));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,8 @@ public class NEIRegistry {
|
|||||||
handlers.add(new FusionRecipeHandler());
|
handlers.add(new FusionRecipeHandler());
|
||||||
handlers.add(new SILEXRecipeHandler());
|
handlers.add(new SILEXRecipeHandler());
|
||||||
handlers.add(new FuelPoolHandler());
|
handlers.add(new FuelPoolHandler());
|
||||||
|
handlers.add(new RBMKRodDisassemblyHandler());
|
||||||
|
handlers.add(new RBMKWasteDecayHandler());
|
||||||
handlers.add(new CrucibleSmeltingHandler());
|
handlers.add(new CrucibleSmeltingHandler());
|
||||||
handlers.add(new CrucibleAlloyingHandler());
|
handlers.add(new CrucibleAlloyingHandler());
|
||||||
handlers.add(new CrucibleCastingHandler());
|
handlers.add(new CrucibleCastingHandler());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user