Addressed multiple ToDo's

This commit is contained in:
Frank 2022-05-19 23:00:16 +02:00
parent ed6263b886
commit ce0afb4cc7
9 changed files with 76 additions and 215 deletions

View file

@ -1,12 +1,9 @@
package org.betterx.betterend.integration.rei;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.network.chat.Component;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
@ -82,37 +79,6 @@ public class REIAlloyingCategory implements DisplayCategory<REIAlloyingDisplay>
return widgets;
}
//TODO: 1.18 REI find replacement
//@Override
public void renderRedSlots(PoseStack matrices,
List<Widget> widgets,
Rectangle bounds,
REIAlloyingDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
GuiComponent.fill(
matrices,
startPoint.x - 20,
startPoint.y + 1,
startPoint.x - 20 + 16,
startPoint.y + 1 + 16,
1090453504
);
GuiComponent.fill(
matrices,
startPoint.x + 1,
startPoint.y + 1,
startPoint.x + 1 + 16,
startPoint.y + 1 + 16,
1090453504
);
}
matrices.popPose();
}
@Override
public int getDisplayHeight() {
return 49;

View file

@ -43,7 +43,7 @@ public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelD
@Override
public @NotNull EntryStack getIcon() {
return EntryStacks.of(Items.COAL);
return EntryStacks.of(Items.LAVA_BUCKET);
}
@Override

View file

@ -1,7 +1,5 @@
package org.betterx.betterend.integration.rei;
import net.minecraft.nbt.CompoundTag;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.entry.EntryIngredient;
@ -12,18 +10,10 @@ import java.util.List;
public class REIAlloyingFuelDisplay extends BasicDisplay {
private final int fuelTime;
public REIAlloyingFuelDisplay(List<EntryIngredient> fuel, CompoundTag tag) {
this(fuel, tag.getInt("fuelTime"));
}
public REIAlloyingFuelDisplay(List<EntryIngredient> fuel, int fuelTime) {
super(fuel, Collections.emptyList());
this.fuelTime = fuelTime;
}
//public REIAlloyingFuelDisplay(EntryStack fuel, int fuelTime) {
// this.fuel = fuel;
// this.fuelTime = fuelTime;
// }
@Override
public CategoryIdentifier<?> getCategoryIdentifier() {

View file

@ -1,6 +1,5 @@
package org.betterx.betterend.integration.rei;
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
@ -8,8 +7,6 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.gui.widgets.Widget;
@ -86,40 +83,8 @@ public class REIAnvilCategory implements DisplayCategory<REIAnvilDisplay> {
return widgets;
}
//TODO: 1.18 REI, find replacement
//@Override
public void renderRedSlots(PoseStack matrices,
List<Widget> widgets,
Rectangle bounds,
REIAnvilDisplay display,
IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
GuiComponent.fill(
matrices,
startPoint.x - 20,
startPoint.y + 3,
startPoint.x - 20 + 16,
startPoint.y + 3 + 16,
1090453504
);
GuiComponent.fill(
matrices,
startPoint.x + 1,
startPoint.y + 3,
startPoint.x + 1 + 16,
startPoint.y + 3 + 16,
1090453504
);
}
matrices.popPose();
}
@Override
public int getDisplayHeight() {
return 60;
}
}

View file

@ -6,11 +6,15 @@ import net.minecraft.world.item.crafting.BlastingRecipe;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.Blocks;
import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.fabricmc.fabric.impl.content.registry.FuelRegistryImpl;
import com.google.common.collect.Lists;
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.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks;
@ -23,6 +27,7 @@ import org.betterx.betterend.recipe.builders.AlloyingRecipe;
import org.betterx.betterend.recipe.builders.InfusionRecipe;
import org.betterx.betterend.registry.EndBlocks;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@ -54,13 +59,15 @@ public class REIPlugin implements REIClientPlugin {
registry.registerRecipeFiller(AnvilRecipe.class, AnvilRecipe.TYPE, REIAnvilDisplay::new);
registry.registerRecipeFiller(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new);
//TODO: 1.18 REI fix this
// FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
// if (time >= 2000) {
// final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
// registry.add(new REIAlloyingFuelDisplay(list, time));
// }
// });
//TODO: Migrate to 1.18/1.18.2
if (FuelRegistry.INSTANCE instanceof FuelRegistryImpl fabricImpl) {
fabricImpl.getFuelTimes().forEach((item, time) -> {
if (time >= 2000) {
final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
registry.add(new REIAlloyingFuelDisplay(list, time));
}
});
}
}
@Override