forked from TheBrokenRail/EnergonRelics
57 lines
2.6 KiB
Java
57 lines
2.6 KiB
Java
|
package com.thebrokenrail.energonrelics.client.rei;
|
||
|
|
||
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
||
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
||
|
import me.shedaniel.math.Point;
|
||
|
import me.shedaniel.math.Rectangle;
|
||
|
import me.shedaniel.rei.api.EntryStack;
|
||
|
import me.shedaniel.rei.api.RecipeCategory;
|
||
|
import me.shedaniel.rei.api.widgets.Widgets;
|
||
|
import me.shedaniel.rei.gui.widget.Widget;
|
||
|
import net.fabricmc.api.EnvType;
|
||
|
import net.fabricmc.api.Environment;
|
||
|
import net.minecraft.client.resource.language.I18n;
|
||
|
import net.minecraft.text.TranslatableText;
|
||
|
import net.minecraft.util.Identifier;
|
||
|
|
||
|
import java.text.DecimalFormat;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
@Environment(EnvType.CLIENT)
|
||
|
public class InfuserCategory implements RecipeCategory<InfuserDisplay> {
|
||
|
@Override
|
||
|
public List<Widget> setupDisplay(InfuserDisplay display, Rectangle bounds) {
|
||
|
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
|
||
|
List<Widget> widgets = new ArrayList<>();
|
||
|
widgets.add(Widgets.createRecipeBase(bounds));
|
||
|
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 18)));
|
||
|
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.chance", new DecimalFormat("###.##").format(display.successChance * 100d))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||
|
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 14), new TranslatableText("category.rei." + EnergonRelics.NAMESPACE + ".infuser.cost", display.cost)).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||
|
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 17)).animationDurationTicks(HardcodedConfig.INFUSER_TIME));
|
||
|
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 18)).entries(display.getInputEntries().get(0)).markInput());
|
||
|
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 18)).entries(display.getOutputEntries()).disableBackground().markOutput());
|
||
|
return widgets;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getDisplayHeight() {
|
||
|
return 58;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Identifier getIdentifier() {
|
||
|
return EnergonRelicsPlugin.INFUSER;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public EntryStack getLogo() {
|
||
|
return EntryStack.create(EnergonRelics.INFUSER_BLOCK);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String getCategoryName() {
|
||
|
return I18n.translate("category.rei." + EnergonRelics.NAMESPACE + ".infuser.name");
|
||
|
}
|
||
|
}
|