Anvils fix
This commit is contained in:
parent
193fc41fb7
commit
1342326e70
9 changed files with 62 additions and 97 deletions
|
@ -5,6 +5,7 @@ import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
|
|||
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
|
||||
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
|
||||
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
|
||||
import me.shedaniel.rei.api.common.display.Display;
|
||||
import me.shedaniel.rei.api.common.entry.EntryIngredient;
|
||||
import me.shedaniel.rei.api.common.entry.EntryStack;
|
||||
import me.shedaniel.rei.api.common.util.EntryIngredients;
|
||||
|
@ -12,6 +13,7 @@ import me.shedaniel.rei.api.common.util.EntryStacks;
|
|||
import me.shedaniel.rei.plugin.common.DefaultPlugin;
|
||||
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.BlastingRecipe;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
@ -24,38 +26,17 @@ import ru.betterend.recipe.builders.InfusionRecipe;
|
|||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
//https://github.com/shedaniel/RoughlyEnoughItems/blob/6.x-1.17/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
|
||||
public class REIPlugin implements REIClientPlugin {
|
||||
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");
|
||||
public final static CategoryIdentifier ALLOYING_FUEL = CategoryIdentifier.of(BetterEnd.MOD_ID, "alloying_fuel");
|
||||
public final static CategoryIdentifier ALLOYING = CategoryIdentifier.of(BetterEnd.MOD_ID, AlloyingRecipe.GROUP);
|
||||
public final static CategoryIdentifier SMITHING = CategoryIdentifier.of(BetterEnd.MOD_ID, AnvilRecipe.ID.getPath());
|
||||
public final static CategoryIdentifier INFUSION = CategoryIdentifier.of(BetterEnd.MOD_ID, InfusionRecipe.GROUP);
|
||||
|
||||
private EntryStack END_STONE_SMELTER;
|
||||
private EntryStack INFUSION_RITUAL;
|
||||
private EntryStack[] ANVILS;
|
||||
private EntryStack[] FURNACES;
|
||||
|
||||
void init() {
|
||||
//we need to initialize those variables after the static initialization
|
||||
//otherwise the registry does not know the BlockItems
|
||||
if (END_STONE_SMELTER != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
END_STONE_SMELTER = EntryStacks.of(EndBlocks.END_STONE_SMELTER);
|
||||
INFUSION_RITUAL = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL);
|
||||
|
||||
List<EntryStack> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(EndAnvilBlock.class::isInstance).collect(Collectors.toList())));
|
||||
anvils.add(0, EntryStacks.of(Blocks.ANVIL));
|
||||
ANVILS = anvils.toArray(new EntryStack[0]);
|
||||
|
||||
FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(BaseFurnaceBlock.class::isInstance).collect(Collectors.toList()))).toArray(new EntryStack[0]);
|
||||
}
|
||||
public final static CategoryIdentifier<REIAlloyingFuelDisplay> ALLOYING_FUEL = CategoryIdentifier.of(BetterEnd.MOD_ID, "alloying_fuel");
|
||||
public final static CategoryIdentifier<REIAlloyingDisplay> ALLOYING = CategoryIdentifier.of(BetterEnd.MOD_ID, AlloyingRecipe.GROUP);
|
||||
public final static CategoryIdentifier<REIAnvilDisplay> SMITHING = CategoryIdentifier.of(BetterEnd.MOD_ID, AnvilRecipe.ID.getPath());
|
||||
public final static CategoryIdentifier<REIInfusionDisplay> INFUSION = CategoryIdentifier.of(BetterEnd.MOD_ID, InfusionRecipe.GROUP);
|
||||
|
||||
@Override
|
||||
public void registerDisplays(DisplayRegistry registry) {
|
||||
|
@ -66,7 +47,7 @@ public class REIPlugin implements REIClientPlugin {
|
|||
|
||||
FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
|
||||
if (time >= 2000) {
|
||||
final List<EntryIngredient> list = Arrays.asList(EntryIngredients.of(item));
|
||||
final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
|
||||
registry.add(new REIAlloyingFuelDisplay(list, time));
|
||||
}
|
||||
});
|
||||
|
@ -74,18 +55,24 @@ public class REIPlugin implements REIClientPlugin {
|
|||
|
||||
@Override
|
||||
public void registerCategories(CategoryRegistry registry) {
|
||||
init();
|
||||
EntryStack<ItemStack> endStoneSmelter = EntryStacks.of(EndBlocks.END_STONE_SMELTER);
|
||||
EntryStack<ItemStack> infusionRitual = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL);
|
||||
List<EntryStack<?>> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(EndAnvilBlock.class::isInstance).collect(Collectors.toList())));
|
||||
anvils.add(0, EntryStacks.of(Blocks.ANVIL));
|
||||
List<EntryStack<?>> furnaces = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(BaseFurnaceBlock.class::isInstance).collect(Collectors.toList())));
|
||||
EntryStack<?>[] anvilsArray = anvils.toArray(new EntryStack[0]);
|
||||
EntryStack<?>[] furnacesArray = furnaces.toArray(new EntryStack[0]);
|
||||
|
||||
registry.add(new REIAlloyingFuelCategory(), new REIAlloyingCategory(endStoneSmelter), new REIInfusionCategory(infusionRitual), new REIAnvilCategory(anvilsArray));
|
||||
|
||||
registry.add(new REIAlloyingFuelCategory(), new REIAlloyingCategory(END_STONE_SMELTER), new REIInfusionCategory(INFUSION_RITUAL), new REIAnvilCategory(ANVILS));
|
||||
|
||||
registry.addWorkstations(ALLOYING_FUEL, END_STONE_SMELTER);
|
||||
registry.addWorkstations(ALLOYING, END_STONE_SMELTER);
|
||||
registry.addWorkstations(INFUSION, INFUSION_RITUAL);
|
||||
registry.addWorkstations(SMITHING, ANVILS);
|
||||
registry.addWorkstations(ALLOYING_FUEL, endStoneSmelter);
|
||||
registry.addWorkstations(ALLOYING, endStoneSmelter);
|
||||
registry.addWorkstations(INFUSION, infusionRitual);
|
||||
registry.addWorkstations(SMITHING, anvilsArray);
|
||||
registry.removePlusButton(ALLOYING_FUEL);
|
||||
registry.removePlusButton(SMITHING);
|
||||
|
||||
registry.addWorkstations(DefaultPlugin.SMELTING, FURNACES);
|
||||
registry.addWorkstations(DefaultPlugin.FUEL, FURNACES);
|
||||
registry.addWorkstations(DefaultPlugin.SMELTING, furnacesArray);
|
||||
registry.addWorkstations(DefaultPlugin.FUEL, furnacesArray);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue