|
@@ -10,10 +10,7 @@ import com.google.common.collect.Maps;
|
|
|
import it.unimi.dsi.fastutil.objects.Object2FloatMap;
|
|
|
import me.shedaniel.math.api.Rectangle;
|
|
|
import me.shedaniel.rei.RoughlyEnoughItemsCore;
|
|
|
-import me.shedaniel.rei.api.DisplayHelper;
|
|
|
-import me.shedaniel.rei.api.EntryRegistry;
|
|
|
-import me.shedaniel.rei.api.EntryStack;
|
|
|
-import me.shedaniel.rei.api.RecipeHelper;
|
|
|
+import me.shedaniel.rei.api.*;
|
|
|
import me.shedaniel.rei.api.plugins.REIPluginV0;
|
|
|
import me.shedaniel.rei.gui.RecipeViewingScreen;
|
|
|
import me.shedaniel.rei.gui.VillagerRecipeViewingScreen;
|
|
@@ -47,10 +44,7 @@ import net.minecraft.enchantment.Enchantment;
|
|
|
import net.minecraft.enchantment.EnchantmentHelper;
|
|
|
import net.minecraft.fluid.EmptyFluid;
|
|
|
import net.minecraft.fluid.Fluid;
|
|
|
-import net.minecraft.item.Item;
|
|
|
-import net.minecraft.item.ItemConvertible;
|
|
|
-import net.minecraft.item.ItemStack;
|
|
|
-import net.minecraft.item.Items;
|
|
|
+import net.minecraft.item.*;
|
|
|
import net.minecraft.potion.PotionUtil;
|
|
|
import net.minecraft.recipe.*;
|
|
|
import net.minecraft.util.Identifier;
|
|
@@ -95,7 +89,7 @@ public class DefaultPlugin implements REIPluginV0 {
|
|
|
|
|
|
@Override
|
|
|
public void registerEntries(EntryRegistry entryRegistry) {
|
|
|
- if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isLoadingDefaultPlugin()) {
|
|
|
+ if (!ConfigManager.getInstance().getConfig().isLoadingDefaultPlugin()) {
|
|
|
return;
|
|
|
}
|
|
|
for (Item item : Registry.ITEM) {
|
|
@@ -124,7 +118,7 @@ public class DefaultPlugin implements REIPluginV0 {
|
|
|
|
|
|
@Override
|
|
|
public void registerPluginCategories(RecipeHelper recipeHelper) {
|
|
|
- if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isLoadingDefaultPlugin()) {
|
|
|
+ if (!ConfigManager.getInstance().getConfig().isLoadingDefaultPlugin()) {
|
|
|
return;
|
|
|
}
|
|
|
recipeHelper.registerCategory(new DefaultCraftingCategory());
|
|
@@ -140,7 +134,7 @@ public class DefaultPlugin implements REIPluginV0 {
|
|
|
|
|
|
@Override
|
|
|
public void registerRecipeDisplays(RecipeHelper recipeHelper) {
|
|
|
- if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isLoadingDefaultPlugin()) {
|
|
|
+ if (!ConfigManager.getInstance().getConfig().isLoadingDefaultPlugin()) {
|
|
|
return;
|
|
|
}
|
|
|
recipeHelper.registerRecipes(CRAFTING, ShapelessRecipe.class, DefaultShapelessDisplay::new);
|
|
@@ -154,7 +148,7 @@ public class DefaultPlugin implements REIPluginV0 {
|
|
|
recipeHelper.registerDisplay(BREWING, display);
|
|
|
}
|
|
|
List<EntryStack> arrowStack = Collections.singletonList(EntryStack.create(Items.ARROW));
|
|
|
- for (EntryStack entry : RoughlyEnoughItemsCore.getEntryRegistry().getStacksList()) {
|
|
|
+ for (EntryStack entry : EntryRegistry.getInstance().getStacksList()) {
|
|
|
if (entry.getItem() == Items.LINGERING_POTION) {
|
|
|
List<List<EntryStack>> input = new ArrayList<>();
|
|
|
for (int i = 0; i < 4; i++)
|
|
@@ -192,9 +186,33 @@ public class DefaultPlugin implements REIPluginV0 {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void postRegister() {
|
|
|
+ // Sit tight! This will be a fast journey!
|
|
|
+ long time = System.currentTimeMillis();
|
|
|
+ for (EntryStack stack : EntryRegistry.getInstance().getStacksList())
|
|
|
+ applyPotionTransformer(stack);
|
|
|
+ for (List<RecipeDisplay> displays : RecipeHelper.getInstance().getAllRecipes().values()) {
|
|
|
+ for (RecipeDisplay display : displays) {
|
|
|
+ for (List<EntryStack> entries : display.getInputEntries())
|
|
|
+ for (EntryStack stack : entries)
|
|
|
+ applyPotionTransformer(stack);
|
|
|
+ for (EntryStack stack : display.getOutputEntries())
|
|
|
+ applyPotionTransformer(stack);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ time = System.currentTimeMillis() - time;
|
|
|
+ RoughlyEnoughItemsCore.LOGGER.info("[REI] Applied Check Tags for potion in %dms.", time);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void applyPotionTransformer(EntryStack stack) {
|
|
|
+ if (stack.getItem() instanceof PotionItem)
|
|
|
+ stack.addSetting(EntryStack.Settings.CHECK_TAGS, EntryStack.Settings.TRUE);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void registerBounds(DisplayHelper displayHelper) {
|
|
|
- if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isLoadingDefaultPlugin()) {
|
|
|
+ if (!ConfigManager.getInstance().getConfig().isLoadingDefaultPlugin()) {
|
|
|
return;
|
|
|
}
|
|
|
displayHelper.getBaseBoundsHandler().registerExclusionZones(AbstractInventoryScreen.class, new DefaultPotionEffectExclusionZones());
|
|
@@ -269,7 +287,7 @@ public class DefaultPlugin implements REIPluginV0 {
|
|
|
|
|
|
@Override
|
|
|
public void registerOthers(RecipeHelper recipeHelper) {
|
|
|
- if (!RoughlyEnoughItemsCore.getConfigManager().getConfig().isLoadingDefaultPlugin()) {
|
|
|
+ if (!ConfigManager.getInstance().getConfig().isLoadingDefaultPlugin()) {
|
|
|
return;
|
|
|
}
|
|
|
recipeHelper.registerWorkingStations(CRAFTING, EntryStack.create(Items.CRAFTING_TABLE));
|