More electrolyzer recipes and some beauty for REI

This commit is contained in:
drcrazy 2019-08-04 03:09:49 +03:00
parent b59712bfb4
commit 61e683acc2
9 changed files with 231 additions and 17 deletions

View file

@ -31,14 +31,9 @@ public class IndustrialElectrolyzerRecipes extends RecipeMethods {
/* TODO 1.13 :D
public static void init() {
register(getMaterial("electrolyzedwater", 6, Type.CELL), 760, 120, getMaterial("hydrogen", 4, Type.CELL), getMaterial("compressedair", Type.CELL));
register(getMaterial("water", Type.CELL), 20, 50, getMaterial("electrolyzedwater", Type.CELL));
register(getStack(Items.DYE, 3, 15), 20, 106, false, getMaterial("calcium", Type.CELL));
register(getStack(Items.SUGAR, 32), 200, 32, getMaterial("carbon", 2, Type.CELL), getMaterial("water", 5, Type.CELL));
// TODO: Fix recipe
register(getStack(Blocks.SAND, 16), 1000, 25, getMaterial("silicon", Type.CELL), getMaterial("compressedair", Type.CELL));
// register(getOre("dustClay", 8), 200, 50, getMaterial("lithium", Type.CELL), getMaterial("silicon", 2, Type.CELL), getMaterial("aluminum", 2, Type.DUST), getMaterial("sodium", 2, Type.CELL));
// register(getOre("dustCoal"), 40, 50, getMaterial("carbon", 2, Type.CELL));
// register(getOre("dustCharcoal"), 20, 50, getMaterial("carbon", Type.CELL));
// register(getOre("dustEnderPearl", 16), 1300, 50, getMaterial("nitrogen", 5, Type.CELL), getMaterial("berylium", 1, Type.CELL), getMaterial("potassium", 4, Type.CELL), getMaterial("chlorite", 6, Type.CELL));

View file

@ -24,6 +24,8 @@
package techreborn.rei;
import com.mojang.blaze3d.platform.GlStateManager;
import me.shedaniel.rei.api.DisplaySettings;
import me.shedaniel.rei.api.RecipeCategory;
import me.shedaniel.rei.api.Renderable;
import me.shedaniel.rei.api.Renderer;
@ -31,14 +33,19 @@ import me.shedaniel.rei.gui.renderables.RecipeRenderer;
import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
import me.shedaniel.rei.gui.widget.SlotWidget;
import me.shedaniel.rei.gui.widget.Widget;
import me.shedaniel.rei.plugin.DefaultPlugin;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.GuiLighting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.util.StringUtils;
import java.awt.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@ -47,11 +54,17 @@ import java.util.function.Supplier;
public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCategory<MachineRecipeDisplay<R>> {
private final RebornRecipeType<R> rebornRecipeType;
private int recipeLines;
public MachineRecipeCategory(RebornRecipeType<R> rebornRecipeType) {
this.rebornRecipeType = rebornRecipeType;
MachineRecipeCategory(RebornRecipeType<R> rebornRecipeType) {
this(rebornRecipeType, 2);
}
MachineRecipeCategory(RebornRecipeType<R> rebornRecipeType, int lines) {
this.rebornRecipeType = rebornRecipeType;
this.recipeLines = lines;
}
@Override
public Identifier getIdentifier() {
return rebornRecipeType.getName();
@ -77,9 +90,23 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
MachineRecipeDisplay<R> machineRecipe = recipeDisplaySupplier.get();
Point startPoint = new Point((int) bounds.getCenterX() - 41, (int) bounds.getCenterY() - 27);
List<Widget> widgets = new LinkedList<>();
widgets.add(new RecipeBaseWidget(bounds));
Point startPoint = new Point((int) bounds.getCenterX() - 41, (int) bounds.getCenterY() - recipeLines*12 -1);
class RecipeBackgroundWidget extends RecipeBaseWidget {
RecipeBackgroundWidget(Rectangle bounds) {
super(bounds);
}
public void render(int mouseX, int mouseY, float delta) {
super.render(mouseX, mouseY, delta);
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiLighting.disable();
MinecraftClient.getInstance().getTextureManager().bindTexture(DefaultPlugin.getDisplayTexture());
int width = MathHelper.ceil((double)(System.currentTimeMillis() / 50L) % 24.0D / 1.0D);
this.blit(startPoint.x + 24, startPoint.y + 1, 82, 91, width, 17);
}
}
List<Widget> widgets = new LinkedList(Arrays.asList(new RecipeBackgroundWidget(bounds)));
int i = 0;
for (List<ItemStack> inputs : machineRecipe.getInput()){
@ -93,4 +120,31 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
return widgets;
}
@Override
public DisplaySettings getDisplaySettings() {
return new DisplaySettings<MachineRecipeDisplay>() {
public int getDisplayHeight(RecipeCategory category) {
if (recipeLines == 1) {
return 36;
}
else if (recipeLines == 3) {
return 90;
}
else if (recipeLines == 4) {
return 110;
}
return 66;
}
public int getDisplayWidth(RecipeCategory category, MachineRecipeDisplay display) {
return 150;
}
public int getMaximumRecipePerPage(RecipeCategory category) {
return 99;
}
};
}
}

View file

@ -74,7 +74,21 @@ public class ReiPlugin implements REIPluginEntry {
@Override
public void registerPluginCategories(RecipeHelper recipeHelper) {
RecipeManager.getRecipeTypes("techreborn").forEach(rebornRecipeType -> recipeHelper.registerCategory(new MachineRecipeCategory(rebornRecipeType)));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.ALLOY_SMELTER));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.ASSEMBLING_MACHINE));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.BLAST_FURNACE));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.CENTRIFUGE, 4));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.CHEMICAL_REACTOR));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.COMPRESSOR, 1));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.DISTILLATION_TOWER, 3));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.EXTRACTOR, 1));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.GRINDER, 1));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.IMPLOSION_COMPRESSOR));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.INDUSTRIAL_ELECTROLYZER, 4));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.INDUSTRIAL_GRINDER));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.INDUSTRIAL_SAWMILL, 3));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.SCRAPBOX));
recipeHelper.registerCategory(new MachineRecipeCategory(ModRecipes.VACUUM_FREEZER, 1));
}
@Override

View file

@ -0,0 +1,23 @@
{
"type": "techreborn:industrial_electrolyzer",
"power": 20,
"time": 106,
"ingredients": [
{
"item": "minecraft:bone_meal",
"count": 3
},
{
"item": "techreborn:cell",
"nbt": "null"
}
],
"results": [
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:calcium"
}
}
]
}

View file

@ -0,0 +1,42 @@
{
"type": "techreborn:industrial_electrolyzer",
"power": 32,
"time": 300,
"ingredients": [
{
"item": "techreborn:clay_dust",
"count": 8
},
{
"item": "techreborn:cell",
"count": 5,
"nbt": "null"
}
],
"results": [
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:lithium"
}
},
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:silicon"
},
"count": 2
},
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:sodium"
},
"count": 2
},
{
"item": "techreborn:aluminum_dust",
"count": 2
}
]
}

View file

@ -0,0 +1,29 @@
{
"type": "techreborn:industrial_electrolyzer",
"power": 32,
"time": 120,
"ingredients": [
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:electrolyzedwater"
},
"count": 5
}
],
"results": [
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:hydrogen"
},
"count": 4
},
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:compressedair"
}
}
]
}

View file

@ -15,12 +15,16 @@
],
"results": [
{
"fluid": "techreborn:silicon",
"holder": "techreborn:cell"
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:silicon"
}
},
{
"fluid": "techreborn:compressedair",
"holder": "techreborn:cell"
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:compressedair"
}
}
]
}

View file

@ -0,0 +1,32 @@
{
"type": "techreborn:industrial_electrolyzer",
"power": 32,
"time": 200,
"ingredients": [
{
"item": "minecraft:sugar",
"count": 32
},
{
"item": "techreborn:cell",
"count": 7,
"nbt": "null"
}
],
"results": [
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:carbon"
},
"count": 2
},
{
"item": "techreborn:cell",
"nbt": {
"fluid": "minecraft:water"
},
"count": 5
}
]
}

View file

@ -0,0 +1,21 @@
{
"type": "techreborn:industrial_electrolyzer",
"power": 20,
"time": 50,
"ingredients": [
{
"item": "techreborn:cell",
"nbt": {
"fluid": "minecraft:water"
}
}
],
"results": [
{
"item": "techreborn:cell",
"nbt": {
"fluid": "techreborn:electrolyzedwater"
}
}
]
}