diff --git a/src/main/java/gregtech/api/nuclear/fission/CoolantRegistry.java b/src/main/java/gregtech/api/nuclear/fission/CoolantRegistry.java index 9fcc0ad604c..9d8f9988c82 100644 --- a/src/main/java/gregtech/api/nuclear/fission/CoolantRegistry.java +++ b/src/main/java/gregtech/api/nuclear/fission/CoolantRegistry.java @@ -7,6 +7,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collection; import java.util.Map; public class CoolantRegistry { @@ -24,6 +25,11 @@ public static ICoolantStats getCoolant(Fluid fluid) { return COOLANTS.get(fluid); } + @NotNull + public static Collection getAllCoolants() { + return COOLANTS.keySet(); + } + @Nullable public static Fluid originalFluid(ICoolantStats stats) { return COOLANTS_INVERSE.get(stats); diff --git a/src/main/java/gregtech/api/nuclear/fission/FissionFuelRegistry.java b/src/main/java/gregtech/api/nuclear/fission/FissionFuelRegistry.java index 58dd807ef64..94d3fd945df 100644 --- a/src/main/java/gregtech/api/nuclear/fission/FissionFuelRegistry.java +++ b/src/main/java/gregtech/api/nuclear/fission/FissionFuelRegistry.java @@ -11,6 +11,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collection; import java.util.Map; public class FissionFuelRegistry { @@ -31,6 +32,11 @@ public static IFissionFuelStats getFissionFuel(ItemStack stack) { return FUELS.get(stack); } + @NotNull + public static Collection getAllFissionableRods() { + return FUELS.keySet(); + } + @Nullable public static IFissionFuelStats getFissionFuel(int hash) { return HASHED_FUELS.get(hash); diff --git a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java index 5ce3cff1cb9..a525f503d1b 100644 --- a/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java +++ b/src/main/java/gregtech/integration/jei/JustEnoughItemsModule.java @@ -12,6 +12,8 @@ import gregtech.api.metatileentity.SteamMetaTileEntity; import gregtech.api.metatileentity.registry.MTERegistry; import gregtech.api.modules.GregTechModule; +import gregtech.api.nuclear.fission.CoolantRegistry; +import gregtech.api.nuclear.fission.FissionFuelRegistry; import gregtech.api.recipes.Recipe; import gregtech.api.recipes.RecipeMap; import gregtech.api.recipes.category.GTRecipeCategory; @@ -31,6 +33,10 @@ import gregtech.common.items.MetaItems; import gregtech.common.metatileentities.MetaTileEntities; import gregtech.integration.IntegrationSubmodule; +import gregtech.integration.jei.basic.CoolantCategory; +import gregtech.integration.jei.basic.CoolantInfo; +import gregtech.integration.jei.basic.FissionFuelCategory; +import gregtech.integration.jei.basic.FissionFuelInfo; import gregtech.integration.jei.basic.GTFluidVeinCategory; import gregtech.integration.jei.basic.GTFluidVeinInfo; import gregtech.integration.jei.basic.GTOreCategory; @@ -55,6 +61,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent; import net.minecraftforge.fml.relauncher.Side; @@ -86,11 +93,11 @@ @JEIPlugin @GregTechModule( - moduleID = GregTechModules.MODULE_JEI, - containerID = GTValues.MODID, - modDependencies = Mods.Names.JUST_ENOUGH_ITEMS, - name = "GregTech JEI Integration", - description = "JustEnoughItems Integration Module") + moduleID = GregTechModules.MODULE_JEI, + containerID = GTValues.MODID, + modDependencies = Mods.Names.JUST_ENOUGH_ITEMS, + name = "GregTech JEI Integration", + description = "JustEnoughItems Integration Module") public class JustEnoughItemsModule extends IntegrationSubmodule implements IModPlugin { public static IIngredientRegistry ingredientRegistry; @@ -138,6 +145,8 @@ public void registerCategories(@NotNull IRecipeCategoryRegistration registry) { registry.addRecipeCategories(new GTOreCategory(registry.getJeiHelpers().getGuiHelper())); registry.addRecipeCategories(new GTFluidVeinCategory(registry.getJeiHelpers().getGuiHelper())); registry.addRecipeCategories(new MaterialTreeCategory(registry.getJeiHelpers().getGuiHelper())); + registry.addRecipeCategories(new CoolantCategory(registry.getJeiHelpers().getGuiHelper())); + registry.addRecipeCategories(new FissionFuelCategory(registry.getJeiHelpers().getGuiHelper())); } @Override @@ -188,7 +197,7 @@ public void register(IModRegistry registry) { } registry.addRecipes(recipeStream.map(r -> new GTRecipeWrapper(recipeMap, r)) - .collect(Collectors.toList()), + .collect(Collectors.toList()), entry.getKey().getUniqueID()); } } @@ -294,6 +303,30 @@ public void register(IModRegistry registry) { registry.addRecipeCatalyst(MetaItems.PROSPECTOR_LUV.getStackForm(), fluidVeinSpawnID); // Fluid Veins End + // Nuclear + Collection fissionFuels = FissionFuelRegistry.getAllFissionableRods(); + List fissionFuelInfos = new ArrayList<>(); + for (ItemStack fuel : fissionFuels) { + fissionFuelInfos.add(new FissionFuelInfo(fuel, + FissionFuelRegistry.getDepletedFuel(FissionFuelRegistry.getFissionFuel(fuel)))); + } + + String fissionFuelID = GTValues.MODID + ":" + "fission_fuel"; + + registry.addRecipes(fissionFuelInfos, fissionFuelID); + registry.addRecipeCatalyst(MetaTileEntities.FISSION_REACTOR.getStackForm(), fissionFuelID); + + Collection coolants = CoolantRegistry.getAllCoolants(); + List coolantInfos = new ArrayList<>(); + for (Fluid coolant : coolants) { + coolantInfos.add(new CoolantInfo(coolant, CoolantRegistry.getCoolant(coolant).getHotCoolant())); + } + + String coolantID = GTValues.MODID + ":" + "coolant"; + registry.addRecipes(coolantInfos, coolantID); + registry.addRecipeCatalyst(MetaTileEntities.FISSION_REACTOR.getStackForm(), coolantID); + // Nuclear End + ingredientRegistry = registry.getIngredientRegistry(); for (int i = 0; i <= IntCircuitIngredient.CIRCUIT_MAX; i++) { registry.addIngredientInfo(IntCircuitIngredient.getIntegratedCircuit(i), VanillaTypes.ITEM, diff --git a/src/main/java/gregtech/integration/jei/basic/CoolantCategory.java b/src/main/java/gregtech/integration/jei/basic/CoolantCategory.java new file mode 100644 index 00000000000..9f77582118c --- /dev/null +++ b/src/main/java/gregtech/integration/jei/basic/CoolantCategory.java @@ -0,0 +1,57 @@ +package gregtech.integration.jei.basic; + +import gregtech.api.gui.GuiTextures; +import gregtech.common.metatileentities.MetaTileEntities; + +import mezz.jei.api.gui.IGuiFluidStackGroup; + +import net.minecraft.client.Minecraft; + +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.recipe.IRecipeWrapper; +import org.jetbrains.annotations.Nullable; + +public class CoolantCategory extends BasicRecipeCategory { + private final IDrawable icon; + protected final IDrawable slot; + private final IDrawable arrow; + public CoolantCategory(IGuiHelper guiHelper) { + super("coolant", "fission.coolant.name", guiHelper.createBlankDrawable(176, 50), guiHelper); + + this.icon = guiHelper.createDrawableIngredient(MetaTileEntities.FISSION_REACTOR.getStackForm()); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.arrow = guiHelper.drawableBuilder(GuiTextures.PROGRESS_BAR_ARROW.imageLocation, 0, 20, 20, 20).setTextureSize(20, 40).build(); + } + + @Nullable + @Override + public IDrawable getIcon() { + return this.icon; + } + + @Override + public void setRecipe(IRecipeLayout recipeLayout, CoolantInfo recipeWrapper, IIngredients ingredients) { + IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); + + fluidStackGroup.init(0, true, 55, 17); + fluidStackGroup.set(0, recipeWrapper.coolant); + fluidStackGroup.init(1, true, 105, 17); + fluidStackGroup.set(1, recipeWrapper.hotCoolant); + } + + @Override + public void drawExtras(Minecraft minecraft) { + slot.draw(minecraft, 54, 16); + slot.draw(minecraft, 104, 16); + arrow.draw(minecraft, 77, 14); + } + + @Override + public IRecipeWrapper getRecipeWrapper(CoolantInfo recipe) { + return recipe; + } +} diff --git a/src/main/java/gregtech/integration/jei/basic/CoolantInfo.java b/src/main/java/gregtech/integration/jei/basic/CoolantInfo.java new file mode 100644 index 00000000000..09244461bfe --- /dev/null +++ b/src/main/java/gregtech/integration/jei/basic/CoolantInfo.java @@ -0,0 +1,26 @@ +package gregtech.integration.jei.basic; + +import net.minecraft.item.ItemStack; + +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; + +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +public class CoolantInfo implements IRecipeWrapper +{ + public FluidStack coolant; + public FluidStack hotCoolant; + + public CoolantInfo(Fluid coolant, Fluid hotCoolant) { + this.coolant = new FluidStack(coolant, 1000); + this.hotCoolant = new FluidStack(hotCoolant, 1000); + } + @Override + public void getIngredients(IIngredients ingredients) { + ingredients.setInput(VanillaTypes.FLUID, coolant); + ingredients.setOutput(VanillaTypes.FLUID, hotCoolant); + } +} diff --git a/src/main/java/gregtech/integration/jei/basic/FissionFuelCategory.java b/src/main/java/gregtech/integration/jei/basic/FissionFuelCategory.java new file mode 100644 index 00000000000..d251a127a2c --- /dev/null +++ b/src/main/java/gregtech/integration/jei/basic/FissionFuelCategory.java @@ -0,0 +1,62 @@ +package gregtech.integration.jei.basic; + +import gregtech.GTInternalTags; +import gregtech.api.GTValues; +import gregtech.api.gui.GuiTextures; + +import gregtech.common.metatileentities.MetaTileEntities; + +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.ingredients.IIngredients; + +import mezz.jei.api.recipe.IRecipeCategory; + +import mezz.jei.api.recipe.IRecipeWrapper; + +import net.minecraft.client.Minecraft; + +import org.jetbrains.annotations.Nullable; + +public class FissionFuelCategory extends BasicRecipeCategory { + private final IDrawable icon; + protected final IDrawable slot; + private final IDrawable arrow; + public FissionFuelCategory(IGuiHelper guiHelper) { + super("fission_fuel", "fission.fuel.name", guiHelper.createBlankDrawable(176, 50), guiHelper); + + this.icon = guiHelper.createDrawableIngredient(MetaTileEntities.FISSION_REACTOR.getStackForm()); + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.arrow = guiHelper.drawableBuilder(GuiTextures.PROGRESS_BAR_ARROW.imageLocation, 0, 20, 20, 20).setTextureSize(20, 40).build(); + } + + @Nullable + @Override + public IDrawable getIcon() { + return this.icon; + } + + @Override + public void setRecipe(IRecipeLayout recipeLayout, FissionFuelInfo recipeWrapper, IIngredients ingredients) { + IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); + + itemStackGroup.init(0, true, 54, 16); + itemStackGroup.set(0, recipeWrapper.rod); + itemStackGroup.init(1, true, 104, 16); + itemStackGroup.set(1, recipeWrapper.depletedRod); + } + + @Override + public void drawExtras(Minecraft minecraft) { + slot.draw(minecraft, 54, 16); + slot.draw(minecraft, 104, 16); + arrow.draw(minecraft, 77, 14); + } + + @Override + public IRecipeWrapper getRecipeWrapper(FissionFuelInfo recipe) { + return recipe; + } +} diff --git a/src/main/java/gregtech/integration/jei/basic/FissionFuelInfo.java b/src/main/java/gregtech/integration/jei/basic/FissionFuelInfo.java new file mode 100644 index 00000000000..88590e9e69f --- /dev/null +++ b/src/main/java/gregtech/integration/jei/basic/FissionFuelInfo.java @@ -0,0 +1,24 @@ +package gregtech.integration.jei.basic; + +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; + +import mezz.jei.api.recipe.IRecipeWrapper; + +import net.minecraft.item.ItemStack; + +public class FissionFuelInfo implements IRecipeWrapper +{ + public ItemStack rod; + public ItemStack depletedRod; + + public FissionFuelInfo(ItemStack rod, ItemStack depletedRod) { + this.rod = rod; + this.depletedRod = depletedRod; + } + @Override + public void getIngredients(IIngredients ingredients) { + ingredients.setInput(VanillaTypes.ITEM, rod); + ingredients.setOutput(VanillaTypes.ITEM, depletedRod); + } +} diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 5f74fcf1fd5..b4320c5ceea 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -2421,6 +2421,9 @@ gregtech.recipe.category.arc_furnace_recycling=Arc Furnace Recycling gregtech.recipe.category.macerator_recycling=Macerator Recycling gregtech.recipe.category.extractor_recycling=Extractor Recycling +fission.coolant.name=Coolant Heating +fission.fuel.name=Fission Reactor + behaviour.hoe=Can till dirt behaviour.soft_hammer=Activates and Deactivates Machines behaviour.soft_hammer.enabled=Working Enabled diff --git a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.high_pressure_steam.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.high_pressure_steam.png.mcmeta index 87c542d2956..dd1601946cd 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.high_pressure_steam.png.mcmeta +++ b/src/main/resources/assets/gregtech/textures/blocks/fluids/fluid.high_pressure_steam.png.mcmeta @@ -1,5 +1,45 @@ { "animation":{ - "frametime":1 + "frametime":1, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] } -} \ No newline at end of file +}