Fixes for REI
This commit is contained in:
parent
e7c85c8148
commit
c5fb156042
5 changed files with 67 additions and 61 deletions
|
@ -23,6 +23,10 @@ import java.text.DecimalFormat;
|
|||
import java.util.List;
|
||||
|
||||
public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingDisplay> {
|
||||
private final EntryStack ICON;
|
||||
REIAlloyingCategory(EntryStack icon){
|
||||
ICON = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull CategoryIdentifier getCategoryIdentifier() {
|
||||
|
@ -36,8 +40,7 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
|
|||
|
||||
@Override
|
||||
public @NotNull EntryStack getIcon() {
|
||||
//return REIPluginClient.END_STONE_SMELTER;
|
||||
return EntryStacks.of(Items.COAL);
|
||||
return ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class REIAlloyingFuelDisplay extends BasicDisplay {
|
||||
public class REIAlloyingFuelDisplay extends BasicDisplay {
|
||||
private final int fuelTime;
|
||||
|
||||
public REIAlloyingFuelDisplay(List<EntryIngredient> fuel, CompoundTag tag) {
|
||||
|
@ -24,10 +24,10 @@ public abstract class REIAlloyingFuelDisplay extends BasicDisplay {
|
|||
this.fuelTime = fuelTime;
|
||||
}*/
|
||||
|
||||
/*@Override
|
||||
@Override
|
||||
public CategoryIdentifier<?> getCategoryIdentifier() {
|
||||
return REIPluginClient.ALLOYING_FUEL;
|
||||
}*/
|
||||
return REIPlugin.ALLOYING_FUEL;
|
||||
}
|
||||
|
||||
public int getFuelTime() {
|
||||
return fuelTime;
|
||||
|
|
|
@ -27,6 +27,11 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay> {
|
||||
private final EntryStack[] ANVILS;
|
||||
|
||||
REIAnvilCategory(EntryStack[] anvils){
|
||||
ANVILS = anvils;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull CategoryIdentifier getCategoryIdentifier() {
|
||||
|
@ -40,12 +45,11 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
|
|||
|
||||
@Override
|
||||
public @NotNull EntryStack getIcon() {
|
||||
//return REIPluginClient.ANVILS[0];
|
||||
return EntryStacks.of(Items.COAL);
|
||||
return ANVILS[0];
|
||||
}
|
||||
|
||||
|
||||
/*@Override
|
||||
@Override
|
||||
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
|
||||
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
|
||||
List<Widget> widgets = Lists.newArrayList();
|
||||
|
@ -56,7 +60,7 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
|
|||
List<EntryIngredient> inputEntries = display.getInputEntries();
|
||||
EntryIngredient materials = inputEntries.get(1);
|
||||
int anvilLevel = display.getAnvilLevel();
|
||||
List anvils = Arrays.stream(REIPluginClient.ANVILS).filter(anvil -> {
|
||||
List anvils = Arrays.stream(ANVILS).filter(anvil -> {
|
||||
Block block = ((BlockItem) anvil.getValue()).getBlock();
|
||||
if (block instanceof EndAnvilBlock) {
|
||||
return ((EndAnvilBlock) block).getCraftingLevel() >= anvilLevel;
|
||||
|
@ -73,7 +77,7 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
|
|||
widgets.add(Widgets.createSlot(new Point(x - 9, y + 25)).entries(anvils));
|
||||
|
||||
return widgets;
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
|
||||
|
|
|
@ -25,6 +25,11 @@ import java.util.List;
|
|||
public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionDisplay> {
|
||||
|
||||
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
|
||||
private final EntryStack ICON;
|
||||
|
||||
REIInfusionCategory(EntryStack icon){
|
||||
ICON = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull CategoryIdentifier getCategoryIdentifier() {
|
||||
|
@ -38,8 +43,7 @@ public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionD
|
|||
|
||||
@Override
|
||||
public @NotNull EntryStack getIcon() {
|
||||
//return REIPluginClient.INFUSION_RITUAL;
|
||||
return EntryStacks.of(Items.COAL);
|
||||
return ICON;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import me.shedaniel.rei.impl.Internals;
|
|||
import me.shedaniel.rei.plugin.common.DefaultPlugin;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -32,42 +33,43 @@ import ru.betterend.registry.EndBlocks;
|
|||
import ru.betterend.registry.EndItems;
|
||||
import ru.betterend.registry.EndPortals;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
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 int VAL = 13;
|
||||
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 = AlloyingRecipe.ID;
|
||||
public final static CategoryIdentifier SMITHING = CategoryIdentifier.of(BetterEnd.MOD_ID, AnvilRecipe.ID.getPath());
|
||||
public final static CategoryIdentifier INFUSION = InfusionRecipe.ID;
|
||||
|
||||
public final static EntryStack END_STONE_SMELTER;// = EntryStacks.of(EndBlocks.END_STONE_SMELTER);
|
||||
//public final static EntryStack INFUSION_RITUAL = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL);
|
||||
//public final static EntryStack[] FURNACES;
|
||||
//public final static EntryStack[] ANVILS;
|
||||
private EntryStack END_STONE_SMELTER;
|
||||
private EntryStack INFUSION_RITUAL;
|
||||
private EntryStack[] ANVILS;
|
||||
private EntryStack[] FURNACES;
|
||||
|
||||
//@Override
|
||||
//public ResourceLocation getPluginIdentifier() {
|
||||
// return PLUGIN_ID;
|
||||
//}
|
||||
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;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void registerRecipeDisplays(RecipeHelper recipeHelper) {
|
||||
recipeHelper.registerRecipes(ALLOYING, AlloyingRecipe.class, REIAlloyingDisplay::new);
|
||||
recipeHelper.registerRecipes(ALLOYING, BlastingRecipe.class, REIAlloyingDisplay::new);
|
||||
recipeHelper.registerRecipes(SMITHING, AnvilRecipe.class, REIAnvilDisplay::new);
|
||||
recipeHelper.registerRecipes(INFUSION, InfusionRecipe.class, REIInfusionDisplay::new);
|
||||
FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
|
||||
if (time >= 2000) {
|
||||
recipeHelper.registerDisplay(new REIAlloyingFuelDisplay(EntryStack.of(item), time));
|
||||
}
|
||||
});
|
||||
}*/
|
||||
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]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDisplays(DisplayRegistry registry) {
|
||||
|
@ -75,41 +77,34 @@ public final static int VAL = 13;
|
|||
registry.registerRecipeFiller(BlastingRecipe.class, RecipeType.BLASTING, REIBlastingDisplay::new);
|
||||
registry.registerRecipeFiller(AnvilRecipe.class, AnvilRecipe.TYPE, REIAnvilDisplay::new);
|
||||
registry.registerRecipeFiller(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new);
|
||||
|
||||
FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
|
||||
if (time >= 2000) {
|
||||
final List<EntryIngredient> list = Arrays.asList(EntryIngredients.of(item));
|
||||
registry.add(new REIAlloyingFuelDisplay(list, time));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCategories(CategoryRegistry registry) {
|
||||
init();
|
||||
|
||||
registry.add(
|
||||
new REIAlloyingFuelCategory(),
|
||||
new REIAlloyingCategory(),
|
||||
new REIInfusionCategory(),
|
||||
new REIAnvilCategory()
|
||||
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, END_STONE_SMELTER);
|
||||
registry.addWorkstations(ALLOYING, END_STONE_SMELTER);
|
||||
registry.addWorkstations(INFUSION, INFUSION_RITUAL);
|
||||
registry.addWorkstations(SMITHING, ANVILS);
|
||||
registry.removePlusButton(ALLOYING_FUEL);
|
||||
registry.removePlusButton(SMITHING);
|
||||
|
||||
//registry.addWorkstations(DefaultPlugin.SMELTING, FURNACES);
|
||||
//registry.addWorkstations(DefaultPlugin.FUEL, FURNACES);
|
||||
|
||||
}
|
||||
static EntryType<ItemStack> BLOCK = EntryType.deferred(new ResourceLocation("block"));
|
||||
static {
|
||||
//initialize static state
|
||||
EndPortals.loadPortals();
|
||||
System.out.println(EndBlocks.END_STONE_SMELTER + " - " + EndBlocks.END_STONE_SMELTER.asItem());
|
||||
//END_STONE_SMELTER = EntryStacks.of(EndBlocks.END_STONE_SMELTER.asItem());
|
||||
/*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]);*/
|
||||
registry.addWorkstations(DefaultPlugin.SMELTING, FURNACES);
|
||||
registry.addWorkstations(DefaultPlugin.FUEL, FURNACES);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue