Revert buildscript changes, will bring back once 0.13 loom is ready.
This commit is contained in:
parent
63eaf354d9
commit
f3177b691a
22 changed files with 7 additions and 7 deletions
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei;
|
||||
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.display.Display;
|
||||
import me.shedaniel.rei.api.common.entry.EntryIngredient;
|
||||
import me.shedaniel.rei.api.common.util.CollectionUtils;
|
||||
import me.shedaniel.rei.api.common.util.EntryIngredients;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.crafting.RebornFluidRecipe;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import techreborn.api.recipe.recipes.BlastFurnaceRecipe;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MachineRecipeDisplay<R extends RebornRecipe> implements Display {
|
||||
|
||||
private final R recipe;
|
||||
private final List<EntryIngredient> inputs;
|
||||
private final List<EntryIngredient> outputs;
|
||||
private final int energy;
|
||||
private int heat = 0;
|
||||
private final int time;
|
||||
private FluidInstance fluidInstance = null;
|
||||
|
||||
public MachineRecipeDisplay(R recipe) {
|
||||
this.recipe = recipe;
|
||||
this.inputs = CollectionUtils.map(recipe.getRebornIngredients(), ing -> EntryIngredients.ofItemStacks(ing.getPreviewStacks()));
|
||||
this.outputs = recipe.getOutputs().stream().map(EntryIngredients::of).collect(Collectors.toList());
|
||||
this.time = recipe.getTime();
|
||||
this.energy = recipe.getPower();
|
||||
if (recipe instanceof BlastFurnaceRecipe) {
|
||||
this.heat = ((BlastFurnaceRecipe) recipe).getHeat();
|
||||
}
|
||||
if (recipe instanceof RebornFluidRecipe) {
|
||||
this.fluidInstance = ((RebornFluidRecipe) recipe).getFluidInstance();
|
||||
inputs.add(EntryIngredients.of(fluidInstance.getFluid(), fluidInstance.getAmount().getRawValue()));
|
||||
}
|
||||
}
|
||||
|
||||
public int getEnergy() {
|
||||
return energy;
|
||||
}
|
||||
|
||||
public int getHeat() {
|
||||
return heat;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public FluidInstance getFluidInstance() {
|
||||
return fluidInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Identifier> getDisplayLocation() {
|
||||
return Optional.ofNullable(recipe).map(RebornRecipe::getId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntryIngredient> getInputEntries() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntryIngredient> getOutputEntries() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryIdentifier<?> getCategoryIdentifier() {
|
||||
return CategoryIdentifier.of(recipe.getRebornRecipeType().name());
|
||||
}
|
||||
}
|
427
src/client/java/techreborn/client/compat/rei/ReiPlugin.java
Normal file
427
src/client/java/techreborn/client/compat/rei/ReiPlugin.java
Normal file
|
@ -0,0 +1,427 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import dev.architectury.event.CompoundEventResult;
|
||||
import dev.architectury.fluid.FluidStack;
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.entry.renderer.AbstractEntryRenderer;
|
||||
import me.shedaniel.rei.api.client.entry.renderer.EntryRenderer;
|
||||
import me.shedaniel.rei.api.client.gui.AbstractRenderer;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.TooltipContext;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
|
||||
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
|
||||
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
|
||||
import me.shedaniel.rei.api.client.registry.screen.ExclusionZones;
|
||||
import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry;
|
||||
import me.shedaniel.rei.api.client.util.ClientEntryStacks;
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.display.Display;
|
||||
import me.shedaniel.rei.api.common.entry.EntryStack;
|
||||
import me.shedaniel.rei.api.common.entry.comparison.ItemComparatorRegistry;
|
||||
import me.shedaniel.rei.api.common.fluid.FluidSupportProvider;
|
||||
import me.shedaniel.rei.api.common.util.EntryStacks;
|
||||
import me.shedaniel.rei.impl.client.gui.widget.EntryWidget;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandler;
|
||||
import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.ItemConvertible;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import reborncore.api.blockentity.IUpgradeable;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.gui.builder.slot.GuiTab;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import reborncore.common.crafting.RecipeManager;
|
||||
import reborncore.common.fluid.container.ItemFluidInfo;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.api.generator.EFluidGenerator;
|
||||
import techreborn.api.generator.GeneratorRecipeHelper;
|
||||
import techreborn.api.recipe.recipes.FluidReplicatorRecipe;
|
||||
import techreborn.api.recipe.recipes.RollingMachineRecipe;
|
||||
import techreborn.client.compat.rei.fluidgenerator.FluidGeneratorRecipeCategory;
|
||||
import techreborn.client.compat.rei.fluidgenerator.FluidGeneratorRecipeDisplay;
|
||||
import techreborn.client.compat.rei.fluidreplicator.FluidReplicatorRecipeCategory;
|
||||
import techreborn.client.compat.rei.fluidreplicator.FluidReplicatorRecipeDisplay;
|
||||
import techreborn.client.compat.rei.machine.*;
|
||||
import techreborn.client.compat.rei.rollingmachine.RollingMachineCategory;
|
||||
import techreborn.client.compat.rei.rollingmachine.RollingMachineDisplay;
|
||||
import techreborn.init.ModRecipes;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.init.TRContent.Machine;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ReiPlugin implements REIClientPlugin {
|
||||
public static final Map<RebornRecipeType<?>, ItemConvertible> iconMap = new HashMap<>();
|
||||
|
||||
public ReiPlugin() {
|
||||
iconMap.put(ModRecipes.ALLOY_SMELTER, Machine.ALLOY_SMELTER);
|
||||
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);
|
||||
iconMap.put(ModRecipes.COMPRESSOR, Machine.COMPRESSOR);
|
||||
iconMap.put(ModRecipes.DISTILLATION_TOWER, Machine.DISTILLATION_TOWER);
|
||||
iconMap.put(ModRecipes.EXTRACTOR, Machine.EXTRACTOR);
|
||||
iconMap.put(ModRecipes.FLUID_REPLICATOR, Machine.FLUID_REPLICATOR);
|
||||
iconMap.put(ModRecipes.FUSION_REACTOR, Machine.FUSION_CONTROL_COMPUTER);
|
||||
iconMap.put(ModRecipes.GRINDER, Machine.GRINDER);
|
||||
iconMap.put(ModRecipes.IMPLOSION_COMPRESSOR, Machine.IMPLOSION_COMPRESSOR);
|
||||
iconMap.put(ModRecipes.INDUSTRIAL_ELECTROLYZER, Machine.INDUSTRIAL_ELECTROLYZER);
|
||||
iconMap.put(ModRecipes.INDUSTRIAL_GRINDER, Machine.INDUSTRIAL_GRINDER);
|
||||
iconMap.put(ModRecipes.INDUSTRIAL_SAWMILL, Machine.INDUSTRIAL_SAWMILL);
|
||||
iconMap.put(ModRecipes.ROLLING_MACHINE, Machine.ROLLING_MACHINE);
|
||||
iconMap.put(ModRecipes.SCRAPBOX, TRContent.SCRAP_BOX);
|
||||
iconMap.put(ModRecipes.SOLID_CANNING_MACHINE, Machine.SOLID_CANNING_MACHINE);
|
||||
iconMap.put(ModRecipes.VACUUM_FREEZER, Machine.VACUUM_FREEZER);
|
||||
iconMap.put(ModRecipes.WIRE_MILL, Machine.WIRE_MILL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCategories(CategoryRegistry registry) {
|
||||
registry.add(new TwoInputsCenterOutputCategory<>(ModRecipes.ALLOY_SMELTER));
|
||||
registry.add(new AssemblingMachineCategory<>(ModRecipes.ASSEMBLING_MACHINE));
|
||||
registry.add(new BlastFurnaceCategory<>(ModRecipes.BLAST_FURNACE));
|
||||
registry.add(new IndustrialCentrifugeCategory<>(ModRecipes.CENTRIFUGE));
|
||||
registry.add(new TwoInputsCenterOutputCategory<>(ModRecipes.CHEMICAL_REACTOR));
|
||||
registry.add(new OneInputOneOutputCategory<>(ModRecipes.COMPRESSOR));
|
||||
registry.add(new DistillationTowerCategory<>(ModRecipes.DISTILLATION_TOWER));
|
||||
registry.add(new OneInputOneOutputCategory<>(ModRecipes.EXTRACTOR));
|
||||
registry.add(new FluidReplicatorRecipeCategory(ModRecipes.FLUID_REPLICATOR));
|
||||
registry.add(new TwoInputsCenterOutputCategory<>(ModRecipes.FUSION_REACTOR));
|
||||
registry.add(new OneInputOneOutputCategory<>(ModRecipes.GRINDER));
|
||||
registry.add(new ImplosionCompressorCategory<>(ModRecipes.IMPLOSION_COMPRESSOR));
|
||||
registry.add(new ElectrolyzerCategory<>(ModRecipes.INDUSTRIAL_ELECTROLYZER));
|
||||
registry.add(new GrinderCategory<>(ModRecipes.INDUSTRIAL_GRINDER));
|
||||
registry.add(new SawmillCategory<>(ModRecipes.INDUSTRIAL_SAWMILL));
|
||||
registry.add(new RollingMachineCategory(ModRecipes.ROLLING_MACHINE));
|
||||
registry.add(new OneInputOneOutputCategory<>(ModRecipes.SCRAPBOX));
|
||||
registry.add(new TwoInputsCenterOutputCategory<>(ModRecipes.SOLID_CANNING_MACHINE));
|
||||
registry.add(new OneInputOneOutputCategory<>(ModRecipes.VACUUM_FREEZER));
|
||||
registry.add(new OneInputOneOutputCategory<>(ModRecipes.WIRE_MILL));
|
||||
|
||||
registry.add(new FluidGeneratorRecipeCategory(Machine.THERMAL_GENERATOR));
|
||||
registry.add(new FluidGeneratorRecipeCategory(Machine.GAS_TURBINE));
|
||||
registry.add(new FluidGeneratorRecipeCategory(Machine.DIESEL_GENERATOR));
|
||||
registry.add(new FluidGeneratorRecipeCategory(Machine.SEMI_FLUID_GENERATOR));
|
||||
registry.add(new FluidGeneratorRecipeCategory(Machine.PLASMA_GENERATOR));
|
||||
|
||||
addWorkstations(ModRecipes.ALLOY_SMELTER.name(), EntryStacks.of(Machine.ALLOY_SMELTER), EntryStacks.of(Machine.IRON_ALLOY_FURNACE));
|
||||
addWorkstations(ModRecipes.ASSEMBLING_MACHINE.name(), EntryStacks.of(Machine.ASSEMBLY_MACHINE));
|
||||
addWorkstations(ModRecipes.BLAST_FURNACE.name(), EntryStacks.of(Machine.INDUSTRIAL_BLAST_FURNACE));
|
||||
addWorkstations(ModRecipes.CENTRIFUGE.name(), EntryStacks.of(Machine.INDUSTRIAL_CENTRIFUGE));
|
||||
addWorkstations(ModRecipes.CHEMICAL_REACTOR.name(), EntryStacks.of(Machine.CHEMICAL_REACTOR));
|
||||
addWorkstations(ModRecipes.COMPRESSOR.name(), EntryStacks.of(Machine.COMPRESSOR));
|
||||
addWorkstations(ModRecipes.DISTILLATION_TOWER.name(), EntryStacks.of(Machine.DISTILLATION_TOWER));
|
||||
addWorkstations(ModRecipes.EXTRACTOR.name(), EntryStacks.of(Machine.EXTRACTOR));
|
||||
addWorkstations(ModRecipes.FLUID_REPLICATOR.name(), EntryStacks.of(Machine.FLUID_REPLICATOR));
|
||||
addWorkstations(ModRecipes.FUSION_REACTOR.name(), EntryStacks.of(Machine.FUSION_CONTROL_COMPUTER));
|
||||
addWorkstations(ModRecipes.GRINDER.name(), EntryStacks.of(Machine.GRINDER));
|
||||
addWorkstations(ModRecipes.IMPLOSION_COMPRESSOR.name(), EntryStacks.of(Machine.IMPLOSION_COMPRESSOR));
|
||||
addWorkstations(ModRecipes.INDUSTRIAL_ELECTROLYZER.name(), EntryStacks.of(Machine.INDUSTRIAL_ELECTROLYZER));
|
||||
addWorkstations(ModRecipes.INDUSTRIAL_GRINDER.name(), EntryStacks.of(Machine.INDUSTRIAL_GRINDER));
|
||||
addWorkstations(ModRecipes.INDUSTRIAL_SAWMILL.name(), EntryStacks.of(Machine.INDUSTRIAL_SAWMILL));
|
||||
addWorkstations(ModRecipes.ROLLING_MACHINE.name(), EntryStacks.of(Machine.ROLLING_MACHINE));
|
||||
addWorkstations(ModRecipes.SOLID_CANNING_MACHINE.name(), EntryStacks.of(Machine.SOLID_CANNING_MACHINE));
|
||||
addWorkstations(ModRecipes.VACUUM_FREEZER.name(), EntryStacks.of(Machine.VACUUM_FREEZER));
|
||||
addWorkstations(ModRecipes.WIRE_MILL.name(), EntryStacks.of(Machine.WIRE_MILL));
|
||||
registry.addWorkstations(CategoryIdentifier.of(TechReborn.MOD_ID, Machine.THERMAL_GENERATOR.name), EntryStacks.of(Machine.THERMAL_GENERATOR));
|
||||
registry.addWorkstations(CategoryIdentifier.of(TechReborn.MOD_ID, Machine.GAS_TURBINE.name), EntryStacks.of(Machine.GAS_TURBINE));
|
||||
registry.addWorkstations(CategoryIdentifier.of(TechReborn.MOD_ID, Machine.DIESEL_GENERATOR.name), EntryStacks.of(Machine.DIESEL_GENERATOR));
|
||||
registry.addWorkstations(CategoryIdentifier.of(TechReborn.MOD_ID, Machine.SEMI_FLUID_GENERATOR.name), EntryStacks.of(Machine.SEMI_FLUID_GENERATOR));
|
||||
registry.addWorkstations(CategoryIdentifier.of(TechReborn.MOD_ID, Machine.PLASMA_GENERATOR.name), EntryStacks.of(Machine.PLASMA_GENERATOR));
|
||||
}
|
||||
|
||||
private void addWorkstations(Identifier identifier, EntryStack<?>... stacks) {
|
||||
CategoryRegistry.getInstance().addWorkstations(CategoryIdentifier.of(identifier), stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDisplays(DisplayRegistry registry) {
|
||||
RecipeManager.getRecipeTypes("techreborn").forEach(rebornRecipeType -> registerMachineRecipe(registry, rebornRecipeType));
|
||||
|
||||
registerFluidGeneratorDisplays(registry, EFluidGenerator.THERMAL, Machine.THERMAL_GENERATOR);
|
||||
registerFluidGeneratorDisplays(registry, EFluidGenerator.GAS, Machine.GAS_TURBINE);
|
||||
registerFluidGeneratorDisplays(registry, EFluidGenerator.DIESEL, Machine.DIESEL_GENERATOR);
|
||||
registerFluidGeneratorDisplays(registry, EFluidGenerator.SEMIFLUID, Machine.SEMI_FLUID_GENERATOR);
|
||||
registerFluidGeneratorDisplays(registry, EFluidGenerator.PLASMA, Machine.PLASMA_GENERATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerFluidSupport(FluidSupportProvider support) {
|
||||
support.register(new FluidSupportProvider.Provider() {
|
||||
@Override
|
||||
public CompoundEventResult<Stream<EntryStack<FluidStack>>> itemToFluid(EntryStack<? extends ItemStack> stack) {
|
||||
ItemStack itemStack = stack.getValue();
|
||||
if (itemStack.getItem() instanceof ItemFluidInfo) {
|
||||
Fluid fluid = ((ItemFluidInfo) itemStack.getItem()).getFluid(itemStack);
|
||||
if (fluid != null)
|
||||
return CompoundEventResult.interruptTrue(Stream.of(EntryStacks.of(fluid)));
|
||||
}
|
||||
return CompoundEventResult.pass();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemComparators(ItemComparatorRegistry registry) {
|
||||
registry.registerNbt(TRContent.CELL);
|
||||
}
|
||||
|
||||
private void registerFluidGeneratorDisplays(DisplayRegistry registry, EFluidGenerator generator, Machine machine) {
|
||||
Identifier identifier = new Identifier(TechReborn.MOD_ID, machine.name);
|
||||
GeneratorRecipeHelper.getFluidRecipesForGenerator(generator).getRecipes().forEach(recipe ->
|
||||
registry.add(new FluidGeneratorRecipeDisplay(recipe, identifier))
|
||||
);
|
||||
}
|
||||
|
||||
private <R extends RebornRecipe> void registerMachineRecipe(DisplayRegistry registry, RebornRecipeType<R> recipeType) {
|
||||
Function<R, Display> recipeDisplay = r -> new MachineRecipeDisplay<>((RebornRecipe) r);
|
||||
|
||||
if (recipeType == ModRecipes.ROLLING_MACHINE) {
|
||||
recipeDisplay = r -> {
|
||||
RollingMachineRecipe rollingMachineRecipe = (RollingMachineRecipe) r;
|
||||
return new RollingMachineDisplay(rollingMachineRecipe.getShapedRecipe());
|
||||
};
|
||||
}
|
||||
|
||||
if (recipeType == ModRecipes.FLUID_REPLICATOR) {
|
||||
recipeDisplay = r -> {
|
||||
FluidReplicatorRecipe recipe = (FluidReplicatorRecipe) r;
|
||||
return new FluidReplicatorRecipeDisplay(recipe);
|
||||
};
|
||||
}
|
||||
|
||||
registry.registerFiller(RebornRecipe.class, recipe -> {
|
||||
if (recipe instanceof RebornRecipe) {
|
||||
return recipe.getRebornRecipeType() == recipeType;
|
||||
}
|
||||
return false;
|
||||
}, recipeDisplay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerScreens(ScreenRegistry registry) {
|
||||
ExclusionZones exclusionZones = registry.exclusionZones();
|
||||
exclusionZones.register(GuiBase.class, guiBase -> {
|
||||
int height = 0;
|
||||
if (guiBase.tryAddUpgrades() && guiBase.be instanceof IUpgradeable upgradeable) {
|
||||
if (upgradeable.canBeUpgraded()) {
|
||||
height = 80;
|
||||
}
|
||||
}
|
||||
for (GuiTab slot : (List<GuiTab>) guiBase.getTabs()) {
|
||||
if (slot.enabled()) {
|
||||
height += 24;
|
||||
}
|
||||
}
|
||||
if (height > 0) {
|
||||
int width = 20;
|
||||
return Collections.singletonList(new Rectangle(guiBase.getGuiLeft() - width, guiBase.getGuiTop() + 8, width, height));
|
||||
}
|
||||
return Collections.emptyList();
|
||||
});
|
||||
}
|
||||
|
||||
public static Widget createProgressBar(int x, int y, double animationDuration, GuiBuilder.ProgressDirection direction) {
|
||||
return Widgets.createDrawableWidget((helper, matrices, mouseX, mouseY, delta) -> {
|
||||
RenderSystem.setShaderTexture(0, GuiBuilder.defaultTextureSheet);
|
||||
helper.drawTexture(matrices, x, y, direction.x, direction.y, direction.width, direction.height);
|
||||
int j = (int) ((System.currentTimeMillis() / animationDuration) % 1.0 * 16.0);
|
||||
if (j < 0) {
|
||||
j = 0;
|
||||
}
|
||||
|
||||
switch (direction) {
|
||||
case RIGHT -> helper.drawTexture(matrices, x, y, direction.xActive, direction.yActive, j, 10);
|
||||
case LEFT -> helper.drawTexture(matrices, x + 16 - j, y, direction.xActive + 16 - j, direction.yActive, j, 10);
|
||||
case UP -> helper.drawTexture(matrices, x, y + 16 - j, direction.xActive, direction.yActive + 16 - j, 10, j);
|
||||
case DOWN -> helper.drawTexture(matrices, x, y, direction.xActive, direction.yActive, 10, j);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static Widget createEnergyDisplay(Rectangle bounds, double energy, EntryAnimation animation, Function<TooltipContext, Tooltip> tooltipBuilder) {
|
||||
return new EnergyEntryWidget(bounds, animation).entry(
|
||||
ClientEntryStacks.of(new AbstractRenderer() {
|
||||
@Override
|
||||
public void render(MatrixStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {}
|
||||
|
||||
@Override
|
||||
public @Nullable Tooltip getTooltip(TooltipContext context) {
|
||||
return tooltipBuilder.apply(context);
|
||||
}
|
||||
})
|
||||
).notFavoritesInteractable();
|
||||
}
|
||||
|
||||
public static Widget createFluidDisplay(Rectangle bounds, EntryStack<FluidStack> fluid, EntryAnimation animation) {
|
||||
EntryStack<FluidStack> copy = fluid.copy();
|
||||
ClientEntryStacks.setRenderer(copy, new FluidStackRenderer(animation, copy.getRenderer()));
|
||||
return Widgets.createSlot(bounds).entry(copy);
|
||||
}
|
||||
|
||||
private static class EnergyEntryWidget extends EntryWidget {
|
||||
private EntryAnimation animation;
|
||||
|
||||
protected EnergyEntryWidget(Rectangle rectangle, EntryAnimation animation) {
|
||||
super(new Point(rectangle.x, rectangle.y));
|
||||
this.getBounds().setBounds(rectangle);
|
||||
this.animation = animation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
if (background) {
|
||||
Rectangle bounds = getBounds();
|
||||
int width = bounds.width;
|
||||
int height = bounds.height;
|
||||
int innerHeight = height - 2;
|
||||
|
||||
PowerSystem.EnergySystem displayPower = PowerSystem.getDisplayPower();
|
||||
RenderSystem.setShaderTexture(0, GuiBuilder.defaultTextureSheet);
|
||||
drawTexture(matrices, bounds.x, bounds.y, displayPower.xBar - 15, displayPower.yBar - 1, width, height);
|
||||
int innerDisplayHeight;
|
||||
if (animation.animationType != EntryAnimationType.NONE) {
|
||||
innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / innerHeight) % innerHeight));
|
||||
if (animation.animationType == EntryAnimationType.DOWNWARDS)
|
||||
innerDisplayHeight = innerHeight - innerDisplayHeight;
|
||||
} else innerDisplayHeight = innerHeight;
|
||||
drawTexture(matrices, bounds.x + 1, bounds.y + 1 + innerHeight - innerDisplayHeight, displayPower.xBar, innerHeight + displayPower.yBar - innerDisplayHeight, width - 2, innerDisplayHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCurrentEntry(MatrixStack matrices, int mouseX, int mouseY, float delta) {}
|
||||
}
|
||||
|
||||
private static class FluidStackRenderer extends AbstractEntryRenderer<FluidStack> {
|
||||
private final EntryAnimation animation;
|
||||
private final EntryRenderer<FluidStack> parent;
|
||||
|
||||
public FluidStackRenderer(EntryAnimation animation, EntryRenderer<FluidStack> parent) {
|
||||
this.animation = animation;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(EntryStack<FluidStack> entry, MatrixStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
|
||||
int width = bounds.width;
|
||||
int height = bounds.height;
|
||||
|
||||
PowerSystem.EnergySystem displayPower = PowerSystem.getDisplayPower();
|
||||
RenderSystem.setShaderTexture(0, GuiBuilder.defaultTextureSheet);
|
||||
drawTexture(matrices, bounds.x - 4, bounds.y - 4, 194, 26, width + 8, height + 8);
|
||||
drawTexture(matrices, bounds.x - 1, bounds.y - 1, 194, 82, width + 2, height + 2);
|
||||
int innerDisplayHeight;
|
||||
if (animation.animationType != EntryAnimationType.NONE) {
|
||||
innerDisplayHeight = MathHelper.ceil((System.currentTimeMillis() / (animation.duration / height) % height));
|
||||
if (animation.animationType == EntryAnimationType.DOWNWARDS)
|
||||
innerDisplayHeight = height - innerDisplayHeight;
|
||||
} else innerDisplayHeight = height;
|
||||
drawFluid(matrices, entry.getValue().getFluid(), innerDisplayHeight, bounds.x, bounds.y, width, height);
|
||||
}
|
||||
|
||||
public void drawFluid(MatrixStack matrixStack, Fluid fluid, int drawHeight, int x, int y, int width, int height) {
|
||||
RenderSystem.setShaderTexture(0, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||
y += height;
|
||||
|
||||
FluidRenderHandler handler = FluidRenderHandlerRegistry.INSTANCE.get(fluid);
|
||||
|
||||
// If registry can't find it, don't render.
|
||||
if (handler == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Sprite sprite = handler.getFluidSprites(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState())[0];
|
||||
int color = FluidRenderHandlerRegistry.INSTANCE.get(fluid).getFluidColor(MinecraftClient.getInstance().world, BlockPos.ORIGIN, fluid.getDefaultState());
|
||||
|
||||
final int iconHeight = sprite.getHeight();
|
||||
int offsetHeight = drawHeight;
|
||||
|
||||
RenderSystem.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F);
|
||||
|
||||
int iteration = 0;
|
||||
while (offsetHeight != 0) {
|
||||
final int curHeight = Math.min(offsetHeight, iconHeight);
|
||||
|
||||
drawSprite(matrixStack, x, y - offsetHeight, 0, width, curHeight, sprite);
|
||||
offsetHeight -= curHeight;
|
||||
iteration++;
|
||||
if (iteration > 50) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Tooltip getTooltip(EntryStack<FluidStack> entry, TooltipContext context) {
|
||||
return parent.getTooltip(entry, context);
|
||||
}
|
||||
}
|
||||
|
||||
public record EntryAnimation(EntryAnimationType animationType, long duration) {
|
||||
|
||||
public static EntryAnimation upwards(long duration) {
|
||||
return new EntryAnimation(EntryAnimationType.UPWARDS, duration);
|
||||
}
|
||||
|
||||
public static EntryAnimation downwards(long duration) {
|
||||
return new EntryAnimation(EntryAnimationType.DOWNWARDS, duration);
|
||||
}
|
||||
|
||||
public static EntryAnimation none() {
|
||||
return new EntryAnimation(EntryAnimationType.NONE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public enum EntryAnimationType {
|
||||
UPWARDS,
|
||||
DOWNWARDS,
|
||||
NONE
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.fluidgenerator;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.ClientHelper;
|
||||
import me.shedaniel.rei.api.client.gui.Renderer;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.util.EntryStacks;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import techreborn.TechReborn;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
import techreborn.init.TRContent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FluidGeneratorRecipeCategory implements DisplayCategory<FluidGeneratorRecipeDisplay> {
|
||||
|
||||
private final TRContent.Machine generator;
|
||||
private final CategoryIdentifier<? extends FluidGeneratorRecipeDisplay> identifier;
|
||||
|
||||
public FluidGeneratorRecipeCategory(TRContent.Machine generator) {
|
||||
this.generator = generator;
|
||||
this.identifier = CategoryIdentifier.of(TechReborn.MOD_ID, generator.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryIdentifier<? extends FluidGeneratorRecipeDisplay> getCategoryIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text getTitle() {
|
||||
return Text.translatable(identifier.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Renderer getIcon() {
|
||||
return EntryStacks.of(generator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(FluidGeneratorRecipeDisplay recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = Lists.newArrayList();
|
||||
widgets.add(Widgets.createRecipeBase(bounds));
|
||||
widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 108, bounds.y + 8, 14, 50), recipeDisplay.getTotalEnergy(), ReiPlugin.EntryAnimation.upwards(5000), tooltipContext -> {
|
||||
List<Text> list = Lists.newArrayList();
|
||||
list.add(Text.of("Energy"));
|
||||
list.add(Text.translatable("techreborn.jei.recipe.generator.total", recipeDisplay.getTotalEnergy()).formatted(Formatting.GRAY));
|
||||
list.add(Text.of(""));
|
||||
list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
|
||||
return Tooltip.create(tooltipContext.getPoint(), list);
|
||||
}));
|
||||
widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 16, bounds.y + 8, 16, 50), recipeDisplay.getInputEntries().get(0).get(0).cast(), ReiPlugin.EntryAnimation.downwards(5000)));
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 16, bounds.y + 48 - 19, 5000, GuiBuilder.ProgressDirection.RIGHT));
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.fluidgenerator;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.display.Display;
|
||||
import me.shedaniel.rei.api.common.entry.EntryIngredient;
|
||||
import me.shedaniel.rei.api.common.util.EntryIngredients;
|
||||
import net.minecraft.util.Identifier;
|
||||
import techreborn.api.generator.FluidGeneratorRecipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FluidGeneratorRecipeDisplay implements Display {
|
||||
|
||||
private final List<EntryIngredient> inputs;
|
||||
private final CategoryIdentifier<?> category;
|
||||
private final int totalEnergy;
|
||||
|
||||
public FluidGeneratorRecipeDisplay(FluidGeneratorRecipe recipe, Identifier category) {
|
||||
this.category = CategoryIdentifier.of(category);
|
||||
this.inputs = Lists.newArrayList();
|
||||
this.totalEnergy = recipe.getEnergyPerBucket();
|
||||
inputs.add(EntryIngredients.of(recipe.fluid(), 1000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntryIngredient> getInputEntries() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntryIngredient> getOutputEntries() {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryIdentifier<?> getCategoryIdentifier() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public int getTotalEnergy() {
|
||||
return totalEnergy;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.fluidreplicator;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.ClientHelper;
|
||||
import me.shedaniel.rei.api.client.gui.Renderer;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.util.EntryStacks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.api.recipe.recipes.FluidReplicatorRecipe;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class FluidReplicatorRecipeCategory implements DisplayCategory<FluidReplicatorRecipeDisplay> {
|
||||
|
||||
private final RebornRecipeType<FluidReplicatorRecipe> rebornRecipeType;
|
||||
|
||||
public FluidReplicatorRecipeCategory(RebornRecipeType<FluidReplicatorRecipe> recipeType) {
|
||||
this.rebornRecipeType = recipeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryIdentifier<? extends FluidReplicatorRecipeDisplay> getCategoryIdentifier() {
|
||||
return CategoryIdentifier.of(rebornRecipeType.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text getTitle() {
|
||||
return Text.translatable(rebornRecipeType.name().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Renderer getIcon() {
|
||||
return EntryStacks.of(ReiPlugin.iconMap.getOrDefault(rebornRecipeType, () -> Items.DIAMOND_SHOVEL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(FluidReplicatorRecipeDisplay recipeDisplay, Rectangle bounds) {
|
||||
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 13);
|
||||
|
||||
List<Widget> widgets = Lists.newArrayList();
|
||||
widgets.add(Widgets.createRecipeBase(bounds));
|
||||
widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), tooltipContext -> {
|
||||
List<Text> list = Lists.newArrayList();
|
||||
list.add(Text.of("Energy"));
|
||||
list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY));
|
||||
list.add(Text.of(""));
|
||||
list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
|
||||
return Tooltip.create(tooltipContext.getPoint(), list);
|
||||
}));
|
||||
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 46, bounds.y + 26)).entries(recipeDisplay.getInputEntries().get(0)).markInput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 46 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 46 + 46, bounds.y + 8, 16, 50), recipeDisplay.getOutputEntries().get(0).get(0).cast(), ReiPlugin.EntryAnimation.upwards(5000)));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.leftAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
|
||||
return widgets;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.fluidreplicator;
|
||||
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.display.Display;
|
||||
import me.shedaniel.rei.api.common.entry.EntryIngredient;
|
||||
import me.shedaniel.rei.api.common.util.CollectionUtils;
|
||||
import me.shedaniel.rei.api.common.util.EntryIngredients;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.fluid.container.FluidInstance;
|
||||
import techreborn.api.recipe.recipes.FluidReplicatorRecipe;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author drcrazy
|
||||
*/
|
||||
public class FluidReplicatorRecipeDisplay implements Display {
|
||||
|
||||
private final FluidReplicatorRecipe recipe;
|
||||
private final List<EntryIngredient> inputs;
|
||||
private final List<EntryIngredient> output;
|
||||
private final FluidInstance fluidInstance;
|
||||
private final int energy;
|
||||
private final int time;
|
||||
|
||||
public FluidReplicatorRecipeDisplay(FluidReplicatorRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
this.inputs = CollectionUtils.map(recipe.getRebornIngredients(), ing -> EntryIngredients.ofItemStacks(ing.getPreviewStacks()));
|
||||
this.fluidInstance = recipe.getFluidInstance();
|
||||
this.output = fluidInstance == null ? Collections.emptyList() : Collections.singletonList(EntryIngredients.of(fluidInstance.getFluid(), fluidInstance.getAmount().getRawValue()));
|
||||
this.energy = recipe.getPower();
|
||||
this.time = recipe.getTime();
|
||||
}
|
||||
|
||||
public FluidInstance getFluidInstance() {
|
||||
return fluidInstance;
|
||||
}
|
||||
|
||||
public int getEnergy() {
|
||||
return energy;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntryIngredient> getInputEntries() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntryIngredient> getOutputEntries() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryIdentifier<?> getCategoryIdentifier() {
|
||||
return CategoryIdentifier.of(recipe.getRebornRecipeType().name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Identifier> getDisplayLocation() {
|
||||
return Optional.ofNullable(recipe).map(RebornRecipe::getId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.ClientHelper;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractEnergyConsumingMachineCategory<R extends RebornRecipe> extends AbstractMachineCategory<R> {
|
||||
public AbstractEnergyConsumingMachineCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = Lists.newArrayList();
|
||||
widgets.add(Widgets.createRecipeBase(bounds));
|
||||
widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 8, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), tooltipContext -> {
|
||||
List<Text> list = Lists.newArrayList();
|
||||
list.add(Text.of("Energy"));
|
||||
list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY));
|
||||
list.add(Text.of(""));
|
||||
list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
|
||||
return Tooltip.create(tooltipContext.getPoint(), list);
|
||||
}));
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.rei.api.client.gui.DisplayRenderer;
|
||||
import me.shedaniel.rei.api.client.gui.Renderer;
|
||||
import me.shedaniel.rei.api.client.gui.SimpleDisplayRenderer;
|
||||
import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.entry.EntryIngredient;
|
||||
import me.shedaniel.rei.api.common.util.EntryStacks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractMachineCategory<R extends RebornRecipe> implements DisplayCategory<MachineRecipeDisplay<R>> {
|
||||
private final RebornRecipeType<R> rebornRecipeType;
|
||||
|
||||
public AbstractMachineCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
this.rebornRecipeType = rebornRecipeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryIdentifier<? extends MachineRecipeDisplay<R>> getCategoryIdentifier() {
|
||||
return CategoryIdentifier.of(rebornRecipeType.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text getTitle() {
|
||||
return Text.translatable(rebornRecipeType.name().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Renderer getIcon() {
|
||||
return EntryStacks.of(ReiPlugin.iconMap.getOrDefault(rebornRecipeType, () -> Items.DIAMOND_SHOVEL));
|
||||
}
|
||||
|
||||
@Override
|
||||
public DisplayRenderer getDisplayRenderer(MachineRecipeDisplay<R> recipe) {
|
||||
return SimpleDisplayRenderer.from(Collections.singletonList(recipe.getInputEntries().get(0)), recipe.getOutputEntries());
|
||||
}
|
||||
|
||||
public EntryIngredient getInput(MachineRecipeDisplay<R> recipeDisplay, int index) {
|
||||
List<EntryIngredient> inputs = recipeDisplay.getInputEntries();
|
||||
return inputs.size() > index ? inputs.get(index) : EntryIngredient.empty();
|
||||
}
|
||||
|
||||
public EntryIngredient getOutput(MachineRecipeDisplay<R> recipeDisplay, int index) {
|
||||
List<EntryIngredient> outputs = recipeDisplay.getOutputEntries();
|
||||
return outputs.size() > index ? outputs.get(index) : EntryIngredient.empty();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class AssemblingMachineCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public AssemblingMachineCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 9, bounds.y + 35 - 19)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 9, bounds.y + 55 - 19)).entries(getInput(recipeDisplay, 1)).markInput());
|
||||
widgets.add(Widgets.createResultSlotBackground(new Point(bounds.x + 101 - 9, bounds.y + 45 - 19)));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 - 9, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 9, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.rightAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class BlastFurnaceCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public BlastFurnaceCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 17, bounds.y + 35 - 19)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 17, bounds.y + 55 - 19)).entries(getInput(recipeDisplay, 1)).markInput());
|
||||
widgets.add(Widgets.createSlotBase(new Rectangle(bounds.x + 101 - 17 - 5, bounds.y + 45 - 19 - 5, 46, 26)));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 - 17, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 + 20 - 17, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 1)).disableBackground().markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 17, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
|
||||
Text neededHeat = Text.literal(String.valueOf(recipeDisplay.getHeat())).append(" ").append(Text.translatable("techreborn.jei.recipe.heat"));
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), neededHeat)
|
||||
.shadow(false)
|
||||
.rightAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.leftAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class DistillationTowerCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public DistillationTowerCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 23, bounds.y + 35 - 19)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 23, bounds.y + 55 - 19)).entries(getInput(recipeDisplay, 1)).markInput());
|
||||
widgets.add(Widgets.createSlotBase(new Rectangle(bounds.x + 101 - 23 - 5, bounds.y + 45 - 19 - 5, 66, 26)));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 - 23, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 + 20 - 23, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 1)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 101 + 40 - 23, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 2)).disableBackground().markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 23, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.rightAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class ElectrolyzerCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public ElectrolyzerCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 20, bounds.y + 41)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55, bounds.y + 41)).entries(getInput(recipeDisplay, 1)).markInput());
|
||||
widgets.add(Widgets.createSlotBase(new Rectangle(bounds.x + 55 + 17 - 9 - 20 - 5, bounds.y + 36 - 22 - 5, 86, 26)));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 17 - 9 - 20, bounds.y + 36 - 22)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 17 - 9, bounds.y + 36 - 22)).entries(getOutput(recipeDisplay, 1)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 17 - 9 + 20, bounds.y + 36 - 22)).entries(getOutput(recipeDisplay, 2)).disableBackground().markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 17 - 9 + 40, bounds.y + 36 - 22)).entries(getOutput(recipeDisplay, 3)).disableBackground().markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 36 + 4, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.UP));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 17, bounds.getMaxY() - 13), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.rightAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayHeight() {
|
||||
return 66;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.ClientHelper;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Identifier;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class GrinderCategory<R extends RebornRecipe> extends AbstractMachineCategory<R> {
|
||||
public GrinderCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = Lists.newArrayList();
|
||||
widgets.add(Widgets.createRecipeBase(bounds));
|
||||
widgets.add(ReiPlugin.createEnergyDisplay(new Rectangle(bounds.x + 8, bounds.y + 18, 14, 50), recipeDisplay.getEnergy(), ReiPlugin.EntryAnimation.downwards(5000), tooltipContext -> {
|
||||
List<Text> list = Lists.newArrayList();
|
||||
list.add(Text.of("Energy"));
|
||||
list.add(Text.translatable("techreborn.jei.recipe.running.cost", "E", recipeDisplay.getEnergy()).formatted(Formatting.GRAY));
|
||||
list.add(Text.of(""));
|
||||
list.add(ClientHelper.getInstance().getFormattedModFromIdentifier(new Identifier("techreborn", "")));
|
||||
return Tooltip.create(tooltipContext.getPoint(), list);
|
||||
}));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55, bounds.y + 36)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 46, bounds.y + 36 - 9 - 18)).entries(getOutput(recipeDisplay, 0)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 46, bounds.y + 36 - 9)).entries(getOutput(recipeDisplay, 1)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 46, bounds.y + 36 - 9 + 18)).entries(getOutput(recipeDisplay, 2)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 46, bounds.y + 36 - 9 + 36)).entries(getOutput(recipeDisplay, 3)).markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 36 + 4, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 55 - 26, bounds.y + 18, 16, 50), getInput(recipeDisplay, 1).get(0).cast(), ReiPlugin.EntryAnimation.downwards(5000)));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + 51, bounds.y + 15), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.leftAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayHeight() {
|
||||
return 88;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class ImplosionCompressorCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public ImplosionCompressorCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 15, bounds.y + 35 - 19)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 15, bounds.y + 55 - 19)).entries(getInput(recipeDisplay, 1)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 97 - 15, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 0)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 97 + 18 - 15, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 1)).markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 15, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.rightAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class IndustrialCentrifugeCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public IndustrialCentrifugeCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 17, bounds.y + 35 - 19)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 - 17, bounds.y + 55 - 19)).entries(getInput(recipeDisplay, 1)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 97 - 17, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 0)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 116 - 17, bounds.y + 26 - 19)).entries(getOutput(recipeDisplay, 1)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 135 - 17, bounds.y + 45 - 19)).entries(getOutput(recipeDisplay, 2)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 116 - 17, bounds.y + 64 - 19)).entries(getOutput(recipeDisplay, 3)).markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 76 - 17, bounds.y + 48 - 19, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + 24, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.leftAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class OneInputOneOutputCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public OneInputOneOutputCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 46, bounds.y + 26)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createResultSlotBackground(new Point(bounds.x + 46 + 46, bounds.y + 26)));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 46 + 46, bounds.y + 26)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 46 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.rightAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class SawmillCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public SawmillCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55, bounds.y + 26)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 46, bounds.y + 26 - 18)).entries(getOutput(recipeDisplay, 0)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 46, bounds.y + 26)).entries(getOutput(recipeDisplay, 1)).markOutput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 55 + 46, bounds.y + 26 + 18)).entries(getOutput(recipeDisplay, 2)).markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 55 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
widgets.add(ReiPlugin.createFluidDisplay(new Rectangle(bounds.x + 55 - 26, bounds.y + 8, 16, 50), getInput(recipeDisplay, 1).get(0).cast(), ReiPlugin.EntryAnimation.downwards(5000)));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.x + 51, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.leftAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.machine;
|
||||
|
||||
import me.shedaniel.math.Point;
|
||||
import me.shedaniel.math.Rectangle;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widget;
|
||||
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.client.gui.guibuilder.GuiBuilder;
|
||||
import reborncore.common.crafting.RebornRecipe;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.client.compat.rei.MachineRecipeDisplay;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class TwoInputsCenterOutputCategory<R extends RebornRecipe> extends AbstractEnergyConsumingMachineCategory<R> {
|
||||
public TwoInputsCenterOutputCategory(RebornRecipeType<R> rebornRecipeType) {
|
||||
super(rebornRecipeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> setupDisplay(MachineRecipeDisplay<R> recipeDisplay, Rectangle bounds) {
|
||||
List<Widget> widgets = super.setupDisplay(recipeDisplay, bounds);
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 29, bounds.y + 26)).entries(getInput(recipeDisplay, 0)).markInput());
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 29 + 92, bounds.y + 26)).entries(getInput(recipeDisplay, 1)).markInput());
|
||||
widgets.add(Widgets.createResultSlotBackground(new Point(bounds.x + 29 + 46, bounds.y + 26)));
|
||||
widgets.add(Widgets.createSlot(new Point(bounds.x + 29 + 46, bounds.y + 26)).entries(getOutput(recipeDisplay, 0)).disableBackground().markOutput());
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 29 + 21, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.RIGHT));
|
||||
widgets.add(ReiPlugin.createProgressBar(bounds.x + 29 + 71, bounds.y + 30, recipeDisplay.getTime() * 50, GuiBuilder.ProgressDirection.LEFT));
|
||||
|
||||
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 5), Text.translatable("techreborn.jei.recipe.processing.time.3", new DecimalFormat("###.##").format(recipeDisplay.getTime() / 20.0)))
|
||||
.shadow(false)
|
||||
.rightAligned()
|
||||
.color(0xFF404040, 0xFFBBBBBB)
|
||||
);
|
||||
return widgets;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.rollingmachine;
|
||||
|
||||
import me.shedaniel.rei.api.client.gui.Renderer;
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.util.EntryStacks;
|
||||
import me.shedaniel.rei.plugin.client.categories.crafting.DefaultCraftingCategory;
|
||||
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCraftingDisplay;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.text.Text;
|
||||
import reborncore.common.crafting.RebornRecipeType;
|
||||
import techreborn.api.recipe.recipes.RollingMachineRecipe;
|
||||
import techreborn.client.compat.rei.ReiPlugin;
|
||||
|
||||
public class RollingMachineCategory extends DefaultCraftingCategory {
|
||||
|
||||
private final RebornRecipeType<RollingMachineRecipe> rebornRecipeType;
|
||||
|
||||
public RollingMachineCategory(RebornRecipeType<RollingMachineRecipe> rebornRecipeType) {
|
||||
this.rebornRecipeType = rebornRecipeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryIdentifier<? extends DefaultCraftingDisplay<?>> getCategoryIdentifier() {
|
||||
return CategoryIdentifier.of(rebornRecipeType.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Text getTitle() {
|
||||
return Text.translatable(rebornRecipeType.name().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Renderer getIcon() {
|
||||
return EntryStacks.of(ReiPlugin.iconMap.getOrDefault(rebornRecipeType, () -> Items.DIAMOND_SHOVEL));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* This file is part of TechReborn, licensed under the MIT License (MIT).
|
||||
*
|
||||
* Copyright (c) 2020 TechReborn
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package techreborn.client.compat.rei.rollingmachine;
|
||||
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.plugin.common.displays.crafting.DefaultShapedDisplay;
|
||||
import net.minecraft.recipe.ShapedRecipe;
|
||||
import techreborn.init.ModRecipes;
|
||||
|
||||
public class RollingMachineDisplay extends DefaultShapedDisplay {
|
||||
|
||||
public RollingMachineDisplay(ShapedRecipe recipe) {
|
||||
super(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryIdentifier<?> getCategoryIdentifier() {
|
||||
return CategoryIdentifier.of(ModRecipes.ROLLING_MACHINE.name());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue