Update to REI 3.0-pre (#1793)
* Update to REI 3.0-pre * Update fabric.mod.json
This commit is contained in:
parent
c03d99f11f
commit
f0b8d99853
7 changed files with 56 additions and 72 deletions
|
@ -93,7 +93,7 @@ dependencies {
|
|||
|
||||
modCompile "io.github.prospector:modmenu:1.7.7+build.116"
|
||||
modCompile "io.github.prospector.silk:SilkAPI:1.2.4-43"
|
||||
modCompile ("me.shedaniel:RoughlyEnoughItems:2.9.7+build.145") {
|
||||
modCompile ("me.shedaniel:RoughlyEnoughItems:3.0-pre+build.1") {
|
||||
//Thanks for moving the project breaking gradle...
|
||||
exclude group: 'io.github.prospector.modmenu', module: 'ModMenu'
|
||||
}
|
||||
|
|
|
@ -25,12 +25,13 @@
|
|||
package techreborn.compat.rei;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import me.shedaniel.rei.api.*;
|
||||
import me.shedaniel.rei.gui.renderables.RecipeRenderer;
|
||||
import me.shedaniel.rei.gui.widget.LabelWidget;
|
||||
import me.shedaniel.rei.gui.widget.RecipeBaseWidget;
|
||||
import me.shedaniel.rei.gui.widget.SlotWidget;
|
||||
import me.shedaniel.rei.gui.widget.Widget;
|
||||
import me.shedaniel.math.api.Point;
|
||||
import me.shedaniel.math.api.Rectangle;
|
||||
import me.shedaniel.rei.api.RecipeCategory;
|
||||
import me.shedaniel.rei.api.Renderer;
|
||||
import me.shedaniel.rei.gui.renderers.RecipeRenderer;
|
||||
import me.shedaniel.rei.gui.widget.*;
|
||||
import me.shedaniel.rei.impl.ScreenHelper;
|
||||
import me.shedaniel.rei.plugin.DefaultPlugin;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.GuiLighting;
|
||||
|
@ -43,7 +44,7 @@ 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.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -75,12 +76,12 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
|
|||
|
||||
@Override
|
||||
public Renderer getIcon() {
|
||||
return Renderable.fromItemStack(new ItemStack(ReiPlugin.iconMap.getOrDefault(rebornRecipeType, () -> Items.DIAMOND_SHOVEL).asItem()));
|
||||
return Renderer.fromItemStack(new ItemStack(ReiPlugin.iconMap.getOrDefault(rebornRecipeType, () -> Items.DIAMOND_SHOVEL).asItem()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeRenderer getSimpleRenderer(MachineRecipeDisplay<R> recipe) {
|
||||
return Renderable.fromRecipe(() -> Collections.singletonList(recipe.getInput().get(0)), recipe::getOutput);
|
||||
return Renderer.fromRecipe(() -> Collections.singletonList(recipe.getInput().get(0)), recipe::getOutput);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,66 +89,43 @@ public class MachineRecipeCategory<R extends RebornRecipe> implements RecipeCate
|
|||
|
||||
MachineRecipeDisplay<R> machineRecipe = recipeDisplaySupplier.get();
|
||||
|
||||
Point startPoint = new Point((int) bounds.getCenterX() - 41, (int) bounds.getCenterY() - recipeLines*12 -1);
|
||||
Point startPoint = new Point( bounds.getCenterX() - 41, 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<>();
|
||||
widgets.add(new RecipeBackgroundWidget(bounds));
|
||||
widgets.add(new RecipeArrowWidget(startPoint.x + 24, startPoint.y + 1, true));
|
||||
|
||||
int i = 0;
|
||||
for (List<ItemStack> inputs : machineRecipe.getInput()){
|
||||
widgets.add(new SlotWidget(startPoint.x + 1, startPoint.y + 1 + (i++ * 20), inputs, true, true, true));
|
||||
widgets.add(new SlotWidget(startPoint.x + 1, startPoint.y + 1 + (i++ * 20), Renderer.fromItemStacks(inputs), true, true, true));
|
||||
}
|
||||
Text energyPerTick = new TranslatableText("techreborn.jei.recipe.running.cost", "E", machineRecipe.getEnergy());
|
||||
widgets.add(new LabelWidget(startPoint.x + 1, startPoint.y + 1 + (i++ * 20), energyPerTick.asFormattedString()));
|
||||
widgets.add(new LabelWidget(startPoint.x + 1, startPoint.y + 1 + (i++ * 20), energyPerTick.asFormattedString()){
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float delta) {
|
||||
font.draw(text, x - font.getStringWidth(text) / 2, y, ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : 0xFF404040);
|
||||
}
|
||||
});
|
||||
|
||||
i = 0;
|
||||
for (ItemStack outputs : machineRecipe.getOutput()){
|
||||
widgets.add(new SlotWidget(startPoint.x + 61, startPoint.y + 1 + (i++ * 20), Collections.singletonList(outputs), true, true, true));
|
||||
widgets.add(new SlotWidget(startPoint.x + 61, startPoint.y + 1 + (i++ * 20), Renderer.fromItemStack(outputs), true, true, true));
|
||||
}
|
||||
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DisplaySettings<MachineRecipeDisplay<R>> getDisplaySettings() {
|
||||
return new DisplaySettings<MachineRecipeDisplay<R>>() {
|
||||
|
||||
public int getDisplayHeight(RecipeCategory category) {
|
||||
@Override
|
||||
public int getDisplayHeight() {
|
||||
if (recipeLines == 1) {
|
||||
return 36;
|
||||
}
|
||||
else if (recipeLines == 3) {
|
||||
return 90;
|
||||
}
|
||||
else if (recipeLines == 4) {
|
||||
return 110;
|
||||
}
|
||||
return 66;
|
||||
}
|
||||
|
||||
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<R> display) {
|
||||
return 150;
|
||||
}
|
||||
|
||||
public int getMaximumRecipePerPage(RecipeCategory category) {
|
||||
return 99;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDisplay<R> {
|
||||
public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDisplay {
|
||||
|
||||
private final R recipe;
|
||||
private List<List<ItemStack>> inputs;
|
||||
|
@ -53,8 +53,8 @@ public class MachineRecipeDisplay<R extends RebornRecipe> implements RecipeDispl
|
|||
}
|
||||
|
||||
@Override
|
||||
public Optional<R> getRecipe() {
|
||||
return Optional.ofNullable(recipe);
|
||||
public Optional<Identifier> getRecipeLocation() {
|
||||
return Optional.ofNullable(recipe).map(RebornRecipe::getId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
|
||||
package techreborn.compat.rei;
|
||||
|
||||
import me.shedaniel.rei.api.REIPluginEntry;
|
||||
import me.shedaniel.rei.api.RecipeDisplay;
|
||||
import me.shedaniel.rei.api.RecipeHelper;
|
||||
import me.shedaniel.rei.api.plugins.REIPluginV0;
|
||||
import net.fabricmc.loader.api.SemanticVersion;
|
||||
import net.fabricmc.loader.util.version.VersionParsingException;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.recipe.Recipe;
|
||||
|
@ -35,19 +37,19 @@ import reborncore.common.crafting.RebornRecipe;
|
|||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.common.crafting.RecipeManager;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.api.recipe.recipes.*;
|
||||
import techreborn.api.recipe.recipes.RollingMachineRecipe;
|
||||
import techreborn.compat.rei.rollingmachine.RollingMachineCategory;
|
||||
import techreborn.compat.rei.rollingmachine.RollingMachineDisplay;
|
||||
import techreborn.init.ModRecipes;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRContent.Machine;
|
||||
import techreborn.compat.rei.rollingmachine.RollingMachineCategory;
|
||||
import techreborn.compat.rei.rollingmachine.RollingMachineDisplay;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class ReiPlugin implements REIPluginEntry {
|
||||
public class ReiPlugin implements REIPluginV0 {
|
||||
|
||||
public static final Identifier PLUGIN = new Identifier(TechReborn.MOD_ID, "techreborn_plugin");
|
||||
|
||||
|
@ -55,7 +57,7 @@ public class ReiPlugin implements REIPluginEntry {
|
|||
|
||||
public ReiPlugin() {
|
||||
iconMap.put(ModRecipes.ALLOY_SMELTER, Machine.ALLOY_SMELTER);
|
||||
iconMap.put(ModRecipes.ASSEMBLING_MACHINE,Machine.ASSEMBLY_MACHINE);
|
||||
iconMap.put(ModRecipes.ASSEMBLING_MACHINE, Machine.ASSEMBLY_MACHINE);
|
||||
iconMap.put(ModRecipes.BLAST_FURNACE, Machine.INDUSTRIAL_BLAST_FURNACE);
|
||||
iconMap.put(ModRecipes.CENTRIFUGE, Machine.INDUSTRIAL_CENTRIFUGE);
|
||||
iconMap.put(ModRecipes.CHEMICAL_REACTOR, Machine.CHEMICAL_REACTOR);
|
||||
|
@ -72,7 +74,7 @@ public class ReiPlugin implements REIPluginEntry {
|
|||
iconMap.put(ModRecipes.ROLLING_MACHINE, Machine.ROLLING_MACHINE);
|
||||
iconMap.put(ModRecipes.SCRAPBOX, TRContent.SCRAP_BOX);
|
||||
iconMap.put(ModRecipes.VACUUM_FREEZER, Machine.VACUUM_FREEZER);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,6 +82,11 @@ public class ReiPlugin implements REIPluginEntry {
|
|||
return PLUGIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SemanticVersion getMinimumVersion() throws VersionParsingException {
|
||||
return SemanticVersion.parse("3.0-pre");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPluginCategories(RecipeHelper recipeHelper) {
|
||||
recipeHelper.registerCategory(new MachineRecipeCategory<>(ModRecipes.ALLOY_SMELTER));
|
||||
|
|
|
@ -24,9 +24,8 @@
|
|||
|
||||
package techreborn.compat.rei.rollingmachine;
|
||||
|
||||
import me.shedaniel.rei.api.Renderable;
|
||||
import me.shedaniel.rei.api.Renderer;
|
||||
import me.shedaniel.rei.plugin.DefaultCraftingCategory;
|
||||
import me.shedaniel.rei.plugin.crafting.DefaultCraftingCategory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -55,7 +54,7 @@ public class RollingMachineCategory extends DefaultCraftingCategory {
|
|||
|
||||
@Override
|
||||
public Renderer getIcon() {
|
||||
return Renderable.fromItemStack(new ItemStack(ReiPlugin.iconMap.getOrDefault(rebornRecipeType, () -> Items.DIAMOND_SHOVEL).asItem()));
|
||||
return Renderer.fromItemStack(new ItemStack(ReiPlugin.iconMap.getOrDefault(rebornRecipeType, () -> Items.DIAMOND_SHOVEL).asItem()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package techreborn.compat.rei.rollingmachine;
|
||||
|
||||
import me.shedaniel.rei.plugin.DefaultShapedDisplay;
|
||||
import me.shedaniel.rei.plugin.crafting.DefaultShapedDisplay;
|
||||
import net.minecraft.recipe.ShapedRecipe;
|
||||
import net.minecraft.util.Identifier;
|
||||
import techreborn.init.ModRecipes;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"client": [
|
||||
"techreborn.TechRebornClient"
|
||||
],
|
||||
"rei_plugins": [
|
||||
"rei_plugins_v0": [
|
||||
"techreborn.compat.rei.ReiPlugin"
|
||||
],
|
||||
"towelette": [
|
||||
|
@ -55,4 +55,4 @@
|
|||
"coderbot",
|
||||
"estebes"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue