From 8f24a0f8446bddbbb5540163a96c2a6fde762823 Mon Sep 17 00:00:00 2001 From: Shnupbups Date: Thu, 18 Nov 2021 11:16:12 +1100 Subject: Waxing, Wax Scraping, Oxidizing, and Oxidation Scraping categories --- .../rei/plugin/client/DefaultClientPlugin.java | 33 ++++++++- .../DefaultOxidationScrapingCategory.java | 78 +++++++++++++++++++++ .../categories/DefaultOxidizingCategory.java | 78 +++++++++++++++++++++ .../categories/DefaultWaxScrapingCategory.java | 79 ++++++++++++++++++++++ .../client/categories/DefaultWaxingCategory.java | 78 +++++++++++++++++++++ 5 files changed, 344 insertions(+), 2 deletions(-) create mode 100644 default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultOxidationScrapingCategory.java create mode 100644 default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultOxidizingCategory.java create mode 100644 default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultWaxScrapingCategory.java create mode 100644 default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultWaxingCategory.java (limited to 'default-plugin/src/main/java/me/shedaniel/rei/plugin/client') diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java index e469d078c..779b21e0b 100644 --- a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java @@ -95,6 +95,7 @@ import net.minecraft.world.level.GameType; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.ComposterBlock; +import net.minecraft.world.level.block.WeatheringCopper; import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; @@ -146,7 +147,8 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin new DefaultCraftingCategory(), new DefaultCookingCategory(SMELTING, EntryStacks.of(Items.FURNACE), "category.rei.smelting"), new DefaultCookingCategory(SMOKING, EntryStacks.of(Items.SMOKER), "category.rei.smoking"), - new DefaultCookingCategory(BLASTING, EntryStacks.of(Items.BLAST_FURNACE), "category.rei.blasting"), new DefaultCampfireCategory(), + new DefaultCookingCategory(BLASTING, EntryStacks.of(Items.BLAST_FURNACE), "category.rei.blasting"), + new DefaultCampfireCategory(), new DefaultStoneCuttingCategory(), new DefaultFuelCategory(), new DefaultBrewingCategory(), @@ -158,6 +160,10 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin new DefaultBeaconPaymentCategory(), new DefaultTillingCategory(), new DefaultPathingCategory(), + new DefaultWaxingCategory(), + new DefaultWaxScrapingCategory(), + new DefaultOxidizingCategory(), + new DefaultOxidationScrapingCategory(), new DefaultInformationCategory() ); @@ -169,6 +175,10 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin registry.removePlusButton(STRIPPING); registry.removePlusButton(TILLING); registry.removePlusButton(PATHING); + registry.removePlusButton(WAXING); + registry.removePlusButton(WAX_SCRAPING); + registry.removePlusButton(OXIDIZING); + registry.removePlusButton(OXIDATION_SCRAPING); registry.addWorkstations(CRAFTING, EntryStacks.of(Items.CRAFTING_TABLE)); registry.addWorkstations(SMELTING, EntryStacks.of(Items.FURNACE)); @@ -183,11 +193,14 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin registry.addWorkstations(SMITHING, EntryStacks.of(Items.SMITHING_TABLE)); registry.addWorkstations(BEACON_BASE, EntryStacks.of(Items.BEACON)); registry.addWorkstations(BEACON_PAYMENT, EntryStacks.of(Items.BEACON)); + registry.addWorkstations(WAXING, EntryStacks.of(Items.HONEYCOMB)); Set axes = Sets.newHashSet(), hoes = Sets.newHashSet(), shovels = Sets.newHashSet(); EntryRegistry.getInstance().getEntryStacks().filter(stack -> stack.getValueType() == ItemStack.class).map(stack -> ((ItemStack) stack.getValue()).getItem()).forEach(item -> { if (item instanceof AxeItem && axes.add(item)) { registry.addWorkstations(STRIPPING, EntryStacks.of(item)); + registry.addWorkstations(WAX_SCRAPING, EntryStacks.of(item)); + registry.addWorkstations(OXIDATION_SCRAPING, EntryStacks.of(item)); } if (item instanceof HoeItem && hoes.add(item)) { registry.addWorkstations(TILLING, EntryStacks.of(item)); @@ -200,7 +213,11 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin Tag axesTag = itemTagCollection.getTag(new ResourceLocation("c", "axes")); if (axesTag != null) { for (Item item : axesTag.getValues()) { - if (axes.add(item)) registry.addWorkstations(STRIPPING, EntryStacks.of(item)); + if (axes.add(item)) { + registry.addWorkstations(STRIPPING, EntryStacks.of(item)); + registry.addWorkstations(WAX_SCRAPING, EntryStacks.of(item)); + registry.addWorkstations(OXIDATION_SCRAPING, EntryStacks.of(item)); + } } } Tag hoesTag = itemTagCollection.getTag(new ResourceLocation("c", "hoes")); @@ -268,6 +285,18 @@ public class DefaultClientPlugin implements REIClientPlugin, BuiltinClientPlugin }); registry.add(new DefaultBeaconBaseDisplay(CollectionUtils.map(Lists.newArrayList(BlockTags.BEACON_BASE_BLOCKS.getValues()), ItemStack::new))); registry.add(new DefaultBeaconPaymentDisplay(CollectionUtils.map(Lists.newArrayList(ItemTags.BEACON_PAYMENT_ITEMS.getValues()), ItemStack::new))); + HoneycombItem.WAXABLES.get().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> { + registry.add(new DefaultWaxingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue()))); + }); + HoneycombItem.WAX_OFF_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> { + registry.add(new DefaultWaxScrapingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue()))); + }); + WeatheringCopper.NEXT_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> { + registry.add(new DefaultOxidizingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue()))); + }); + WeatheringCopper.PREVIOUS_BY_BLOCK.get().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> { + registry.add(new DefaultOxidationScrapingDisplay(EntryStacks.of(set.getKey()), EntryStacks.of(set.getValue()))); + }); if (Platform.isFabric()) { Set potions = Sets.newLinkedHashSet(); for (Ingredient container : PotionBrewing.ALLOWED_CONTAINERS) { diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultOxidationScrapingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultOxidationScrapingCategory.java new file mode 100644 index 000000000..7cf774f85 --- /dev/null +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultOxidationScrapingCategory.java @@ -0,0 +1,78 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021 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.client.categories; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.Items; + +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 me.shedaniel.rei.plugin.common.displays.DefaultOxidationScrapingDisplay; + +public class DefaultOxidationScrapingCategory implements DisplayCategory { + @Override + public CategoryIdentifier getCategoryIdentifier() { + return BuiltinPlugin.OXIDATION_SCRAPING; + } + + @Override + public Renderer getIcon() { + return EntryStacks.of(Items.STONE_AXE); + } + + @Override + public Component getTitle() { + return new TranslatableComponent("category.rei.oxidation_scraping"); + } + + @Override + public List setupDisplay(DefaultOxidationScrapingDisplay display, Rectangle bounds) { + Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 13); + List widgets = Lists.newArrayList(); + widgets.add(Widgets.createRecipeBase(bounds)); + widgets.add(Widgets.createArrow(new Point(startPoint.x + 27, startPoint.y + 4))); + widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 5))); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 4, startPoint.y + 5)).entries(display.getIn()).markInput()); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 5)).entries(display.getOut()).disableBackground().markInput()); + return widgets; + } + + @Override + public int getDisplayHeight() { + return 36; + } + +} diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultOxidizingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultOxidizingCategory.java new file mode 100644 index 000000000..d2d6cfea3 --- /dev/null +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultOxidizingCategory.java @@ -0,0 +1,78 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021 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.client.categories; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.Items; + +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 me.shedaniel.rei.plugin.common.displays.DefaultOxidizingDisplay; + +public class DefaultOxidizingCategory implements DisplayCategory { + @Override + public CategoryIdentifier getCategoryIdentifier() { + return BuiltinPlugin.OXIDIZING; + } + + @Override + public Renderer getIcon() { + return EntryStacks.of(Items.CLOCK); + } + + @Override + public Component getTitle() { + return new TranslatableComponent("category.rei.oxidizing"); + } + + @Override + public List setupDisplay(DefaultOxidizingDisplay display, Rectangle bounds) { + Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 13); + List widgets = Lists.newArrayList(); + widgets.add(Widgets.createRecipeBase(bounds)); + widgets.add(Widgets.createArrow(new Point(startPoint.x + 27, startPoint.y + 4))); + widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 5))); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 4, startPoint.y + 5)).entries(display.getIn()).markInput()); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 5)).entries(display.getOut()).disableBackground().markInput()); + return widgets; + } + + @Override + public int getDisplayHeight() { + return 36; + } + +} diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultWaxScrapingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultWaxScrapingCategory.java new file mode 100644 index 000000000..ea472159c --- /dev/null +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultWaxScrapingCategory.java @@ -0,0 +1,79 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021 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.client.categories; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.Items; + +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 me.shedaniel.rei.plugin.common.displays.DefaultStrippingDisplay; +import me.shedaniel.rei.plugin.common.displays.DefaultWaxScrapingDisplay; + +public class DefaultWaxScrapingCategory implements DisplayCategory { + @Override + public CategoryIdentifier getCategoryIdentifier() { + return BuiltinPlugin.WAX_SCRAPING; + } + + @Override + public Renderer getIcon() { + return EntryStacks.of(Items.GOLDEN_AXE); + } + + @Override + public Component getTitle() { + return new TranslatableComponent("category.rei.wax_scraping"); + } + + @Override + public List setupDisplay(DefaultWaxScrapingDisplay display, Rectangle bounds) { + Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 13); + List widgets = Lists.newArrayList(); + widgets.add(Widgets.createRecipeBase(bounds)); + widgets.add(Widgets.createArrow(new Point(startPoint.x + 27, startPoint.y + 4))); + widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 5))); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 4, startPoint.y + 5)).entries(display.getIn()).markInput()); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 5)).entries(display.getOut()).disableBackground().markInput()); + return widgets; + } + + @Override + public int getDisplayHeight() { + return 36; + } + +} diff --git a/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultWaxingCategory.java b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultWaxingCategory.java new file mode 100644 index 000000000..10ad77b0b --- /dev/null +++ b/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/categories/DefaultWaxingCategory.java @@ -0,0 +1,78 @@ +/* + * This file is licensed under the MIT License, part of Roughly Enough Items. + * Copyright (c) 2018, 2019, 2020, 2021 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.client.categories; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.world.item.Items; + +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 me.shedaniel.rei.plugin.common.displays.DefaultWaxingDisplay; + +public class DefaultWaxingCategory implements DisplayCategory { + @Override + public CategoryIdentifier getCategoryIdentifier() { + return BuiltinPlugin.WAXING; + } + + @Override + public Renderer getIcon() { + return EntryStacks.of(Items.HONEYCOMB); + } + + @Override + public Component getTitle() { + return new TranslatableComponent("category.rei.waxing"); + } + + @Override + public List setupDisplay(DefaultWaxingDisplay display, Rectangle bounds) { + Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 13); + List widgets = Lists.newArrayList(); + widgets.add(Widgets.createRecipeBase(bounds)); + widgets.add(Widgets.createArrow(new Point(startPoint.x + 27, startPoint.y + 4))); + widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 5))); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 4, startPoint.y + 5)).entries(display.getIn()).markInput()); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 5)).entries(display.getOut()).disableBackground().markInput()); + return widgets; + } + + @Override + public int getDisplayHeight() { + return 36; + } + +} -- cgit