mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
if rod is hot, only show cooling recipe, if rod is cold, show only disassembly recipe
This commit is contained in:
parent
a2f5eeada7
commit
86ce0f6509
@ -2,6 +2,9 @@ package com.hbm.handler.nei;
|
|||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.inventory.recipes.FuelPoolRecipes;
|
import com.hbm.inventory.recipes.FuelPoolRecipes;
|
||||||
|
import com.hbm.items.machine.ItemRBMKRod;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class FuelPoolHandler extends NEIUniversalHandler {
|
public class FuelPoolHandler extends NEIUniversalHandler {
|
||||||
|
|
||||||
@ -13,4 +16,22 @@ public class FuelPoolHandler extends NEIUniversalHandler {
|
|||||||
public String getKey() {
|
public String getKey() {
|
||||||
return "ntmSpentDrum";
|
return "ntmSpentDrum";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadUsageRecipes(ItemStack ingredient) {
|
||||||
|
if(ingredient != null && ingredient.getItem() != null && ingredient.getItem() instanceof ItemRBMKRod) {
|
||||||
|
if(ItemRBMKRod.getCoreHeat(ingredient) < 50 && ItemRBMKRod.getHullHeat(ingredient) < 50) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.loadUsageRecipes(ingredient);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadCraftingRecipes(ItemStack ingredient) {
|
||||||
|
if(ingredient != null && ingredient.getItem() != null && ingredient.getItem() instanceof ItemRBMKRod) {
|
||||||
|
if(ItemRBMKRod.getCoreHeat(ingredient) >= 50 || ItemRBMKRod.getHullHeat(ingredient) >= 50) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.loadCraftingRecipes(ingredient);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,35 +38,44 @@ public class RBMKRodDisassemblyHandler extends NEIUniversalHandler {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ComparableStackHeat extends ComparableStack {
|
// Don't show recipes for hot rods (which will cause it to only show cooling recipes)
|
||||||
|
@Override
|
||||||
// I was going to filter by these, but found it is just best to show all possible recipes for everything but heat
|
public void loadUsageRecipes(ItemStack ingredient) {
|
||||||
// that and... I'm actually stumped on how to filter by NBT, seeing as both `isApplicable` and `matchesRecipe` don't seem to work
|
if(ingredient != null && ingredient.getItem() != null && ingredient.getItem() instanceof ItemRBMKRod) {
|
||||||
private final boolean matchHot;
|
if(ItemRBMKRod.getCoreHeat(ingredient) > 50 || ItemRBMKRod.getHullHeat(ingredient) > 50) return;
|
||||||
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.loadUsageRecipes(ingredient);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ComparableStackHeat extends ComparableStack {
|
||||||
|
|
||||||
|
// I was going to filter by all of these, but found it is just best to show all possible recipes for everything but heat
|
||||||
|
private final boolean isHot;
|
||||||
|
private final int enrichment;
|
||||||
|
private final boolean hasPoison;
|
||||||
|
|
||||||
|
public ComparableStackHeat(Item item, boolean isHot) {
|
||||||
|
this(item, isHot, -1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComparableStackHeat(Item item, boolean isHot, int enrichment, boolean hasPoison) {
|
||||||
super(item);
|
super(item);
|
||||||
this.matchHot = matchHot;
|
this.isHot = isHot;
|
||||||
this.matchEnrichment = matchEnrichment;
|
this.enrichment = enrichment;
|
||||||
this.matchPoison = matchPoison;
|
this.hasPoison = hasPoison;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack toStack() {
|
public ItemStack toStack() {
|
||||||
ItemStack stack = super.toStack();
|
ItemStack stack = super.toStack();
|
||||||
ItemRBMKRod rod = (ItemRBMKRod) stack.getItem();
|
ItemRBMKRod rod = (ItemRBMKRod) stack.getItem();
|
||||||
if(matchEnrichment >= 0) {
|
if(enrichment >= 0) {
|
||||||
ItemRBMKRod.setYield(stack, Math.max(1 - ((double) matchEnrichment) / 5, 0.05) * rod.yield);
|
ItemRBMKRod.setYield(stack, Math.min(1 - ((double) enrichment) / 5, 0.99) * rod.yield);
|
||||||
} else {
|
} else {
|
||||||
ItemRBMKRod.setYield(stack, 0.2 * rod.yield);
|
ItemRBMKRod.setYield(stack, 0.2 * rod.yield);
|
||||||
}
|
}
|
||||||
if(matchPoison) ItemRBMKRod.setPoison(stack, 50);
|
if(hasPoison) ItemRBMKRod.setPoison(stack, 50);
|
||||||
if(!matchHot) return stack;
|
if(!isHot) return stack;
|
||||||
ItemRBMKRod.setCoreHeat(stack, 100);
|
ItemRBMKRod.setCoreHeat(stack, 100);
|
||||||
ItemRBMKRod.setHullHeat(stack, 50);
|
ItemRBMKRod.setHullHeat(stack, 50);
|
||||||
return stack;
|
return stack;
|
||||||
@ -76,8 +85,8 @@ public class RBMKRodDisassemblyHandler extends NEIUniversalHandler {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = super.hashCode();
|
int result = super.hashCode();
|
||||||
result = prime * result + matchEnrichment;
|
result = prime * result + enrichment;
|
||||||
result = prime * result + (matchPoison ? 1 : 0);
|
result = prime * result + (hasPoison ? 1 : 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -425,7 +425,7 @@ 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) {
|
if(ItemRBMKRod.getHullHeat(stack) >= 50 || ItemRBMKRod.getCoreHeat(stack) >= 50) {
|
||||||
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("desc.item.wasteCooling"));
|
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("desc.item.wasteCooling"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ public class ItemRBMKRod extends Item {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if(ItemRBMKRod.getHullHeat(stack) >= 50 && ItemRBMKRod.getCoreHeat(stack) >= 50) {
|
if(ItemRBMKRod.getHullHeat(stack) >= 50 || ItemRBMKRod.getCoreHeat(stack) >= 50) {
|
||||||
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("desc.item.wasteCooling"));
|
list.add(EnumChatFormatting.GOLD + I18nUtil.resolveKey("desc.item.wasteCooling"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user