Continue mapping migration
This commit is contained in:
parent
99ade39404
commit
f03fd03bd0
499 changed files with 12567 additions and 12723 deletions
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
|
@ -16,9 +16,8 @@ import me.shedaniel.rei.api.widgets.Widgets;
|
|||
import me.shedaniel.rei.gui.entries.RecipeEntry;
|
||||
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
|
||||
import me.shedaniel.rei.gui.widget.Widget;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
@ -33,14 +32,14 @@ public class REIAlloyingCategory implements TransferRecipeCategory<REIAlloyingDi
|
|||
|
||||
@Override
|
||||
public @NotNull String getCategoryName() {
|
||||
return LangUtil.translate(EndBlocks.END_STONE_SMELTER.getTranslationKey());
|
||||
return LangUtil.translate(EndBlocks.END_STONE_SMELTER.getDescriptionId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull EntryStack getLogo() {
|
||||
return REIPlugin.END_STONE_SMELTER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
|
||||
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
|
||||
|
@ -49,49 +48,39 @@ public class REIAlloyingCategory implements TransferRecipeCategory<REIAlloyingDi
|
|||
List<Widget> widgets = Lists.newArrayList();
|
||||
widgets.add(Widgets.createRecipeBase(bounds));
|
||||
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
|
||||
widgets.add(
|
||||
Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20)).animationDurationMS(10000));
|
||||
widgets.add(Widgets
|
||||
.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), new TranslatableText(
|
||||
"category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D)))
|
||||
.noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||||
widgets.add(
|
||||
Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
|
||||
widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20)).animationDurationMS(10000));
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5),
|
||||
new TranslatableComponent("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||||
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
|
||||
List<List<EntryStack>> inputEntries = display.getInputEntries();
|
||||
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0))
|
||||
.markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0)).markInput());
|
||||
if (inputEntries.size() > 1) {
|
||||
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(inputEntries.get(1))
|
||||
.markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(inputEntries.get(1)).markInput());
|
||||
} else {
|
||||
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(Lists.newArrayList())
|
||||
.markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(Lists.newArrayList()).markInput());
|
||||
}
|
||||
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9))
|
||||
.entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display,
|
||||
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display,
|
||||
IntList redSlots) {
|
||||
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
|
||||
matrices.push();
|
||||
matrices.pushPose();
|
||||
matrices.translate(0, 0, 400);
|
||||
if (redSlots.contains(0)) {
|
||||
DrawableHelper.fill(matrices, startPoint.x - 20, startPoint.y + 1, startPoint.x - 20 + 16,
|
||||
startPoint.y + 1 + 16, 1090453504);
|
||||
DrawableHelper.fill(matrices, startPoint.x + 1, startPoint.y + 1, startPoint.x + 1 + 16,
|
||||
startPoint.y + 1 + 16, 1090453504);
|
||||
GuiComponent.fill(matrices, startPoint.x - 20, startPoint.y + 1, startPoint.x - 20 + 16, startPoint.y + 1 + 16, 1090453504);
|
||||
GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 1, startPoint.x + 1 + 16, startPoint.y + 1 + 16, 1090453504);
|
||||
}
|
||||
matrices.pop();
|
||||
matrices.popPose();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull RecipeEntry getSimpleRenderer(REIAlloyingDisplay recipe) {
|
||||
return SimpleRecipeEntry.from(recipe.getInputEntries(), recipe.getResultingEntries());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getDisplayHeight() {
|
||||
return 49;
|
||||
|
|
|
@ -10,56 +10,56 @@ import org.jetbrains.annotations.NotNull;
|
|||
import me.shedaniel.rei.api.EntryStack;
|
||||
import me.shedaniel.rei.api.TransferRecipeDisplay;
|
||||
import me.shedaniel.rei.server.ContainerInfo;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.crafting.BlastingRecipe;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
|
||||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||
|
||||
public class REIAlloyingDisplay implements TransferRecipeDisplay {
|
||||
|
||||
private static List<EntryStack> fuel;
|
||||
|
||||
|
||||
private Recipe<?> recipe;
|
||||
private List<List<EntryStack>> input;
|
||||
private List<EntryStack> output;
|
||||
private float xp;
|
||||
private double smeltTime;
|
||||
|
||||
|
||||
public REIAlloyingDisplay(AlloyingRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
this.input = EntryStack.ofIngredients(recipe.getPreviewInputs());
|
||||
this.output = Collections.singletonList(EntryStack.create(recipe.getOutput()));
|
||||
this.input = EntryStack.ofIngredients(recipe.getIngredients());
|
||||
this.output = Collections.singletonList(EntryStack.create(recipe.getResultItem()));
|
||||
this.xp = recipe.getExperience();
|
||||
this.smeltTime = recipe.getSmeltTime();
|
||||
}
|
||||
|
||||
|
||||
public REIAlloyingDisplay(BlastingRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
this.input = EntryStack.ofIngredients(recipe.getPreviewInputs());
|
||||
this.output = Collections.singletonList(EntryStack.create(recipe.getOutput()));
|
||||
this.input = EntryStack.ofIngredients(recipe.getIngredients());
|
||||
this.output = Collections.singletonList(EntryStack.create(recipe.getResultItem()));
|
||||
this.xp = recipe.getExperience();
|
||||
this.smeltTime = recipe.getCookTime();
|
||||
this.smeltTime = recipe.getCookingTime();
|
||||
}
|
||||
|
||||
|
||||
public static List<EntryStack> getFuel() {
|
||||
return fuel;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull Optional<ResourceLocation> getRecipeLocation() {
|
||||
return Optional.ofNullable(recipe).map(Recipe::getId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<EntryStack>> getInputEntries() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<EntryStack>> getResultingEntries() {
|
||||
return Collections.singletonList(output);
|
||||
|
@ -69,20 +69,20 @@ public class REIAlloyingDisplay implements TransferRecipeDisplay {
|
|||
public @NotNull ResourceLocation getRecipeCategory() {
|
||||
return AlloyingRecipe.ID;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<EntryStack>> getRequiredEntries() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
|
||||
public float getXp() {
|
||||
return this.xp;
|
||||
}
|
||||
|
||||
|
||||
public double getSmeltTime() {
|
||||
return this.smeltTime;
|
||||
}
|
||||
|
||||
|
||||
public Optional<Recipe<?>> getOptionalRecipe() {
|
||||
return Optional.ofNullable(recipe);
|
||||
}
|
||||
|
@ -98,17 +98,14 @@ public class REIAlloyingDisplay implements TransferRecipeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<ScreenHandler> containerInfo,
|
||||
ScreenHandler container) {
|
||||
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
fuel = EndStoneSmelterBlockEntity.availableFuels().keySet().stream().map(Item::getDefaultStack)
|
||||
.map(EntryStack::create)
|
||||
.map(e -> e.setting(EntryStack.Properties.TOOLTIP_APPEND_EXTRA,
|
||||
stack -> Collections.singletonList(
|
||||
new TranslatableText("category.rei.smelting.fuel").formatted(Formatting.YELLOW))))
|
||||
.collect(Collectors.toList());
|
||||
fuel = EndStoneSmelterBlockEntity.availableFuels().keySet().stream()
|
||||
.map(Item::getDefaultInstance).map(EntryStack::create)
|
||||
.map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableComponent("category.rei.smelting.fuel")
|
||||
.withStyle(ChatFormatting.YELLOW)))).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.EntryStack;
|
||||
|
@ -18,11 +18,10 @@ import me.shedaniel.rei.api.widgets.Widgets;
|
|||
import me.shedaniel.rei.gui.entries.RecipeEntry;
|
||||
import me.shedaniel.rei.gui.widget.Widget;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
public class REIAlloyingFuelCategory implements RecipeCategory<REIAlloyingFuelDisplay> {
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
|
||||
|
@ -34,7 +33,7 @@ public class REIAlloyingFuelCategory implements RecipeCategory<REIAlloyingFuelDi
|
|||
|
||||
@Override
|
||||
public @NotNull String getCategoryName() {
|
||||
return I18n.translate("category.rei.fuel");
|
||||
return I18n.get("category.rei.fuel");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,24 +52,19 @@ public class REIAlloyingFuelCategory implements RecipeCategory<REIAlloyingFuelDi
|
|||
String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime());
|
||||
List<Widget> widgets = Lists.newArrayList();
|
||||
widgets.add(Widgets.createRecipeBase(bounds));
|
||||
widgets.add(Widgets
|
||||
.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 15),
|
||||
new TranslatableText("category.rei.fuel.time", burnTime))
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 15), new TranslatableComponent("category.rei.fuel.time", burnTime))
|
||||
.color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
|
||||
widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1))
|
||||
.animationDurationTicks(recipeDisplay.getFuelTime()));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18))
|
||||
.entries(recipeDisplay.getInputEntries().get(0)).markInput());
|
||||
widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1)).animationDurationTicks(recipeDisplay.getFuelTime()));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18)).entries(recipeDisplay.getInputEntries().get(0)).markInput());
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull RecipeEntry getSimpleRenderer(REIAlloyingFuelDisplay recipe) {
|
||||
Slot slot = Widgets.createSlot(new Point(0, 0)).entries(recipe.getInputEntries().get(0)).disableBackground()
|
||||
.disableHighlight();
|
||||
Slot slot = Widgets.createSlot(new Point(0, 0)).entries(recipe.getInputEntries().get(0)).disableBackground().disableHighlight();
|
||||
String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d);
|
||||
return new RecipeEntry() {
|
||||
private TranslatableText text = new TranslatableText("category.rei.fuel.time_short.items", burnItems);
|
||||
private TranslatableComponent text = new TranslatableComponent("category.rei.fuel.time_short.items", burnItems);
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
|
@ -86,12 +80,11 @@ public class REIAlloyingFuelCategory implements RecipeCategory<REIAlloyingFuelDi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
|
||||
public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
|
||||
slot.setZ(getZ() + 50);
|
||||
slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2);
|
||||
slot.render(matrices, mouseX, mouseY, delta);
|
||||
Minecraft.getInstance().textRenderer.drawWithShadow(matrices, text.asOrderedText(), bounds.x + 25,
|
||||
bounds.y + 8, -1);
|
||||
Minecraft.getInstance().font.drawShadow(matrices, text.getVisualOrderText(), bounds.x + 25, bounds.y + 8, -1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.stream.Collectors;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
|
@ -18,13 +18,12 @@ import me.shedaniel.rei.api.widgets.Widgets;
|
|||
import me.shedaniel.rei.gui.entries.RecipeEntry;
|
||||
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
|
||||
import me.shedaniel.rei.gui.widget.Widget;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.blocks.basis.EndAnvilBlock;
|
||||
import ru.betterend.util.LangUtil;
|
||||
|
||||
|
@ -37,14 +36,14 @@ public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay>
|
|||
|
||||
@Override
|
||||
public @NotNull String getCategoryName() {
|
||||
return LangUtil.translate(Blocks.ANVIL.getTranslationKey());
|
||||
return LangUtil.translate(Blocks.ANVIL.getDescriptionId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull EntryStack getLogo() {
|
||||
return REIPlugin.ANVILS[0];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
|
||||
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
|
||||
|
@ -65,40 +64,34 @@ public class REIAnvilCategory implements TransferRecipeCategory<REIAnvilDisplay>
|
|||
}).collect(Collectors.toList());
|
||||
materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount()));
|
||||
widgets.add(Widgets.createArrow(new Point(x + 24, y + 4)));
|
||||
widgets.add(Widgets
|
||||
.createLabel(new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15),
|
||||
new TranslatableText("category.rei.damage.amount&dmg", display.getDamage()))
|
||||
.noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15),
|
||||
new TranslatableComponent("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||||
widgets.add(Widgets.createSlot(new Point(x - 20, y + 4)).entries(materials).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(x + 1, y + 4)).entries(inputEntries.get(0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(x + 61, y + 5)).entries(display.getResultingEntries().get(0))
|
||||
.disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(x + 61, y + 5)).entries(display.getResultingEntries().get(0)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(x - 9, y + 25)).entries(anvils));
|
||||
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
|
||||
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
|
||||
IntList redSlots) {
|
||||
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
|
||||
matrices.push();
|
||||
matrices.pushPose();
|
||||
matrices.translate(0, 0, 400);
|
||||
if (redSlots.contains(0)) {
|
||||
DrawableHelper.fill(matrices, startPoint.x - 20, startPoint.y + 3, startPoint.x - 20 + 16,
|
||||
startPoint.y + 3 + 16, 1090453504);
|
||||
DrawableHelper.fill(matrices, startPoint.x + 1, startPoint.y + 3, startPoint.x + 1 + 16,
|
||||
startPoint.y + 3 + 16, 1090453504);
|
||||
GuiComponent.fill(matrices, startPoint.x - 20, startPoint.y + 3, startPoint.x - 20 + 16, startPoint.y + 3 + 16, 1090453504);
|
||||
GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 3, startPoint.x + 1 + 16, startPoint.y + 3 + 16, 1090453504);
|
||||
}
|
||||
matrices.pop();
|
||||
matrices.popPose();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull RecipeEntry getSimpleRenderer(REIAnvilDisplay recipe) {
|
||||
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)),
|
||||
recipe.getResultingEntries());
|
||||
return SimpleRecipeEntry.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getResultingEntries());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getDisplayHeight() {
|
||||
return 60;
|
||||
|
|
|
@ -9,23 +9,23 @@ import org.jetbrains.annotations.NotNull;
|
|||
import me.shedaniel.rei.api.EntryStack;
|
||||
import me.shedaniel.rei.api.TransferRecipeDisplay;
|
||||
import me.shedaniel.rei.server.ContainerInfo;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import ru.betterend.recipe.builders.AnvilRecipe;
|
||||
|
||||
public class REIAnvilDisplay implements TransferRecipeDisplay {
|
||||
|
||||
|
||||
private final AnvilRecipe recipe;
|
||||
private final List<List<EntryStack>> input;
|
||||
private final List<EntryStack> output;
|
||||
|
||||
|
||||
public REIAnvilDisplay(AnvilRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
this.input = EntryStack.ofIngredients(recipe.getPreviewInputs());
|
||||
this.output = Collections.singletonList(EntryStack.create(recipe.getOutput()));
|
||||
this.input = EntryStack.ofIngredients(recipe.getIngredients());
|
||||
this.output = Collections.singletonList(EntryStack.create(recipe.getResultItem()));
|
||||
}
|
||||
|
||||
|
||||
public int getDamage() {
|
||||
return recipe.getDamage();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class REIAnvilDisplay implements TransferRecipeDisplay {
|
|||
public int getAnvilLevel() {
|
||||
return recipe.getAnvilLevel();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull Optional<ResourceLocation> getRecipeLocation() {
|
||||
return Optional.ofNullable(recipe).map(Recipe::getId);
|
||||
|
@ -47,7 +47,7 @@ public class REIAnvilDisplay implements TransferRecipeDisplay {
|
|||
public @NotNull List<List<EntryStack>> getInputEntries() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<EntryStack>> getResultingEntries() {
|
||||
return Collections.singletonList(output);
|
||||
|
@ -57,7 +57,7 @@ public class REIAnvilDisplay implements TransferRecipeDisplay {
|
|||
public @NotNull ResourceLocation getRecipeCategory() {
|
||||
return REIPlugin.SMITHING;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<EntryStack>> getRequiredEntries() {
|
||||
return input;
|
||||
|
@ -74,8 +74,8 @@ public class REIAnvilDisplay implements TransferRecipeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<ScreenHandler> containerInfo,
|
||||
ScreenHandler container) {
|
||||
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo,
|
||||
AbstractContainerMenu container) {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
|
@ -15,8 +15,7 @@ import me.shedaniel.rei.api.widgets.Widgets;
|
|||
import me.shedaniel.rei.gui.entries.RecipeEntry;
|
||||
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
|
||||
import me.shedaniel.rei.gui.widget.Widget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.recipe.builders.InfusionRecipe;
|
||||
|
@ -24,7 +23,7 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.util.LangUtil;
|
||||
|
||||
public class REIInfusionCategory implements TransferRecipeCategory<REIInfusionDisplay> {
|
||||
|
||||
|
||||
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
|
||||
|
||||
@Override
|
||||
|
@ -34,19 +33,19 @@ public class REIInfusionCategory implements TransferRecipeCategory<REIInfusionDi
|
|||
|
||||
@Override
|
||||
public @NotNull String getCategoryName() {
|
||||
return LangUtil.translate(EndBlocks.INFUSION_PEDESTAL.getTranslationKey());
|
||||
return LangUtil.translate(EndBlocks.INFUSION_PEDESTAL.getDescriptionId());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull EntryStack getLogo() {
|
||||
return REIPlugin.INFUSION_RITUAL;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull RecipeEntry getSimpleRenderer(REIInfusionDisplay recipe) {
|
||||
return SimpleRecipeEntry.from(recipe.getInputEntries(), recipe.getResultingEntries());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) {
|
||||
Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2);
|
||||
|
@ -56,36 +55,24 @@ public class REIInfusionCategory implements TransferRecipeCategory<REIInfusionDi
|
|||
List<List<EntryStack>> outputEntries = display.getResultingEntries();
|
||||
widgets.add(Widgets.createTexturedWidget(BACKGROUND, bounds.x, bounds.y, 0, 0, 150, 104, 150, 104));
|
||||
widgets.add(Widgets.createSlot(centerPoint).entries(inputEntries.get(0)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1))
|
||||
.disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y)).entries(inputEntries.get(3))
|
||||
.disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28)).entries(inputEntries.get(5))
|
||||
.disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y)).entries(inputEntries.get(7))
|
||||
.disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24)).entries(inputEntries.get(2))
|
||||
.disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24)).entries(inputEntries.get(4))
|
||||
.disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6))
|
||||
.disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8))
|
||||
.disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0))
|
||||
.disableBackground().markOutput());
|
||||
widgets.add(Widgets
|
||||
.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 6),
|
||||
new TranslatableText("category.rei.infusion.time&val", display.getInfusionTime()))
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y)).entries(inputEntries.get(3)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28)).entries(inputEntries.get(5)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y)).entries(inputEntries.get(7)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24)).entries(inputEntries.get(2)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24)).entries(inputEntries.get(4)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8)).disableBackground().markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 6), new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime()))
|
||||
.noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRedSlots(MatrixStack matrices, List<Widget> widgets, Rectangle bounds, REIInfusionDisplay display,
|
||||
IntList redSlots) {
|
||||
}
|
||||
|
||||
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds,
|
||||
REIInfusionDisplay display, IntList redSlots) {}
|
||||
|
||||
@Override
|
||||
public int getDisplayHeight() {
|
||||
return 104;
|
||||
|
|
|
@ -11,34 +11,34 @@ import com.google.common.collect.Lists;
|
|||
import me.shedaniel.rei.api.EntryStack;
|
||||
import me.shedaniel.rei.api.TransferRecipeDisplay;
|
||||
import me.shedaniel.rei.server.ContainerInfo;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||
import ru.betterend.recipe.builders.InfusionRecipe;
|
||||
|
||||
public class REIInfusionDisplay implements TransferRecipeDisplay {
|
||||
|
||||
|
||||
private final InfusionRecipe recipe;
|
||||
private final List<List<EntryStack>> input;
|
||||
private final List<EntryStack> output;
|
||||
private final int time;
|
||||
|
||||
|
||||
public REIInfusionDisplay(InfusionRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
this.input = Lists.newArrayList();
|
||||
this.output = Collections.singletonList(EntryStack.create(recipe.getOutput()));
|
||||
this.output = Collections.singletonList(EntryStack.create(recipe.getResultItem()));
|
||||
this.time = recipe.getInfusionTime();
|
||||
|
||||
recipe.getPreviewInputs().forEach(ingredient -> {
|
||||
|
||||
recipe.getIngredients().forEach(ingredient -> {
|
||||
input.add(EntryStack.ofIngredient(ingredient));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public int getInfusionTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull Optional<ResourceLocation> getRecipeLocation() {
|
||||
return Optional.ofNullable(recipe).map(Recipe::getId);
|
||||
|
@ -48,7 +48,7 @@ public class REIInfusionDisplay implements TransferRecipeDisplay {
|
|||
public @NotNull List<List<EntryStack>> getInputEntries() {
|
||||
return this.input;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<EntryStack>> getResultingEntries() {
|
||||
return Collections.singletonList(output);
|
||||
|
@ -58,7 +58,7 @@ public class REIInfusionDisplay implements TransferRecipeDisplay {
|
|||
public @NotNull ResourceLocation getRecipeCategory() {
|
||||
return AlloyingRecipe.ID;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<EntryStack>> getRequiredEntries() {
|
||||
return this.input;
|
||||
|
@ -75,8 +75,7 @@ public class REIInfusionDisplay implements TransferRecipeDisplay {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<ScreenHandler> containerInfo,
|
||||
ScreenHandler container) {
|
||||
public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) {
|
||||
return this.input;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ import me.shedaniel.rei.plugin.DefaultPlugin;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.crafting.BlastingRecipe;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.blocks.basis.EndAnvilBlock;
|
||||
import ru.betterend.blocks.basis.EndFurnaceBlock;
|
||||
|
@ -43,9 +43,9 @@ public class REIPlugin implements REIPluginV0 {
|
|||
public ResourceLocation getPluginIdentifier() {
|
||||
return PLUGIN_ID;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerRecipeDisplays(RecipeHelper recipeHelper) {
|
||||
public void registerRecipeDisplays(RecipeHelper recipeHelper) {
|
||||
recipeHelper.registerRecipes(ALLOYING, AlloyingRecipe.class, REIAlloyingDisplay::new);
|
||||
recipeHelper.registerRecipes(ALLOYING, BlastingRecipe.class, REIAlloyingDisplay::new);
|
||||
recipeHelper.registerRecipes(SMITHING, AnvilRecipe.class, REIAnvilDisplay::new);
|
||||
|
@ -56,7 +56,7 @@ public class REIPlugin implements REIPluginV0 {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerOthers(RecipeHelper recipeHelper) {
|
||||
recipeHelper.registerWorkingStations(ALLOYING_FUEL, END_STONE_SMELTER);
|
||||
|
@ -68,12 +68,15 @@ public class REIPlugin implements REIPluginV0 {
|
|||
|
||||
recipeHelper.registerWorkingStations(DefaultPlugin.SMELTING, FURNACES);
|
||||
recipeHelper.registerWorkingStations(DefaultPlugin.FUEL, FURNACES);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPluginCategories(RecipeHelper recipeHelper) {
|
||||
recipeHelper.registerCategories(new REIAlloyingFuelCategory(), new REIAlloyingCategory(),
|
||||
new REIInfusionCategory(), new REIAnvilCategory());
|
||||
recipeHelper.registerCategories(
|
||||
new REIAlloyingFuelCategory(),
|
||||
new REIAlloyingCategory(),
|
||||
new REIInfusionCategory(),
|
||||
new REIAnvilCategory());
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue