DefaultPlugin.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. /*
  2. * This file is licensed under the MIT License, part of Roughly Enough Items.
  3. * Copyright (c) 2018, 2019, 2020 shedaniel
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. */
  23. package me.shedaniel.rei.plugin;
  24. import com.google.common.collect.Lists;
  25. import com.google.common.collect.Maps;
  26. import it.unimi.dsi.fastutil.objects.Object2FloatMap;
  27. import me.shedaniel.math.Rectangle;
  28. import me.shedaniel.rei.api.*;
  29. import me.shedaniel.rei.api.fluid.FluidSupportProvider;
  30. import me.shedaniel.rei.api.plugins.REIPluginV0;
  31. import me.shedaniel.rei.plugin.autocrafting.DefaultRecipeBookHandler;
  32. import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseCategory;
  33. import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseDisplay;
  34. import me.shedaniel.rei.plugin.beacon_payment.DefaultBeaconPaymentCategory;
  35. import me.shedaniel.rei.plugin.beacon_payment.DefaultBeaconPaymentDisplay;
  36. import me.shedaniel.rei.plugin.blasting.DefaultBlastingDisplay;
  37. import me.shedaniel.rei.plugin.brewing.DefaultBrewingCategory;
  38. import me.shedaniel.rei.plugin.brewing.DefaultBrewingDisplay;
  39. import me.shedaniel.rei.plugin.brewing.RegisteredBrewingRecipe;
  40. import me.shedaniel.rei.plugin.campfire.DefaultCampfireCategory;
  41. import me.shedaniel.rei.plugin.campfire.DefaultCampfireDisplay;
  42. import me.shedaniel.rei.plugin.composting.DefaultCompostingCategory;
  43. import me.shedaniel.rei.plugin.composting.DefaultCompostingDisplay;
  44. import me.shedaniel.rei.plugin.cooking.DefaultCookingCategory;
  45. import me.shedaniel.rei.plugin.crafting.DefaultCraftingCategory;
  46. import me.shedaniel.rei.plugin.crafting.DefaultCustomDisplay;
  47. import me.shedaniel.rei.plugin.crafting.DefaultShapedDisplay;
  48. import me.shedaniel.rei.plugin.crafting.DefaultShapelessDisplay;
  49. import me.shedaniel.rei.plugin.fuel.DefaultFuelCategory;
  50. import me.shedaniel.rei.plugin.fuel.DefaultFuelDisplay;
  51. import me.shedaniel.rei.plugin.information.DefaultInformationCategory;
  52. import me.shedaniel.rei.plugin.information.DefaultInformationDisplay;
  53. import me.shedaniel.rei.plugin.pathing.DefaultPathingCategory;
  54. import me.shedaniel.rei.plugin.pathing.DefaultPathingDisplay;
  55. import me.shedaniel.rei.plugin.pathing.DummyShovelItem;
  56. import me.shedaniel.rei.plugin.smelting.DefaultSmeltingDisplay;
  57. import me.shedaniel.rei.plugin.smithing.DefaultSmithingCategory;
  58. import me.shedaniel.rei.plugin.smithing.DefaultSmithingDisplay;
  59. import me.shedaniel.rei.plugin.smoking.DefaultSmokingDisplay;
  60. import me.shedaniel.rei.plugin.stonecutting.DefaultStoneCuttingCategory;
  61. import me.shedaniel.rei.plugin.stonecutting.DefaultStoneCuttingDisplay;
  62. import me.shedaniel.rei.plugin.stripping.DefaultStrippingCategory;
  63. import me.shedaniel.rei.plugin.stripping.DefaultStrippingDisplay;
  64. import me.shedaniel.rei.plugin.stripping.DummyAxeItem;
  65. import me.shedaniel.rei.plugin.tilling.DefaultTillingCategory;
  66. import me.shedaniel.rei.plugin.tilling.DefaultTillingDisplay;
  67. import me.shedaniel.rei.plugin.tilling.DummyHoeItem;
  68. import me.shedaniel.rei.utils.CollectionUtils;
  69. import net.fabricmc.api.EnvType;
  70. import net.fabricmc.api.Environment;
  71. import net.minecraft.client.Minecraft;
  72. import net.minecraft.client.gui.screens.inventory.*;
  73. import net.minecraft.client.gui.screens.recipebook.RecipeUpdateListener;
  74. import net.minecraft.core.Registry;
  75. import net.minecraft.network.chat.Component;
  76. import net.minecraft.resources.ResourceLocation;
  77. import net.minecraft.tags.BlockTags;
  78. import net.minecraft.tags.ItemTags;
  79. import net.minecraft.tags.Tag;
  80. import net.minecraft.util.LazyLoadedValue;
  81. import net.minecraft.util.Mth;
  82. import net.minecraft.world.item.*;
  83. import net.minecraft.world.item.alchemy.PotionUtils;
  84. import net.minecraft.world.item.crafting.*;
  85. import net.minecraft.world.item.enchantment.Enchantment;
  86. import net.minecraft.world.item.enchantment.EnchantmentHelper;
  87. import net.minecraft.world.level.ItemLike;
  88. import net.minecraft.world.level.block.ComposterBlock;
  89. import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
  90. import net.minecraft.world.level.material.Fluid;
  91. import org.apache.logging.log4j.LogManager;
  92. import org.apache.logging.log4j.Logger;
  93. import org.jetbrains.annotations.ApiStatus;
  94. import org.jetbrains.annotations.NotNull;
  95. import java.util.*;
  96. import java.util.function.UnaryOperator;
  97. import static me.shedaniel.rei.impl.Internals.attachInstance;
  98. @Environment(EnvType.CLIENT)
  99. public class DefaultPlugin implements REIPluginV0, BuiltinPlugin {
  100. private static final Logger LOGGER = LogManager.getFormatterLogger("REI/DefaultPlugin");
  101. public static final ResourceLocation CRAFTING = BuiltinPlugin.CRAFTING;
  102. public static final ResourceLocation SMELTING = BuiltinPlugin.SMELTING;
  103. public static final ResourceLocation SMOKING = BuiltinPlugin.SMOKING;
  104. public static final ResourceLocation BLASTING = BuiltinPlugin.BLASTING;
  105. public static final ResourceLocation CAMPFIRE = BuiltinPlugin.CAMPFIRE;
  106. public static final ResourceLocation STONE_CUTTING = BuiltinPlugin.STONE_CUTTING;
  107. public static final ResourceLocation STRIPPING = BuiltinPlugin.STRIPPING;
  108. public static final ResourceLocation BREWING = BuiltinPlugin.BREWING;
  109. public static final ResourceLocation PLUGIN = BuiltinPlugin.PLUGIN;
  110. public static final ResourceLocation COMPOSTING = BuiltinPlugin.COMPOSTING;
  111. public static final ResourceLocation FUEL = BuiltinPlugin.FUEL;
  112. public static final ResourceLocation SMITHING = BuiltinPlugin.SMITHING;
  113. public static final ResourceLocation BEACON = BuiltinPlugin.BEACON;
  114. public static final ResourceLocation BEACON_PAYMENT = BuiltinPlugin.BEACON_PAYMENT;
  115. public static final ResourceLocation TILLING = BuiltinPlugin.TILLING;
  116. public static final ResourceLocation PATHING = BuiltinPlugin.PATHING;
  117. public static final ResourceLocation INFO = BuiltinPlugin.INFO;
  118. private static final ResourceLocation DISPLAY_TEXTURE = new ResourceLocation("roughlyenoughitems", "textures/gui/display.png");
  119. private static final ResourceLocation DISPLAY_TEXTURE_DARK = new ResourceLocation("roughlyenoughitems", "textures/gui/display_dark.png");
  120. private static final List<LazyLoadedValue<DefaultBrewingDisplay>> BREWING_DISPLAYS = Lists.newArrayList();
  121. private static final List<DefaultInformationDisplay> INFO_DISPLAYS = Lists.newArrayList();
  122. public static ResourceLocation getDisplayTexture() {
  123. return REIHelper.getInstance().getDefaultDisplayTexture();
  124. }
  125. public DefaultPlugin() {
  126. attachInstance(this, BuiltinPlugin.class);
  127. }
  128. @Deprecated
  129. @ApiStatus.ScheduledForRemoval
  130. public static void registerBrewingDisplay(DefaultBrewingDisplay recipe) {
  131. BREWING_DISPLAYS.add(new LazyLoadedValue<>(() -> recipe));
  132. }
  133. public static void registerBrewingRecipe(RegisteredBrewingRecipe recipe) {
  134. BREWING_DISPLAYS.add(new LazyLoadedValue<>(() -> new DefaultBrewingDisplay(recipe.input, recipe.ingredient, recipe.output)));
  135. }
  136. public static void registerInfoDisplay(DefaultInformationDisplay display) {
  137. INFO_DISPLAYS.add(display);
  138. }
  139. @Override
  140. public void registerBrewingRecipe(ItemStack input, Ingredient ingredient, ItemStack output) {
  141. registerBrewingRecipe(new RegisteredBrewingRecipe(input, ingredient, output));
  142. }
  143. @Override
  144. public void registerInformation(List<EntryStack> entryStacks, Component name, UnaryOperator<List<Component>> textBuilder) {
  145. registerInfoDisplay(DefaultInformationDisplay.createFromEntries(entryStacks, name).lines(textBuilder.apply(Lists.newArrayList())));
  146. }
  147. @Override
  148. public ResourceLocation getPluginIdentifier() {
  149. return PLUGIN;
  150. }
  151. @Override
  152. public void preRegister() {
  153. INFO_DISPLAYS.clear();
  154. }
  155. @Override
  156. public void registerEntries(EntryRegistry entryRegistry) {
  157. for (Item item : Registry.ITEM) {
  158. List<ItemStack> stacks = null;
  159. try {
  160. stacks = entryRegistry.appendStacksForItem(item);
  161. } catch (Exception ignored) {
  162. }
  163. if (stacks != null) {
  164. for (ItemStack stack : entryRegistry.appendStacksForItem(item)) {
  165. entryRegistry.registerEntry(EntryStack.create(stack));
  166. }
  167. } else
  168. entryRegistry.registerEntry(EntryStack.create(item));
  169. }
  170. EntryStack stack = EntryStack.create(Items.ENCHANTED_BOOK);
  171. List<EntryStack> enchantments = new ArrayList<>();
  172. for (Enchantment enchantment : Registry.ENCHANTMENT) {
  173. for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); i++) {
  174. Map<Enchantment, Integer> map = new HashMap<>();
  175. map.put(enchantment, i);
  176. ItemStack itemStack = new ItemStack(Items.ENCHANTED_BOOK);
  177. EnchantmentHelper.setEnchantments(map, itemStack);
  178. enchantments.add(EntryStack.create(itemStack).setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE));
  179. }
  180. }
  181. entryRegistry.registerEntriesAfter(stack, enchantments);
  182. for (Fluid fluid : Registry.FLUID) {
  183. if (!fluid.defaultFluidState().isEmpty() && fluid.defaultFluidState().isSource())
  184. entryRegistry.registerEntry(EntryStack.create(fluid));
  185. }
  186. }
  187. @Override
  188. public void registerPluginCategories(RecipeHelper recipeHelper) {
  189. recipeHelper.registerCategories(
  190. new DefaultCraftingCategory(),
  191. new DefaultCookingCategory(SMELTING, EntryStack.create(Items.FURNACE), "category.rei.smelting"),
  192. new DefaultCookingCategory(SMOKING, EntryStack.create(Items.SMOKER), "category.rei.smoking"),
  193. new DefaultCookingCategory(BLASTING, EntryStack.create(Items.BLAST_FURNACE), "category.rei.blasting"), new DefaultCampfireCategory(),
  194. new DefaultStoneCuttingCategory(),
  195. new DefaultFuelCategory(),
  196. new DefaultBrewingCategory(),
  197. new DefaultCompostingCategory(),
  198. new DefaultStrippingCategory(),
  199. new DefaultSmithingCategory(),
  200. new DefaultBeaconBaseCategory(),
  201. new DefaultBeaconPaymentCategory(),
  202. new DefaultTillingCategory(),
  203. new DefaultPathingCategory(),
  204. new DefaultInformationCategory()
  205. );
  206. }
  207. @Override
  208. public void registerRecipeDisplays(RecipeHelper recipeHelper) {
  209. recipeHelper.registerRecipes(CRAFTING, ShapelessRecipe.class, DefaultShapelessDisplay::new);
  210. recipeHelper.registerRecipes(CRAFTING, ShapedRecipe.class, DefaultShapedDisplay::new);
  211. recipeHelper.registerRecipes(SMELTING, SmeltingRecipe.class, DefaultSmeltingDisplay::new);
  212. recipeHelper.registerRecipes(SMOKING, SmokingRecipe.class, DefaultSmokingDisplay::new);
  213. recipeHelper.registerRecipes(BLASTING, BlastingRecipe.class, DefaultBlastingDisplay::new);
  214. recipeHelper.registerRecipes(CAMPFIRE, CampfireCookingRecipe.class, DefaultCampfireDisplay::new);
  215. recipeHelper.registerRecipes(STONE_CUTTING, StonecutterRecipe.class, DefaultStoneCuttingDisplay::new);
  216. recipeHelper.registerRecipes(SMITHING, UpgradeRecipe.class, DefaultSmithingDisplay::new);
  217. for (LazyLoadedValue<DefaultBrewingDisplay> display : BREWING_DISPLAYS) {
  218. recipeHelper.registerDisplay(display.get());
  219. }
  220. for (Map.Entry<Item, Integer> entry : AbstractFurnaceBlockEntity.getFuel().entrySet()) {
  221. recipeHelper.registerDisplay(new DefaultFuelDisplay(EntryStack.create(entry.getKey()), entry.getValue()));
  222. }
  223. List<EntryStack> arrowStack = Collections.singletonList(EntryStack.create(Items.ARROW));
  224. EntryRegistry.getInstance().getEntryStacks().filter(entry -> entry.getItem() == Items.LINGERING_POTION).forEach(entry -> {
  225. List<List<EntryStack>> input = new ArrayList<>();
  226. for (int i = 0; i < 4; i++)
  227. input.add(arrowStack);
  228. input.add(Collections.singletonList(EntryStack.create(entry.getItemStack())));
  229. for (int i = 0; i < 4; i++)
  230. input.add(arrowStack);
  231. ItemStack outputStack = new ItemStack(Items.TIPPED_ARROW, 8);
  232. PotionUtils.setPotion(outputStack, PotionUtils.getPotion(entry.getItemStack()));
  233. PotionUtils.setCustomEffects(outputStack, PotionUtils.getCustomEffects(entry.getItemStack()));
  234. List<EntryStack> output = Collections.singletonList(EntryStack.create(outputStack).addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE));
  235. recipeHelper.registerDisplay(new DefaultCustomDisplay(null, input, output));
  236. });
  237. Map<ItemLike, Float> map = Maps.newLinkedHashMap();
  238. if (ComposterBlock.COMPOSTABLES.isEmpty())
  239. ComposterBlock.bootStrap();
  240. for (Object2FloatMap.Entry<ItemLike> entry : ComposterBlock.COMPOSTABLES.object2FloatEntrySet()) {
  241. if (entry.getFloatValue() > 0)
  242. map.put(entry.getKey(), entry.getFloatValue());
  243. }
  244. List<ItemLike> stacks = Lists.newArrayList(map.keySet());
  245. stacks.sort(Comparator.comparing(map::get));
  246. for (int i = 0; i < stacks.size(); i += Mth.clamp(48, 1, stacks.size() - i)) {
  247. List<ItemLike> thisStacks = Lists.newArrayList();
  248. for (int j = i; j < i + 48; j++)
  249. if (j < stacks.size())
  250. thisStacks.add(stacks.get(j));
  251. recipeHelper.registerDisplay(new DefaultCompostingDisplay(Mth.floor(i / 48f), thisStacks, map, new ItemStack(Items.BONE_MEAL)));
  252. }
  253. DummyAxeItem.getStrippedBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
  254. recipeHelper.registerDisplay(new DefaultStrippingDisplay(EntryStack.create(set.getKey()), EntryStack.create(set.getValue())));
  255. });
  256. DummyHoeItem.getTilledBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
  257. recipeHelper.registerDisplay(new DefaultTillingDisplay(EntryStack.create(set.getKey()), EntryStack.create(set.getValue().getBlock())));
  258. });
  259. DummyShovelItem.getPathBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getKey(b.getKey()))).forEach(set -> {
  260. recipeHelper.registerDisplay(new DefaultPathingDisplay(EntryStack.create(set.getKey()), EntryStack.create(set.getValue().getBlock())));
  261. });
  262. recipeHelper.registerDisplay(new DefaultBeaconBaseDisplay(CollectionUtils.map(Lists.newArrayList(BlockTags.BEACON_BASE_BLOCKS.getValues()), ItemStack::new)));
  263. recipeHelper.registerDisplay(new DefaultBeaconPaymentDisplay(CollectionUtils.map(Lists.newArrayList(ItemTags.BEACON_PAYMENT_ITEMS.getValues()), ItemStack::new)));
  264. }
  265. @Override
  266. public void postRegister() {
  267. for (DefaultInformationDisplay display : INFO_DISPLAYS)
  268. RecipeHelper.getInstance().registerDisplay(display);
  269. // TODO Turn this into an API
  270. // Sit tight! This will be a fast journey!
  271. long time = System.currentTimeMillis();
  272. EntryRegistry.getInstance().getEntryStacks().forEach(this::applyPotionTransformer);
  273. for (List<RecipeDisplay> displays : RecipeHelper.getInstance().getAllRecipesNoHandlers().values()) {
  274. for (RecipeDisplay display : displays) {
  275. for (List<EntryStack> entries : display.getInputEntries())
  276. for (EntryStack stack : entries)
  277. applyPotionTransformer(stack);
  278. for (List<EntryStack> entries : display.getResultingEntries())
  279. for (EntryStack stack : entries)
  280. applyPotionTransformer(stack);
  281. }
  282. }
  283. time = System.currentTimeMillis() - time;
  284. LOGGER.info("Applied Check Tags for potion in %dms.", time);
  285. }
  286. private void applyPotionTransformer(EntryStack stack) {
  287. if (stack.getItem() instanceof PotionItem)
  288. stack.addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE);
  289. }
  290. @Override
  291. public void registerBounds(DisplayHelper displayHelper) {
  292. BaseBoundsHandler baseBoundsHandler = BaseBoundsHandler.getInstance();
  293. baseBoundsHandler.registerExclusionZones(EffectRenderingInventoryScreen.class, new DefaultPotionEffectExclusionZones());
  294. baseBoundsHandler.registerExclusionZones(RecipeUpdateListener.class, new DefaultRecipeBookExclusionZones());
  295. displayHelper.registerProvider(new DisplayHelper.DisplayBoundsProvider<AbstractContainerScreen<?>>() {
  296. @Override
  297. public Rectangle getScreenBounds(AbstractContainerScreen<?> screen) {
  298. return new Rectangle(screen.leftPos, screen.topPos, screen.imageWidth, screen.imageHeight);
  299. }
  300. @Override
  301. public Class<?> getBaseSupportedClass() {
  302. return AbstractContainerScreen.class;
  303. }
  304. });
  305. }
  306. @Override
  307. public void registerOthers(RecipeHelper recipeHelper) {
  308. recipeHelper.registerAutoCraftingHandler(new DefaultRecipeBookHandler());
  309. recipeHelper.registerWorkingStations(CRAFTING, EntryStack.create(Items.CRAFTING_TABLE));
  310. recipeHelper.registerWorkingStations(SMELTING, EntryStack.create(Items.FURNACE));
  311. recipeHelper.registerWorkingStations(SMOKING, EntryStack.create(Items.SMOKER));
  312. recipeHelper.registerWorkingStations(BLASTING, EntryStack.create(Items.BLAST_FURNACE));
  313. recipeHelper.registerWorkingStations(CAMPFIRE, EntryStack.create(Items.CAMPFIRE), EntryStack.create(Items.SOUL_CAMPFIRE));
  314. recipeHelper.registerWorkingStations(FUEL, EntryStack.create(Items.FURNACE), EntryStack.create(Items.SMOKER), EntryStack.create(Items.BLAST_FURNACE));
  315. recipeHelper.registerWorkingStations(BREWING, EntryStack.create(Items.BREWING_STAND));
  316. recipeHelper.registerWorkingStations(STONE_CUTTING, EntryStack.create(Items.STONECUTTER));
  317. recipeHelper.registerWorkingStations(COMPOSTING, EntryStack.create(Items.COMPOSTER));
  318. recipeHelper.registerWorkingStations(SMITHING, EntryStack.create(Items.SMITHING_TABLE));
  319. recipeHelper.registerWorkingStations(BEACON, EntryStack.create(Items.BEACON));
  320. recipeHelper.registerWorkingStations(BEACON_PAYMENT, EntryStack.create(Items.BEACON));
  321. Tag<Item> axes = Minecraft.getInstance().getConnection().getTags().getItems().getTag(new ResourceLocation("fabric", "axes"));
  322. if (axes != null) {
  323. for (Item item : axes.getValues()) {
  324. recipeHelper.registerWorkingStations(STRIPPING, EntryStack.create(item));
  325. }
  326. }
  327. Tag<Item> hoes = Minecraft.getInstance().getConnection().getTags().getItems().getTag(new ResourceLocation("fabric", "hoes"));
  328. if (hoes != null) {
  329. for (Item item : hoes.getValues()) {
  330. recipeHelper.registerWorkingStations(TILLING, EntryStack.create(item));
  331. }
  332. }
  333. Tag<Item> shovels = Minecraft.getInstance().getConnection().getTags().getItems().getTag(new ResourceLocation("fabric", "shovels"));
  334. if (shovels != null) {
  335. for (Item item : shovels.getValues()) {
  336. recipeHelper.registerWorkingStations(PATHING, EntryStack.create(item));
  337. }
  338. }
  339. recipeHelper.removeAutoCraftButton(FUEL);
  340. recipeHelper.removeAutoCraftButton(COMPOSTING);
  341. recipeHelper.removeAutoCraftButton(BEACON);
  342. recipeHelper.removeAutoCraftButton(BEACON_PAYMENT);
  343. recipeHelper.removeAutoCraftButton(INFO);
  344. recipeHelper.registerScreenClickArea(new Rectangle(88, 32, 28, 23), CraftingScreen.class, CRAFTING);
  345. recipeHelper.registerScreenClickArea(new Rectangle(137, 29, 10, 13), InventoryScreen.class, CRAFTING);
  346. recipeHelper.registerScreenClickArea(new Rectangle(97, 16, 14, 30), BrewingStandScreen.class, BREWING);
  347. recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), FurnaceScreen.class, SMELTING);
  348. recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), SmokerScreen.class, SMOKING);
  349. recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), BlastFurnaceScreen.class, BLASTING);
  350. FluidSupportProvider.getInstance().registerFluidProvider(new FluidSupportProvider.FluidProvider() {
  351. @Override
  352. public @NotNull EntryStack itemToFluid(@NotNull EntryStack itemStack) {
  353. Item item = itemStack.getItem();
  354. if (item instanceof BucketItem)
  355. return EntryStack.create(((BucketItem) item).content, 1000);
  356. return EntryStack.empty();
  357. }
  358. });
  359. // SubsetsRegistry subsetsRegistry = SubsetsRegistry.INSTANCE;
  360. // subsetsRegistry.registerPathEntry("roughlyenoughitems:food", EntryStack.create(Items.MILK_BUCKET));
  361. // subsetsRegistry.registerPathEntry("roughlyenoughitems:food/roughlyenoughitems:cookies", EntryStack.create(Items.COOKIE));
  362. }
  363. @Override
  364. public int getPriority() {
  365. return -1;
  366. }
  367. }