DefaultPlugin.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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.Point;
  28. import me.shedaniel.math.Rectangle;
  29. import me.shedaniel.rei.RoughlyEnoughItemsCore;
  30. import me.shedaniel.rei.api.*;
  31. import me.shedaniel.rei.api.fluid.FluidSupportProvider;
  32. import me.shedaniel.rei.api.plugins.REIPluginV0;
  33. import me.shedaniel.rei.api.widgets.Panel;
  34. import me.shedaniel.rei.api.widgets.Tooltip;
  35. import me.shedaniel.rei.gui.RecipeViewingScreen;
  36. import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
  37. import me.shedaniel.rei.impl.ClientHelperImpl;
  38. import me.shedaniel.rei.impl.RenderingEntry;
  39. import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseCategory;
  40. import me.shedaniel.rei.plugin.beacon.DefaultBeaconBaseDisplay;
  41. import me.shedaniel.rei.plugin.blasting.DefaultBlastingDisplay;
  42. import me.shedaniel.rei.plugin.brewing.DefaultBrewingCategory;
  43. import me.shedaniel.rei.plugin.brewing.DefaultBrewingDisplay;
  44. import me.shedaniel.rei.plugin.campfire.DefaultCampfireCategory;
  45. import me.shedaniel.rei.plugin.campfire.DefaultCampfireDisplay;
  46. import me.shedaniel.rei.plugin.composting.DefaultCompostingCategory;
  47. import me.shedaniel.rei.plugin.composting.DefaultCompostingDisplay;
  48. import me.shedaniel.rei.plugin.cooking.DefaultCookingCategory;
  49. import me.shedaniel.rei.plugin.crafting.DefaultCraftingCategory;
  50. import me.shedaniel.rei.plugin.crafting.DefaultCustomDisplay;
  51. import me.shedaniel.rei.plugin.crafting.DefaultShapedDisplay;
  52. import me.shedaniel.rei.plugin.crafting.DefaultShapelessDisplay;
  53. import me.shedaniel.rei.plugin.fuel.DefaultFuelCategory;
  54. import me.shedaniel.rei.plugin.fuel.DefaultFuelDisplay;
  55. import me.shedaniel.rei.plugin.information.DefaultInformationCategory;
  56. import me.shedaniel.rei.plugin.information.DefaultInformationDisplay;
  57. import me.shedaniel.rei.plugin.smelting.DefaultSmeltingDisplay;
  58. import me.shedaniel.rei.plugin.smoking.DefaultSmokingDisplay;
  59. import me.shedaniel.rei.plugin.stonecutting.DefaultStoneCuttingCategory;
  60. import me.shedaniel.rei.plugin.stonecutting.DefaultStoneCuttingDisplay;
  61. import me.shedaniel.rei.plugin.stripping.DefaultStrippingCategory;
  62. import me.shedaniel.rei.plugin.stripping.DefaultStrippingDisplay;
  63. import me.shedaniel.rei.plugin.stripping.DummyAxeItem;
  64. import me.shedaniel.rei.utils.CollectionUtils;
  65. import net.minecraft.block.ComposterBlock;
  66. import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
  67. import net.minecraft.client.MinecraftClient;
  68. import net.minecraft.client.gui.screen.ingame.*;
  69. import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
  70. import net.minecraft.client.util.math.MatrixStack;
  71. import net.minecraft.enchantment.Enchantment;
  72. import net.minecraft.enchantment.EnchantmentHelper;
  73. import net.minecraft.fluid.Fluid;
  74. import net.minecraft.item.*;
  75. import net.minecraft.potion.PotionUtil;
  76. import net.minecraft.recipe.*;
  77. import net.minecraft.tag.BlockTags;
  78. import net.minecraft.tag.Tag;
  79. import net.minecraft.text.LiteralText;
  80. import net.minecraft.util.Identifier;
  81. import net.minecraft.util.math.MathHelper;
  82. import net.minecraft.util.registry.Registry;
  83. import org.jetbrains.annotations.NotNull;
  84. import org.jetbrains.annotations.Nullable;
  85. import java.util.*;
  86. public class DefaultPlugin implements REIPluginV0 {
  87. public static final Identifier CRAFTING = new Identifier("minecraft", "plugins/crafting");
  88. public static final Identifier SMELTING = new Identifier("minecraft", "plugins/smelting");
  89. public static final Identifier SMOKING = new Identifier("minecraft", "plugins/smoking");
  90. public static final Identifier BLASTING = new Identifier("minecraft", "plugins/blasting");
  91. public static final Identifier CAMPFIRE = new Identifier("minecraft", "plugins/campfire");
  92. public static final Identifier STONE_CUTTING = new Identifier("minecraft", "plugins/stone_cutting");
  93. public static final Identifier STRIPPING = new Identifier("minecraft", "plugins/stripping");
  94. public static final Identifier BREWING = new Identifier("minecraft", "plugins/brewing");
  95. public static final Identifier PLUGIN = new Identifier("roughlyenoughitems", "default_plugin");
  96. public static final Identifier COMPOSTING = new Identifier("minecraft", "plugins/composting");
  97. public static final Identifier FUEL = new Identifier("minecraft", "plugins/fuel");
  98. public static final Identifier BEACON = new Identifier("minecraft", "plugins/beacon");
  99. public static final Identifier INFO = new Identifier("roughlyenoughitems", "plugins/information");
  100. private static final Identifier DISPLAY_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/display.png");
  101. private static final Identifier DISPLAY_TEXTURE_DARK = new Identifier("roughlyenoughitems", "textures/gui/display_dark.png");
  102. private static final List<DefaultBrewingDisplay> BREWING_DISPLAYS = Lists.newArrayList();
  103. private static final List<DefaultInformationDisplay> INFO_DISPLAYS = Lists.newArrayList();
  104. public static Identifier getDisplayTexture() {
  105. return REIHelper.getInstance().isDarkThemeEnabled() ? DISPLAY_TEXTURE_DARK : DISPLAY_TEXTURE;
  106. }
  107. public static void registerBrewingDisplay(DefaultBrewingDisplay display) {
  108. BREWING_DISPLAYS.add(display);
  109. }
  110. public static void registerInfoDisplay(DefaultInformationDisplay display) {
  111. INFO_DISPLAYS.add(display);
  112. }
  113. @Override
  114. public Identifier getPluginIdentifier() {
  115. return PLUGIN;
  116. }
  117. @Override
  118. public void preRegister() {
  119. INFO_DISPLAYS.clear();
  120. }
  121. @Override
  122. public void registerEntries(EntryRegistry entryRegistry) {
  123. if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
  124. return;
  125. }
  126. for (Item item : Registry.ITEM) {
  127. List<ItemStack> stacks = null;
  128. try {
  129. stacks = entryRegistry.appendStacksForItem(item);
  130. } catch (Exception ignored) {
  131. }
  132. if (stacks != null) {
  133. for (ItemStack stack : entryRegistry.appendStacksForItem(item)) {
  134. entryRegistry.registerEntry(EntryStack.create(stack));
  135. }
  136. } else
  137. entryRegistry.registerEntry(EntryStack.create(item));
  138. }
  139. EntryStack stack = EntryStack.create(Items.ENCHANTED_BOOK);
  140. List<EntryStack> enchantments = new ArrayList<>();
  141. for (Enchantment enchantment : Registry.ENCHANTMENT) {
  142. for (int i = enchantment.getMinimumLevel(); i <= enchantment.getMaximumLevel(); i++) {
  143. Map<Enchantment, Integer> map = new HashMap<>();
  144. map.put(enchantment, i);
  145. ItemStack itemStack = new ItemStack(Items.ENCHANTED_BOOK);
  146. EnchantmentHelper.set(map, itemStack);
  147. enchantments.add(EntryStack.create(itemStack).setting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE));
  148. }
  149. }
  150. entryRegistry.queueRegisterEntryAfter(stack, enchantments);
  151. for (Fluid fluid : Registry.FLUID) {
  152. if (!fluid.getDefaultState().isEmpty() && fluid.getDefaultState().isStill())
  153. entryRegistry.registerEntry(EntryStack.create(fluid));
  154. }
  155. entryRegistry.registerEntry(new RenderingEntry() {
  156. private Identifier id = new Identifier("roughlyenoughitems", "textures/gui/kirb.png");
  157. @Override
  158. public void render(MatrixStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
  159. MinecraftClient.getInstance().getTextureManager().bindTexture(id);
  160. drawTexturedQuad(matrices.peek().getModel(), bounds.x, bounds.getMaxX(), bounds.y, bounds.getMaxY(), getZOffset(), 0, 1, 0, 1);
  161. }
  162. @Override
  163. public boolean isEmpty() {
  164. return !((ClientHelperImpl) ClientHelper.getInstance()).isAprilFools.get();
  165. }
  166. @Override
  167. public @Nullable Tooltip getTooltip(Point point) {
  168. return Tooltip.create(new LiteralText("Kibby"));
  169. }
  170. });
  171. }
  172. @Override
  173. public void registerPluginCategories(RecipeHelper recipeHelper) {
  174. if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
  175. return;
  176. }
  177. recipeHelper.registerCategory(new DefaultCraftingCategory());
  178. recipeHelper.registerCategory(new DefaultCookingCategory(SMELTING, EntryStack.create(Items.FURNACE), "category.rei.smelting"));
  179. recipeHelper.registerCategory(new DefaultCookingCategory(SMOKING, EntryStack.create(Items.SMOKER), "category.rei.smoking"));
  180. recipeHelper.registerCategory(new DefaultCookingCategory(BLASTING, EntryStack.create(Items.BLAST_FURNACE), "category.rei.blasting"));
  181. recipeHelper.registerCategory(new DefaultCampfireCategory());
  182. recipeHelper.registerCategory(new DefaultStoneCuttingCategory());
  183. recipeHelper.registerCategory(new DefaultFuelCategory());
  184. recipeHelper.registerCategory(new DefaultBrewingCategory());
  185. recipeHelper.registerCategory(new DefaultCompostingCategory());
  186. recipeHelper.registerCategory(new DefaultStrippingCategory());
  187. recipeHelper.registerCategory(new DefaultBeaconBaseCategory());
  188. recipeHelper.registerCategory(new DefaultInformationCategory());
  189. }
  190. @Override
  191. public void registerRecipeDisplays(RecipeHelper recipeHelper) {
  192. if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
  193. return;
  194. }
  195. recipeHelper.registerRecipes(CRAFTING, ShapelessRecipe.class, DefaultShapelessDisplay::new);
  196. recipeHelper.registerRecipes(CRAFTING, ShapedRecipe.class, DefaultShapedDisplay::new);
  197. recipeHelper.registerRecipes(SMELTING, SmeltingRecipe.class, DefaultSmeltingDisplay::new);
  198. recipeHelper.registerRecipes(SMOKING, SmokingRecipe.class, DefaultSmokingDisplay::new);
  199. recipeHelper.registerRecipes(BLASTING, BlastingRecipe.class, DefaultBlastingDisplay::new);
  200. recipeHelper.registerRecipes(CAMPFIRE, CampfireCookingRecipe.class, DefaultCampfireDisplay::new);
  201. recipeHelper.registerRecipes(STONE_CUTTING, StonecuttingRecipe.class, DefaultStoneCuttingDisplay::new);
  202. for (DefaultBrewingDisplay display : BREWING_DISPLAYS) {
  203. recipeHelper.registerDisplay(display);
  204. }
  205. for (Map.Entry<Item, Integer> entry : AbstractFurnaceBlockEntity.createFuelTimeMap().entrySet()) {
  206. recipeHelper.registerDisplay(new DefaultFuelDisplay(EntryStack.create(entry.getKey()), entry.getValue()));
  207. }
  208. List<EntryStack> arrowStack = Collections.singletonList(EntryStack.create(Items.ARROW));
  209. for (EntryStack entry : EntryRegistry.getInstance().getStacksList()) {
  210. if (entry.getItem() == Items.LINGERING_POTION) {
  211. List<List<EntryStack>> input = new ArrayList<>();
  212. for (int i = 0; i < 4; i++)
  213. input.add(arrowStack);
  214. input.add(Collections.singletonList(EntryStack.create(entry.getItemStack())));
  215. for (int i = 0; i < 4; i++)
  216. input.add(arrowStack);
  217. ItemStack outputStack = new ItemStack(Items.TIPPED_ARROW, 8);
  218. PotionUtil.setPotion(outputStack, PotionUtil.getPotion(entry.getItemStack()));
  219. PotionUtil.setCustomPotionEffects(outputStack, PotionUtil.getCustomPotionEffects(entry.getItemStack()));
  220. List<EntryStack> output = Collections.singletonList(EntryStack.create(outputStack).addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE));
  221. recipeHelper.registerDisplay(new DefaultCustomDisplay(null, input, output));
  222. }
  223. }
  224. Map<ItemConvertible, Float> map = Maps.newLinkedHashMap();
  225. if (ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.isEmpty())
  226. ComposterBlock.registerDefaultCompostableItems();
  227. for (Object2FloatMap.Entry<ItemConvertible> entry : ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.object2FloatEntrySet()) {
  228. if (entry.getFloatValue() > 0)
  229. map.put(entry.getKey(), entry.getFloatValue());
  230. }
  231. List<ItemConvertible> stacks = new LinkedList<>(map.keySet());
  232. stacks.sort((first, second) -> (int) ((map.get(first) - map.get(second)) * 100));
  233. for (int i = 0; i < stacks.size(); i += MathHelper.clamp(48, 1, stacks.size() - i)) {
  234. List<ItemConvertible> thisStacks = Lists.newArrayList();
  235. for (int j = i; j < i + 48; j++)
  236. if (j < stacks.size())
  237. thisStacks.add(stacks.get(j));
  238. recipeHelper.registerDisplay(new DefaultCompostingDisplay(MathHelper.floor(i / 48f), thisStacks, map, Lists.newArrayList(map.keySet()), new ItemStack[]{new ItemStack(Items.BONE_MEAL)}));
  239. }
  240. DummyAxeItem.getStrippedBlocksMap().entrySet().stream().sorted(Comparator.comparing(b -> Registry.BLOCK.getId(b.getKey()))).forEach(set -> {
  241. recipeHelper.registerDisplay(new DefaultStrippingDisplay(new ItemStack(set.getKey()), new ItemStack(set.getValue())));
  242. });
  243. recipeHelper.registerDisplay(new DefaultBeaconBaseDisplay(CollectionUtils.map(Lists.newArrayList(BlockTags.BEACON_BASE_BLOCKS.values()), ItemStack::new)));
  244. }
  245. @Override
  246. public void postRegister() {
  247. for (DefaultInformationDisplay display : INFO_DISPLAYS)
  248. RecipeHelper.getInstance().registerDisplay(display);
  249. // Sit tight! This will be a fast journey!
  250. long time = System.currentTimeMillis();
  251. for (EntryStack stack : EntryRegistry.getInstance().getStacksList())
  252. applyPotionTransformer(stack);
  253. for (List<RecipeDisplay> displays : RecipeHelper.getInstance().getAllRecipesNoHandlers().values()) {
  254. for (RecipeDisplay display : displays) {
  255. for (List<EntryStack> entries : display.getInputEntries())
  256. for (EntryStack stack : entries)
  257. applyPotionTransformer(stack);
  258. for (EntryStack stack : display.getOutputEntries())
  259. applyPotionTransformer(stack);
  260. }
  261. }
  262. time = System.currentTimeMillis() - time;
  263. RoughlyEnoughItemsCore.LOGGER.info("Applied Check Tags for potion in %dms.", time);
  264. }
  265. private void applyPotionTransformer(EntryStack stack) {
  266. if (stack.getItem() instanceof PotionItem)
  267. stack.addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE);
  268. }
  269. @Override
  270. public void registerBounds(DisplayHelper displayHelper) {
  271. if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
  272. return;
  273. }
  274. BaseBoundsHandler baseBoundsHandler = BaseBoundsHandler.getInstance();
  275. baseBoundsHandler.registerExclusionZones(AbstractInventoryScreen.class, new DefaultPotionEffectExclusionZones());
  276. baseBoundsHandler.registerExclusionZones(RecipeBookProvider.class, new DefaultRecipeBookExclusionZones());
  277. baseBoundsHandler.registerExclusionZones(RecipeViewingScreen.class, () -> {
  278. Panel widget = ((RecipeViewingScreen) MinecraftClient.getInstance().currentScreen).getWorkingStationsBaseWidget();
  279. if (widget == null)
  280. return Collections.emptyList();
  281. return Collections.singletonList(widget.getBounds().clone());
  282. });
  283. displayHelper.registerHandler(new DisplayHelper.DisplayBoundsHandler<ContainerScreen<?>>() {
  284. @Override
  285. public Class<?> getBaseSupportedClass() {
  286. return ContainerScreen.class;
  287. }
  288. @Override
  289. public Rectangle getLeftBounds(ContainerScreen<?> screen) {
  290. return new Rectangle(2, 0, screen.x - 4, screen.height);
  291. }
  292. @Override
  293. public Rectangle getRightBounds(ContainerScreen<?> screen) {
  294. int startX = screen.x + screen.containerWidth + 2;
  295. return new Rectangle(startX, 0, screen.width - startX - 2, screen.height);
  296. }
  297. @Override
  298. public float getPriority() {
  299. return -1.0f;
  300. }
  301. });
  302. displayHelper.registerHandler(new DisplayHelper.DisplayBoundsHandler<RecipeViewingScreen>() {
  303. @Override
  304. public Class<?> getBaseSupportedClass() {
  305. return RecipeViewingScreen.class;
  306. }
  307. @Override
  308. public Rectangle getLeftBounds(RecipeViewingScreen screen) {
  309. return new Rectangle(2, 0, screen.getBounds().x - 4, MinecraftClient.getInstance().getWindow().getScaledHeight());
  310. }
  311. @Override
  312. public Rectangle getRightBounds(RecipeViewingScreen screen) {
  313. int startX = screen.getBounds().x + screen.getBounds().width + 2;
  314. return new Rectangle(startX, 0, MinecraftClient.getInstance().getWindow().getScaledWidth() - startX - 2, MinecraftClient.getInstance().getWindow().getScaledHeight());
  315. }
  316. @Override
  317. public float getPriority() {
  318. return -1.0f;
  319. }
  320. });
  321. displayHelper.registerHandler(new DisplayHelper.DisplayBoundsHandler<VillagerRecipeViewingScreen>() {
  322. @Override
  323. public Class<?> getBaseSupportedClass() {
  324. return VillagerRecipeViewingScreen.class;
  325. }
  326. @Override
  327. public Rectangle getLeftBounds(VillagerRecipeViewingScreen screen) {
  328. return new Rectangle(2, 0, screen.bounds.x - 4, MinecraftClient.getInstance().getWindow().getScaledHeight());
  329. }
  330. @Override
  331. public Rectangle getRightBounds(VillagerRecipeViewingScreen screen) {
  332. int startX = screen.bounds.x + screen.bounds.width + 2;
  333. return new Rectangle(startX, 0, MinecraftClient.getInstance().getWindow().getScaledWidth() - startX - 2, MinecraftClient.getInstance().getWindow().getScaledHeight());
  334. }
  335. @Override
  336. public float getPriority() {
  337. return -1.0f;
  338. }
  339. });
  340. }
  341. @Override
  342. public void registerOthers(RecipeHelper recipeHelper) {
  343. if (!ConfigObject.getInstance().isLoadingDefaultPlugin()) {
  344. return;
  345. }
  346. recipeHelper.registerWorkingStations(CRAFTING, EntryStack.create(Items.CRAFTING_TABLE));
  347. recipeHelper.registerWorkingStations(SMELTING, EntryStack.create(Items.FURNACE));
  348. recipeHelper.registerWorkingStations(SMOKING, EntryStack.create(Items.SMOKER));
  349. recipeHelper.registerWorkingStations(BLASTING, EntryStack.create(Items.BLAST_FURNACE));
  350. recipeHelper.registerWorkingStations(CAMPFIRE, EntryStack.create(Items.CAMPFIRE));
  351. recipeHelper.registerWorkingStations(FUEL, EntryStack.create(Items.FURNACE), EntryStack.create(Items.SMOKER), EntryStack.create(Items.BLAST_FURNACE));
  352. recipeHelper.registerWorkingStations(BREWING, EntryStack.create(Items.BREWING_STAND));
  353. recipeHelper.registerWorkingStations(STONE_CUTTING, EntryStack.create(Items.STONECUTTER));
  354. recipeHelper.registerWorkingStations(COMPOSTING, EntryStack.create(Items.COMPOSTER));
  355. recipeHelper.registerWorkingStations(BEACON, EntryStack.create(Items.BEACON));
  356. Tag<Item> axes = MinecraftClient.getInstance().getNetworkHandler().getTagManager().items().get(new Identifier("fabric", "axes"));
  357. if (axes != null) {
  358. for (Item item : axes.values()) {
  359. recipeHelper.registerWorkingStations(STRIPPING, EntryStack.create(item));
  360. }
  361. }
  362. recipeHelper.removeAutoCraftButton(FUEL);
  363. recipeHelper.removeAutoCraftButton(COMPOSTING);
  364. recipeHelper.removeAutoCraftButton(BEACON);
  365. recipeHelper.removeAutoCraftButton(INFO);
  366. recipeHelper.registerScreenClickArea(new Rectangle(88, 32, 28, 23), CraftingTableScreen.class, CRAFTING);
  367. recipeHelper.registerScreenClickArea(new Rectangle(137, 29, 10, 13), InventoryScreen.class, CRAFTING);
  368. recipeHelper.registerScreenClickArea(new Rectangle(97, 16, 14, 30), BrewingStandScreen.class, BREWING);
  369. recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), FurnaceScreen.class, SMELTING);
  370. recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), SmokerScreen.class, SMOKING);
  371. recipeHelper.registerScreenClickArea(new Rectangle(78, 32, 28, 23), BlastFurnaceScreen.class, BLASTING);
  372. FluidSupportProvider.INSTANCE.registerFluidProvider(new FluidSupportProvider.FluidProvider() {
  373. @Override
  374. public @NotNull EntryStack fluidToItem(@NotNull EntryStack fluidStack) {
  375. Fluid fluid = fluidStack.getFluid();
  376. Item item = fluid.getBucketItem();
  377. if (item == null)
  378. return EntryStack.empty();
  379. return EntryStack.create(item);
  380. }
  381. @Override
  382. public @NotNull EntryStack itemToFluid(@NotNull EntryStack itemStack) {
  383. Item item = itemStack.getItem();
  384. if (item instanceof BucketItem)
  385. return EntryStack.create(((BucketItem) item).fluid, 1000);
  386. return EntryStack.empty();
  387. }
  388. });
  389. // SubsetsRegistry subsetsRegistry = SubsetsRegistry.INSTANCE;
  390. // subsetsRegistry.registerPathEntry("roughlyenoughitems:food", EntryStack.create(Items.MILK_BUCKET));
  391. // subsetsRegistry.registerPathEntry("roughlyenoughitems:food/roughlyenoughitems:cookies", EntryStack.create(Items.COOKIE));
  392. }
  393. @Override
  394. public int getPriority() {
  395. return -1;
  396. }
  397. }