diff options
| author | shedaniel <daniel@shedaniel.me> | 2021-03-25 18:15:16 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2021-03-25 18:15:16 +0800 |
| commit | 02d1d95dd54285cc1237d1b5016401274a5ae5f0 (patch) | |
| tree | c3bed1a8a8ff8d4775394d6c0354587c0460f729 /default-plugin/src/main/java/me/shedaniel/rei/plugin/common | |
| parent | 995b8b58aa8c890c9181ae479e12a4facfa05a25 (diff) | |
| download | RoughlyEnoughItems-02d1d95dd54285cc1237d1b5016401274a5ae5f0.tar.gz RoughlyEnoughItems-02d1d95dd54285cc1237d1b5016401274a5ae5f0.tar.bz2 RoughlyEnoughItems-02d1d95dd54285cc1237d1b5016401274a5ae5f0.zip | |
Refactor Default Plugin packages, fix favorites
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'default-plugin/src/main/java/me/shedaniel/rei/plugin/common')
29 files changed, 917 insertions, 558 deletions
diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/BuiltinPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/BuiltinPlugin.java index 6cee53269..8324830bc 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/BuiltinPlugin.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/BuiltinPlugin.java @@ -24,22 +24,14 @@ package me.shedaniel.rei.plugin.common; import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import me.shedaniel.rei.plugin.beacon.base.DefaultBeaconBaseDisplay; -import me.shedaniel.rei.plugin.beacon.payment.DefaultBeaconPaymentDisplay; -import me.shedaniel.rei.plugin.blasting.DefaultBlastingDisplay; -import me.shedaniel.rei.plugin.brewing.DefaultBrewingDisplay; -import me.shedaniel.rei.plugin.common.campfire.DefaultCampfireDisplay; -import me.shedaniel.rei.plugin.common.composting.DefaultCompostingDisplay; -import me.shedaniel.rei.plugin.common.crafting.DefaultCraftingDisplay; -import me.shedaniel.rei.plugin.common.stonecutting.DefaultStoneCuttingDisplay; -import me.shedaniel.rei.plugin.fuel.DefaultFuelDisplay; -import me.shedaniel.rei.plugin.information.DefaultInformationDisplay; -import me.shedaniel.rei.plugin.pathing.DefaultPathingDisplay; -import me.shedaniel.rei.plugin.smelting.DefaultSmeltingDisplay; -import me.shedaniel.rei.plugin.smithing.DefaultSmithingDisplay; -import me.shedaniel.rei.plugin.smoking.DefaultSmokingDisplay; -import me.shedaniel.rei.plugin.stripping.DefaultStrippingDisplay; -import me.shedaniel.rei.plugin.tilling.DefaultTillingDisplay; +import me.shedaniel.rei.plugin.common.displays.*; +import me.shedaniel.rei.plugin.common.displays.beacon.DefaultBeaconBaseDisplay; +import me.shedaniel.rei.plugin.common.displays.beacon.DefaultBeaconPaymentDisplay; +import me.shedaniel.rei.plugin.common.displays.brewing.DefaultBrewingDisplay; +import me.shedaniel.rei.plugin.common.displays.cooking.DefaultBlastingDisplay; +import me.shedaniel.rei.plugin.common.displays.cooking.DefaultSmeltingDisplay; +import me.shedaniel.rei.plugin.common.displays.cooking.DefaultSmokingDisplay; +import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCraftingDisplay; public interface BuiltinPlugin { CategoryIdentifier<DefaultCraftingDisplay> CRAFTING = CategoryIdentifier.of("minecraft", "plugins/crafting"); diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java index 589acdaef..b0788e1a5 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/DefaultPlugin.java @@ -26,26 +26,23 @@ package me.shedaniel.rei.plugin.common; import me.shedaniel.architectury.hooks.FluidStackHooks; import me.shedaniel.architectury.utils.NbtType; import me.shedaniel.rei.api.common.display.DisplaySerializerRegistry; -import me.shedaniel.rei.api.common.fluid.FluidSupportProvider; import me.shedaniel.rei.api.common.entry.comparison.ItemComparator; import me.shedaniel.rei.api.common.entry.comparison.ItemComparatorRegistry; -import me.shedaniel.rei.api.common.util.EntryStacks; +import me.shedaniel.rei.api.common.fluid.FluidSupportProvider; import me.shedaniel.rei.api.common.plugins.REIServerPlugin; import me.shedaniel.rei.api.common.transfer.info.MenuInfoContext; import me.shedaniel.rei.api.common.transfer.info.MenuInfoRegistry; -import me.shedaniel.rei.plugin.blasting.DefaultBlastingDisplay; -import me.shedaniel.rei.plugin.common.campfire.DefaultCampfireDisplay; -import me.shedaniel.rei.plugin.common.composting.DefaultCompostingDisplay; -import me.shedaniel.rei.plugin.common.cooking.DefaultCookingDisplay; -import me.shedaniel.rei.plugin.common.crafting.DefaultCraftingDisplay; -import me.shedaniel.rei.plugin.common.stonecutting.DefaultStoneCuttingDisplay; -import me.shedaniel.rei.plugin.containers.CraftingGridMenuInfoWrapper; -import me.shedaniel.rei.plugin.fuel.DefaultFuelDisplay; -import me.shedaniel.rei.plugin.smelting.DefaultSmeltingDisplay; -import me.shedaniel.rei.plugin.smithing.DefaultSmithingDisplay; -import me.shedaniel.rei.plugin.smoking.DefaultSmokingDisplay; -import me.shedaniel.rei.plugin.stripping.DefaultStrippingDisplay; -import me.shedaniel.rei.plugin.tilling.DefaultTillingDisplay; +import me.shedaniel.rei.api.common.transfer.info.simple.RecipeBookGridMenuInfo; +import me.shedaniel.rei.api.common.util.EntryStacks; +import me.shedaniel.rei.plugin.common.displays.*; +import me.shedaniel.rei.plugin.common.displays.beacon.DefaultBeaconBaseDisplay; +import me.shedaniel.rei.plugin.common.displays.beacon.DefaultBeaconDisplay; +import me.shedaniel.rei.plugin.common.displays.beacon.DefaultBeaconPaymentDisplay; +import me.shedaniel.rei.plugin.common.displays.cooking.DefaultBlastingDisplay; +import me.shedaniel.rei.plugin.common.displays.cooking.DefaultCookingDisplay; +import me.shedaniel.rei.plugin.common.displays.cooking.DefaultSmeltingDisplay; +import me.shedaniel.rei.plugin.common.displays.cooking.DefaultSmokingDisplay; +import me.shedaniel.rei.plugin.common.displays.crafting.DefaultCraftingDisplay; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; @@ -100,26 +97,30 @@ public class DefaultPlugin implements BuiltinPlugin, REIServerPlugin { registry.register(COMPOSTING, DefaultCompostingDisplay.serializer()); registry.register(FUEL, DefaultFuelDisplay.serializer()); registry.register(SMITHING, DefaultSmithingDisplay.serializer()); + registry.register(BEACON_BASE, DefaultBeaconDisplay.serializer(DefaultBeaconBaseDisplay::new)); + registry.register(BEACON_PAYMENT, DefaultBeaconDisplay.serializer(DefaultBeaconPaymentDisplay::new)); registry.register(TILLING, DefaultTillingDisplay.serializer()); + registry.register(PATHING, DefaultPathingDisplay.serializer()); + registry.register(INFO, DefaultInformationDisplay.serializer()); } @Override public void registerMenuInfo(MenuInfoRegistry registry) { - registry.register(BuiltinPlugin.CRAFTING, new CraftingGridMenuInfoWrapper<CraftingMenu, DefaultCraftingDisplay>(CraftingMenu.class) { + registry.register(BuiltinPlugin.CRAFTING, new RecipeBookGridMenuInfo<CraftingMenu, DefaultCraftingDisplay>(CraftingMenu.class) { @Override public List<List<ItemStack>> getDisplayInputs(MenuInfoContext<CraftingMenu, ?, DefaultCraftingDisplay> context) { return context.getDisplay().getOrganisedInputEntries(this, context.getMenu()); } }); - registry.register(BuiltinPlugin.CRAFTING, new CraftingGridMenuInfoWrapper<InventoryMenu, DefaultCraftingDisplay>(InventoryMenu.class) { + registry.register(BuiltinPlugin.CRAFTING, new RecipeBookGridMenuInfo<InventoryMenu, DefaultCraftingDisplay>(InventoryMenu.class) { @Override public List<List<ItemStack>> getDisplayInputs(MenuInfoContext<InventoryMenu, ?, DefaultCraftingDisplay> context) { return context.getDisplay().getOrganisedInputEntries(this, context.getMenu()); } }); - registry.register(BuiltinPlugin.SMELTING, new CraftingGridMenuInfoWrapper<>(FurnaceMenu.class)); - registry.register(BuiltinPlugin.SMOKING, new CraftingGridMenuInfoWrapper<>(SmokerMenu.class)); - registry.register(BuiltinPlugin.BLASTING, new CraftingGridMenuInfoWrapper<>(BlastFurnaceMenu.class)); + registry.register(BuiltinPlugin.SMELTING, new RecipeBookGridMenuInfo<>(FurnaceMenu.class)); + registry.register(BuiltinPlugin.SMOKING, new RecipeBookGridMenuInfo<>(SmokerMenu.class)); + registry.register(BuiltinPlugin.BLASTING, new RecipeBookGridMenuInfo<>(BlastFurnaceMenu.class)); } @Override diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/campfire/DefaultCampfireCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/campfire/DefaultCampfireCategory.java deleted file mode 100644 index 6c50b261c..000000000 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/campfire/DefaultCampfireCategory.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020 shedaniel - * - * 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 me.shedaniel.rei.plugin.common.campfire; - -import com.google.common.collect.Lists; -import me.shedaniel.math.Point; -import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.client.gui.Renderer; -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 me.shedaniel.rei.plugin.common.BuiltinPlugin; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; -import net.minecraft.world.level.block.Blocks; - -import java.text.DecimalFormat; -import java.util.List; - -public class DefaultCampfireCategory implements DisplayCategory<DefaultCampfireDisplay> { - @Override - public CategoryIdentifier<? extends DefaultCampfireDisplay> getCategoryIdentifier() { - return BuiltinPlugin.CAMPFIRE; - } - - @Override - public Renderer getIcon() { - return EntryStacks.of(Blocks.CAMPFIRE); - } - - @Override - public Component getTitle() { - return new TranslatableComponent("category.rei.campfire"); - } - - @Override - public List<Widget> setupDisplay(DefaultCampfireDisplay display, Rectangle bounds) { - Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10); - final double cookingTime = display.getCookTime(); - DecimalFormat df = new DecimalFormat("###.##"); - List<Widget> widgets = Lists.newArrayList(); - widgets.add(Widgets.createRecipeBase(bounds)); - widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9))); - widgets.add(Widgets.createBurningFire(new Point(startPoint.x + 1, startPoint.y + 20)).animationDurationMS(10000)); - widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), - new TranslatableComponent("category.rei.campfire.time", df.format(cookingTime / 20d))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB)); - widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(cookingTime)); - widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(display.getInputEntries().get(0)).markInput()); - widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput()); - return widgets; - } - - @Override - public int getDisplayHeight() { - return 49; - } -} diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/composting/DefaultCompostingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/composting/DefaultCompostingCategory.java deleted file mode 100644 index 880afe6df..000000000 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/composting/DefaultCompostingCategory.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020 shedaniel - * - * 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 me.shedaniel.rei.plugin.common.composting; - -import com.google.common.collect.Lists; -import com.mojang.blaze3d.vertex.PoseStack; -import me.shedaniel.math.Point; -import me.shedaniel.math.Rectangle; -import me.shedaniel.rei.api.client.gui.DisplayRenderer; -import me.shedaniel.rei.api.client.gui.Renderer; -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.entry.EntryIngredient; -import me.shedaniel.rei.api.common.entry.EntryStack; -import me.shedaniel.rei.api.common.util.EntryStacks; -import me.shedaniel.rei.plugin.common.BuiltinPlugin; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; -import net.minecraft.util.Mth; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.ComposterBlock; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@Environment(EnvType.CLIENT) -public class DefaultCompostingCategory implements DisplayCategory<DefaultCompostingDisplay> { - @Override - public CategoryIdentifier<? extends DefaultCompostingDisplay> getCategoryIdentifier() { - return BuiltinPlugin.COMPOSTING; - } - - @Override - public Renderer getIcon() { - return EntryStacks.of(Blocks.COMPOSTER); - } - - @Override - public Component getTitle() { - return new TranslatableComponent("category.rei.composting"); - } - - @Override - public DisplayRenderer getDisplayRenderer(DefaultCompostingDisplay display) { - return new DisplayRenderer() { - private Component text = new TranslatableComponent("text.rei.composting.page", display.getPage() + 1); - - @Override - public int getHeight() { - return 10 + Minecraft.getInstance().font.lineHeight; - } - - @Override - public void render(PoseStack matrices, Rectangle rectangle, int mouseX, int mouseY, float delta) { - Minecraft.getInstance().font.draw(matrices, text.getVisualOrderText(), rectangle.x + 5, rectangle.y + 6, -1); - } - }; - } - - @Override - public List<Widget> setupDisplay(DefaultCompostingDisplay display, Rectangle bounds) { - List<Widget> widgets = Lists.newArrayList(); - Point startingPoint = new Point(bounds.x + bounds.width - 55, bounds.y + 110); - List<EntryIngredient> stacks = new ArrayList<>(display.getInputEntries()); - int i = 0; - for (int y = 0; y < 6; y++) - for (int x = 0; x < 8; x++) { - EntryIngredient entryStack = stacks.size() > i ? stacks.get(i) : EntryIngredient.empty(); - if (!entryStack.isEmpty()) { - ComposterBlock.COMPOSTABLES.object2FloatEntrySet().stream().filter(entry -> entry.getKey() != null && Objects.equals(entry.getKey().asItem(), entryStack.get(0).getValue())).findAny().map(Map.Entry::getValue).ifPresent(chance -> { - for (EntryStack<?> stack : entryStack) { - stack.tooltip(new TranslatableComponent("text.rei.composting.chance", Mth.fastFloor(chance * 100)).withStyle(ChatFormatting.YELLOW)); - } - }); - } - widgets.add(Widgets.createSlot(new Point(bounds.getCenterX() - 72 + x * 18, bounds.y + 3 + y * 18)).entries(entryStack).markInput()); - i++; - } - widgets.add(Widgets.createArrow(new Point(startingPoint.x - 1, startingPoint.y + 7))); - widgets.add(Widgets.createResultSlotBackground(new Point(startingPoint.x + 33, startingPoint.y + 8))); - widgets.add(Widgets.createSlot(new Point(startingPoint.x + 33, startingPoint.y + 8)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput()); - return widgets; - } - - @Override - public int getDisplayHeight() { - return 140; - } - - @Override - public int getFixedDisplaysPerPage() { - return 1; - } -}
\ No newline at end of file diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/cooking/DefaultCookingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/cooking/DefaultCookingCategory.java deleted file mode 100644 index 0196a7877..000000000 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/cooking/DefaultCookingCategory.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020 shedaniel - * - * 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 me.shedaniel.rei.plugin.common.cooking; - -import com.google.common.collect.Lists; -import com.mojang.blaze3d.vertex.PoseStack; -import it.unimi.dsi.fastutil.ints.IntList; -import me.shedaniel.math.Point; -import me.shedaniel.math.Rectangle; -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.gui.widgets.Widget; -import me.shedaniel.rei.api.client.gui.widgets.Widgets; -import me.shedaniel.rei.api.client.registry.display.TransferDisplayCategory; -import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import me.shedaniel.rei.api.common.entry.EntryStack; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.GuiComponent; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TranslatableComponent; - -import java.text.DecimalFormat; -import java.util.Collections; -import java.util.List; - -@Environment(EnvType.CLIENT) -public class DefaultCookingCategory implements TransferDisplayCategory<DefaultCookingDisplay> { - private CategoryIdentifier<? extends DefaultCookingDisplay> identifier; - private EntryStack<?> logo; - private String categoryName; - - public DefaultCookingCategory(CategoryIdentifier<? extends DefaultCookingDisplay> identifier, EntryStack<?> logo, String categoryName) { - this.identifier = identifier; - this.logo = logo; - this.categoryName = categoryName; - } - - @Override - public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, DefaultCookingDisplay display, IntList redSlots) { - Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10); - matrices.pushPose(); - matrices.translate(0, 0, 400); - if (redSlots.contains(0)) { - GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 1, startPoint.x + 1 + 16, startPoint.y + 1 + 16, 1090453504); - } - matrices.popPose(); - } - - @Override - public List<Widget> setupDisplay(DefaultCookingDisplay display, Rectangle bounds) { - Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10); - double cookingTime = display.getCookingTime(); - DecimalFormat df = new DecimalFormat("###.##"); - List<Widget> widgets = Lists.newArrayList(); - widgets.add(Widgets.createRecipeBase(bounds)); - widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9))); - widgets.add(Widgets.createBurningFire(new Point(startPoint.x + 1, startPoint.y + 20)) - .animationDurationMS(10000)); - widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), - new TranslatableComponent("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(cookingTime / 20d))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB)); - widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)) - .animationDurationTicks(cookingTime)); - widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)) - .entries(display.getOutputEntries().get(0)) - .disableBackground() - .markOutput()); - widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)) - .entries(display.getInputEntries().get(0)) - .markInput()); - return widgets; - } - - @Override - public DisplayRenderer getDisplayRenderer(DefaultCookingDisplay display) { - return SimpleDisplayRenderer.from(Collections.singletonList(display.getInputEntries().get(0)), display.getOutputEntries()); - } - - @Override - public int getDisplayHeight() { - return 49; - } - - @Override - public CategoryIdentifier<? extends DefaultCookingDisplay> getCategoryIdentifier() { - return identifier; - } - - @Override - public Renderer getIcon() { - return logo; - } - - @Override - public Component getTitle() { - return new TranslatableComponent(categoryName); - } -} diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/crafting/DefaultCraftingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/crafting/DefaultCraftingCategory.java deleted file mode 100644 index e295226b9..000000000 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/common/crafting/DefaultCraftingCategory.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020 shedaniel - * - * 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 |
