Fixes for 1.19-pre1

This commit is contained in:
Frank 2022-05-19 21:13:50 +02:00
parent d201a67f74
commit ed6263b886
17 changed files with 726 additions and 734 deletions

1
.gitignore vendored
View file

@ -28,6 +28,7 @@ bin/
run/ run/
run-client/ run-client/
run-server/
output/ output/
*.getBlock("log") *.getBlock("log")
Convert.class Convert.class

View file

@ -23,14 +23,14 @@ repositories {
maven { url 'https://maven.blamejared.com' } maven { url 'https://maven.blamejared.com' }
maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.shedaniel.me/" }
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
maven { url 'https://maven.terraformersmc.com/releases' } maven { url 'https://maven.terraformersmc.com/releases' }
flatDir { flatDir {
dirs 'libs' dirs 'libs'
} }
} }
loom { loom {
accessWidenerPath = file("src/main/resources/betterend.accesswidener") accessWidenerPath = file("src/main/resources/betterend.accesswidener")
} }
dependencies { dependencies {
@ -41,18 +41,18 @@ dependencies {
// useApi "vazkii.patchouli:Patchouli:1.17-${project.patchouli_version}" // useApi "vazkii.patchouli:Patchouli:1.17-${project.patchouli_version}"
println "Using local BCLib: ${local_bclib}" println "Using local BCLib: ${local_bclib}"
if (local_bclib){ if (local_bclib) {
implementation( project(path:":BCLib", configuration: 'dev') ) implementation(project(path: ":BCLib", configuration: 'dev'))
} else { } else {
modImplementation "com.github.paulevsGitch:BCLib:${project.bclib_version}" modImplementation "com.github.paulevsGitch:BCLib:${project.bclib_version}"
} }
//useOptional "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}" useOptional "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}"
//useOptional "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}" useOptional "me.shedaniel:RoughlyEnoughItems-api-fabric:${project.rei_version}"
} }
def useOptional(String dep) { def useOptional(String dep) {
dependencies.modRuntime(dep) { dependencies.modRuntimeOnly(dep) {
exclude group: 'net.fabricmc.fabric-api' exclude group: 'net.fabricmc.fabric-api'
exclude group: 'net.fabricmc' exclude group: 'net.fabricmc'
if (!dep.contains("me.shedaniel")) { if (!dep.contains("me.shedaniel")) {
@ -84,10 +84,10 @@ def useApi(String dep) {
processResources { processResources {
println "Version: ${project.version}" println "Version: ${project.version}"
inputs.property "version", project.version inputs.property "version", project.version
filesMatching("fabric.mod.json") { filesMatching("fabric.mod.json") {
expand "version": project.version expand "version": project.version
} }
} }
// ensure that the encoding is set to UTF-8, no matter what the system default is // ensure that the encoding is set to UTF-8, no matter what the system default is
@ -116,10 +116,10 @@ task sourcesJar(type: Jar, dependsOn: classes) {
} }
java { java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present. // if it is present.
// If you remove this line, sources will not be generated. // If you remove this line, sources will not be generated.
withSourcesJar() withSourcesJar()
} }
jar { jar {
@ -159,20 +159,20 @@ task release(dependsOn: [remapJar, sourcesJar, javadocJar]) {
// configure the maven publication // configure the maven publication
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
artifact(remapJar) { artifact(remapJar) {
builtBy remapJar builtBy remapJar
} }
artifact(sourcesJar) { artifact(sourcesJar) {
builtBy remapSourcesJar builtBy remapSourcesJar
} }
} }
} }
// select the repositories you want to publish to // select the repositories you want to publish to
repositories { repositories {
// uncomment to publish to the local maven // uncomment to publish to the local maven
// mavenLocal() // mavenLocal()
} }
} }

View file

@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/versions.html # check these on https://fabricmc.net/versions.html
minecraft_version= 22w18a minecraft_version= 1.19-pre1
loader_version= 0.14.3 loader_version= 0.14.5
fabric_version = 0.52.1+1.19 fabric_version = 0.52.4+1.19
#Loom #Loom
loom_version=0.11-SNAPSHOT loom_version=0.11-SNAPSHOT
@ -20,5 +20,4 @@ archives_base_name=better-end
patchouli_version = 55-FABRIC-SNAPSHOT patchouli_version = 55-FABRIC-SNAPSHOT
bclib_version = 2.0.0 bclib_version = 2.0.0
rei_version = 8.0.442 rei_version = 9.0.458
canvas_version = 1.0.+

View file

@ -1,6 +1,9 @@
package org.betterx.betterend.integration.rei; 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.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
@ -12,107 +15,106 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.EntryStack;
import net.minecraft.client.gui.GuiComponent; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;
import ru.betterend.registry.EndBlocks;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.NotNull;
public class REIAlloyingCategory implements DisplayCategory<REIAlloyingDisplay> { public class REIAlloyingCategory implements DisplayCategory<REIAlloyingDisplay> {
private final EntryStack ICON; private final EntryStack ICON;
REIAlloyingCategory(EntryStack icon) {
ICON = icon;
}
@Override
public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.ALLOYING;
}
@Override
public @NotNull Component getTitle() {
return Component.translatable(EndBlocks.END_STONE_SMELTER.getDescriptionId());
}
@Override
public @NotNull EntryStack getIcon() {
return ICON;
}
@Override
public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
double smeltTime = display.getSmeltTime();
DecimalFormat df = new DecimalFormat("###.##");
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20))
.animationDurationMS(10000));
widgets.add(Widgets.createLabel(
new Point(bounds.x + bounds.width - 5, bounds.y + 5),
Component.translatable("category.rei.cooking.time&xp",
df.format(display.getXp()),
df.format(smeltTime / 20D)
)
).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8))
.animationDurationTicks(smeltTime));
List<EntryIngredient> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1))
.entries(inputEntries.get(0))
.markInput());
if (inputEntries.size() > 1) {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1))
.entries(inputEntries.get(1))
.markInput());
}
else {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1))
.entries(Lists.newArrayList())
.markInput());
}
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9))
.entries(display.getOutputEntries().get(0))
.disableBackground()
.markOutput());
return widgets;
}
//TODO: 1.18 REI find replacement REIAlloyingCategory(EntryStack icon) {
//@Override ICON = icon;
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(); @Override
matrices.translate(0, 0, 400); public @NotNull CategoryIdentifier getCategoryIdentifier() {
if (redSlots.contains(0)) { return REIPlugin.ALLOYING;
GuiComponent.fill( }
matrices,
startPoint.x - 20, @Override
startPoint.y + 1, public @NotNull Component getTitle() {
startPoint.x - 20 + 16, return Component.translatable(EndBlocks.END_STONE_SMELTER.getDescriptionId());
startPoint.y + 1 + 16, }
1090453504
); @Override
GuiComponent.fill( public @NotNull EntryStack getIcon() {
matrices, return ICON;
startPoint.x + 1, }
startPoint.y + 1,
startPoint.x + 1 + 16, @Override
startPoint.y + 1 + 16, public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
1090453504 Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
); double smeltTime = display.getSmeltTime();
} DecimalFormat df = new DecimalFormat("###.##");
matrices.popPose(); List<Widget> widgets = Lists.newArrayList();
} widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
@Override widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20))
public int getDisplayHeight() { .animationDurationMS(10000));
return 49; widgets.add(Widgets.createLabel(
} new Point(bounds.x + bounds.width - 5, bounds.y + 5),
} Component.translatable("category.rei.cooking.time&xp",
*/ df.format(display.getXp()),
df.format(smeltTime / 20D)
)
).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8))
.animationDurationTicks(smeltTime));
List<EntryIngredient> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1))
.entries(inputEntries.get(0))
.markInput());
if (inputEntries.size() > 1) {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1))
.entries(inputEntries.get(1))
.markInput());
} else {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1))
.entries(Lists.newArrayList())
.markInput());
}
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9))
.entries(display.getOutputEntries().get(0))
.disableBackground()
.markOutput());
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

@ -1,108 +1,107 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
/* import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.crafting.Recipe;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay; import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.ChatFormatting; import org.betterx.betterend.blocks.entities.EndStoneSmelterBlockEntity;
import org.betterx.betterend.recipe.builders.AlloyingRecipe;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.crafting.Recipe;
import org.jetbrains.annotations.NotNull;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
import ru.betterend.recipe.builders.AlloyingRecipe;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDisplay { public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
private static List<EntryStack> fuel; private static List<EntryStack> fuel;
private Recipe<?> recipe; private Recipe<?> recipe;
private float xp; private float xp;
private double smeltTime; private double smeltTime;
public REIAlloyingDisplay(AlloyingRecipe recipe) { public REIAlloyingDisplay(AlloyingRecipe recipe) {
this(recipe, recipe.getExperience(), recipe.getSmeltTime()); this(recipe, recipe.getExperience(), recipe.getSmeltTime());
} }
protected REIAlloyingDisplay(Recipe<?> recipe, float xp, double smeltTime) { protected REIAlloyingDisplay(Recipe<?> recipe, float xp, double smeltTime) {
super( super(
EntryIngredients.ofIngredients(recipe.getIngredients()), EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem())) Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
); );
this.recipe = recipe; this.recipe = recipe;
this.xp = xp; this.xp = xp;
this.smeltTime = smeltTime; this.smeltTime = smeltTime;
} }
public static List<EntryStack> getFuel() { public static List<EntryStack> getFuel() {
return fuel; return fuel;
} }
@Override @Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() { public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId); return Optional.ofNullable(recipe).map(Recipe::getId);
} }
@Override @Override
public CategoryIdentifier<?> getCategoryIdentifier() { public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.ALLOYING; return REIPlugin.ALLOYING;
} }
// @Override // @Override
// public @NotNull List<List<EntryStack>> getRequiredEntries() { // public @NotNull List<List<EntryStack>> getRequiredEntries() {
// return this.input; // return this.input;
// } // }
public float getXp() { public float getXp() {
return this.xp; return this.xp;
} }
public double getSmeltTime() { public double getSmeltTime() {
return this.smeltTime; return this.smeltTime;
} }
public Optional<Recipe<?>> getOptionalRecipe() { public Optional<Recipe<?>> getOptionalRecipe() {
return Optional.ofNullable(recipe); return Optional.ofNullable(recipe);
} }
@Override @Override
public int getWidth() { public int getWidth() {
return 2; return 2;
} }
@Override @Override
public int getHeight() { public int getHeight() {
return 1; return 1;
} }
// @Override // @Override
// public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) { // public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) {
// return this.input; // return this.input;
// } // }
static { static {
fuel = EndStoneSmelterBlockEntity.availableFuels() fuel = EndStoneSmelterBlockEntity.availableFuels()
.keySet() .keySet()
.stream() .stream()
.map(Item::getDefaultInstance) .map(Item::getDefaultInstance)
.map(EntryStacks::of) .map(EntryStacks::of)
.map(e -> e.setting( .map(e -> e.setting(
EntryStack.Settings.TOOLTIP_APPEND_EXTRA, EntryStack.Settings.TOOLTIP_APPEND_EXTRA,
stack -> Collections.singletonList(Component.translatable( stack -> Collections.singletonList(Component.translatable(
"category.rei.smelting.fuel").withStyle(ChatFormatting.YELLOW)) "category.rei.smelting.fuel").withStyle(ChatFormatting.YELLOW))
)) ))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
*/

View file

@ -1,5 +1,9 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
/*
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Items;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.math.Point; import me.shedaniel.math.Point;
@ -13,96 +17,91 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.api.common.util.EntryStacks;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Items;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelDisplay> { public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelDisplay> {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##"); private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
@Override @Override
public @NotNull CategoryIdentifier getCategoryIdentifier() { public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.ALLOYING_FUEL; return REIPlugin.ALLOYING_FUEL;
} }
@Override @Override
public @NotNull Component getTitle() { public @NotNull Component getTitle() {
return Component.translatable("category.rei.fuel"); return Component.translatable("category.rei.fuel");
} }
@Override @Override
public int getDisplayHeight() { public int getDisplayHeight() {
return 49; return 49;
} }
@Override @Override
public @NotNull EntryStack getIcon() { public @NotNull EntryStack getIcon() {
return EntryStacks.of(Items.COAL); return EntryStacks.of(Items.COAL);
} }
@Override @Override
public List<Widget> setupDisplay(REIAlloyingFuelDisplay recipeDisplay, Rectangle bounds) { public List<Widget> setupDisplay(REIAlloyingFuelDisplay recipeDisplay, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 17); Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 17);
String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime()); String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime());
List<Widget> widgets = Lists.newArrayList(); List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds)); widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createLabel( widgets.add(Widgets.createLabel(
new Point(bounds.x + 26, bounds.getMaxY() - 15), new Point(bounds.x + 26, bounds.getMaxY() - 15),
Component.translatable("category.rei.fuel.time", burnTime) Component.translatable("category.rei.fuel.time", burnTime)
).color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned()); ).color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1)) widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1))
.animationDurationTicks(recipeDisplay.getFuelTime())); .animationDurationTicks(recipeDisplay.getFuelTime()));
widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18)) widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18))
.entries(recipeDisplay.getInputEntries().get(0)) .entries(recipeDisplay.getInputEntries().get(0))
.markInput()); .markInput());
return widgets; return widgets;
} }
@Override @Override
public DisplayRenderer getDisplayRenderer(REIAlloyingFuelDisplay recipe) { public DisplayRenderer getDisplayRenderer(REIAlloyingFuelDisplay recipe) {
Slot slot = Widgets.createSlot(new Point(0, 0)) Slot slot = Widgets.createSlot(new Point(0, 0))
.entries(recipe.getInputEntries().get(0)) .entries(recipe.getInputEntries().get(0))
.disableBackground() .disableBackground()
.disableHighlight(); .disableHighlight();
String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d); String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d);
return new DisplayRenderer() { return new DisplayRenderer() {
private TranslatableComponent text = Component.translatable( private Component text = Component.translatable(
"category.rei.fuel.time_short.items", "category.rei.fuel.time_short.items",
burnItems burnItems
); );
@Override @Override
public int getHeight() { public int getHeight() {
return 22; return 22;
} }
@Nullable @Nullable
@Override @Override
public Tooltip getTooltip(Point point) { public Tooltip getTooltip(Point point) {
if (slot.containsMouse(point)) return slot.getCurrentTooltip(point); if (slot.containsMouse(point)) return slot.getCurrentTooltip(point);
return null; return null;
} }
@Override @Override
public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) { public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
slot.setZ(getZ() + 50); slot.setZ(getZ() + 50);
slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2); slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2);
slot.render(matrices, mouseX, mouseY, delta); slot.render(matrices, mouseX, mouseY, delta);
Minecraft.getInstance().font.drawShadow( Minecraft.getInstance().font.drawShadow(
matrices, matrices,
text.getVisualOrderText(), text.getVisualOrderText(),
bounds.x + 25, bounds.x + 25,
bounds.y + 8, bounds.y + 8,
-1 -1
); );
} }
}; };
} }
} }
*/

View file

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

View file

@ -1,5 +1,12 @@
package org.betterx.betterend.integration.rei; 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;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
@ -11,112 +18,108 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.EntryStack;
import net.minecraft.client.gui.GuiComponent; import org.betterx.betterend.blocks.basis.EndAnvilBlock;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import org.jetbrains.annotations.NotNull;
import ru.betterend.blocks.basis.EndAnvilBlock;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
public class REIAnvilCategory implements DisplayCategory<REIAnvilDisplay> { public class REIAnvilCategory implements DisplayCategory<REIAnvilDisplay> {
private final EntryStack<?>[] ANVILS; private final EntryStack<?>[] ANVILS;
REIAnvilCategory(EntryStack<?>[] anvils) {
ANVILS = anvils;
}
@Override
public CategoryIdentifier<REIAnvilDisplay> getCategoryIdentifier() {
return REIPlugin.SMITHING;
}
@Override
public @NotNull Component getTitle() {
return Component.translatable(Blocks.ANVIL.getDescriptionId());
}
@Override
public @NotNull EntryStack<?> getIcon() {
return ANVILS[0];
}
@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();
widgets.add(Widgets.createRecipeBase(bounds));
int x = startPoint.x + 10;
int y = startPoint.y;
widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 5)));
List<EntryIngredient> inputEntries = display.getInputEntries();
EntryIngredient materials = inputEntries.get(1);
int anvilLevel = display.getAnvilLevel();
List<EntryStack<?>> anvils = Arrays.stream(ANVILS).filter(anvil -> {
Object value = anvil.getValue();
if (value instanceof ItemStack) {
value = ((ItemStack) value).getItem();
}
Block block = ((BlockItem) value).getBlock();
if (block instanceof EndAnvilBlock) {
return ((EndAnvilBlock) block).getCraftingLevel() >= anvilLevel;
}
return anvilLevel == 1;
}).collect(Collectors.toList());
widgets.add(Widgets.createArrow(new Point(x + 24, y + 4)));
widgets.add(Widgets.createLabel(
new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15),
Component.translatable("category.rei.damage.amount&dmg", display.getDamage())
).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createSlot(new Point(x - 20, y + 4)).entries(materials).markInput());
widgets.add(Widgets.createSlot(new Point(x + 1, y + 4)).entries(inputEntries.get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(x + 61, y + 5))
.entries(display.getOutputEntries().get(0))
.disableBackground()
.markOutput());
widgets.add(Widgets.createSlot(new Point(x - 9, y + 25)).entries(anvils));
return widgets;
}
//TODO: 1.18 REI, find replacement REIAnvilCategory(EntryStack<?>[] anvils) {
//@Override ANVILS = anvils;
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(); @Override
matrices.translate(0, 0, 400); public CategoryIdentifier<REIAnvilDisplay> getCategoryIdentifier() {
if (redSlots.contains(0)) { return REIPlugin.SMITHING;
GuiComponent.fill( }
matrices,
startPoint.x - 20, @Override
startPoint.y + 3, public @NotNull Component getTitle() {
startPoint.x - 20 + 16, return Component.translatable(Blocks.ANVIL.getDescriptionId());
startPoint.y + 3 + 16, }
1090453504
); @Override
GuiComponent.fill( public @NotNull EntryStack<?> getIcon() {
matrices, return ANVILS[0];
startPoint.x + 1, }
startPoint.y + 3,
startPoint.x + 1 + 16,
startPoint.y + 3 + 16, @Override
1090453504 public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
); Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
} List<Widget> widgets = Lists.newArrayList();
matrices.popPose(); widgets.add(Widgets.createRecipeBase(bounds));
} int x = startPoint.x + 10;
int y = startPoint.y;
@Override widgets.add(Widgets.createResultSlotBackground(new Point(x + 61, y + 5)));
public int getDisplayHeight() { List<EntryIngredient> inputEntries = display.getInputEntries();
return 60; EntryIngredient materials = inputEntries.get(1);
} int anvilLevel = display.getAnvilLevel();
List<EntryStack<?>> anvils = Arrays.stream(ANVILS).filter(anvil -> {
} Object value = anvil.getValue();
*/ if (value instanceof ItemStack) {
value = ((ItemStack) value).getItem();
}
Block block = ((BlockItem) value).getBlock();
if (block instanceof EndAnvilBlock) {
return ((EndAnvilBlock) block).getCraftingLevel() >= anvilLevel;
}
return anvilLevel == 1;
}).collect(Collectors.toList());
widgets.add(Widgets.createArrow(new Point(x + 24, y + 4)));
widgets.add(Widgets.createLabel(
new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15),
Component.translatable("category.rei.damage.amount&dmg", display.getDamage())
).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createSlot(new Point(x - 20, y + 4)).entries(materials).markInput());
widgets.add(Widgets.createSlot(new Point(x + 1, y + 4)).entries(inputEntries.get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(x + 61, y + 5))
.entries(display.getOutputEntries().get(0))
.disableBackground()
.markOutput());
widgets.add(Widgets.createSlot(new Point(x - 9, y + 25)).entries(anvils));
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

@ -1,63 +1,63 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
/*
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay; import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryIngredients;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe;
import org.jetbrains.annotations.NotNull;
import org.betterx.bclib.recipes.AnvilRecipe; import org.betterx.bclib.recipes.AnvilRecipe;
import java.util.Collections; import java.util.Collections;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.NotNull;
public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay { public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
private final AnvilRecipe recipe; private final AnvilRecipe recipe;
public REIAnvilDisplay(AnvilRecipe recipe) { public REIAnvilDisplay(AnvilRecipe recipe) {
super( super(
EntryIngredients.ofIngredients(recipe.getIngredients()), EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem())) Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
); );
this.recipe = recipe; this.recipe = recipe;
inputs.get(1).forEach(entryStack -> { inputs.get(1).forEach(entryStack -> {
if (entryStack.getValue() instanceof ItemStack itemStack) { if (entryStack.getValue() instanceof ItemStack itemStack) {
itemStack.setCount(recipe.getInputCount()); itemStack.setCount(recipe.getInputCount());
} }
}); });
} }
public int getDamage() { public int getDamage() {
return recipe.getDamage(); return recipe.getDamage();
} }
public int getAnvilLevel() { public int getAnvilLevel() {
return recipe.getAnvilLevel(); return recipe.getAnvilLevel();
} }
@Override @Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() { public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId); return Optional.ofNullable(recipe).map(Recipe::getId);
} }
@Override @Override
public CategoryIdentifier<?> getCategoryIdentifier() { public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.SMITHING; return REIPlugin.SMITHING;
} }
@Override @Override
public int getWidth() { public int getWidth() {
return 2; return 2;
} }
@Override @Override
public int getHeight() { public int getHeight() {
return 1; return 1;
} }
} }
*/

View file

@ -1,10 +1,9 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
/*
import net.minecraft.world.item.crafting.BlastingRecipe; import net.minecraft.world.item.crafting.BlastingRecipe;
public class REIBlastingDisplay extends REIAlloyingDisplay { public class REIBlastingDisplay extends REIAlloyingDisplay {
public REIBlastingDisplay(BlastingRecipe recipe) { public REIBlastingDisplay(BlastingRecipe recipe) {
super(recipe, recipe.getExperience(), recipe.getCookingTime()); super(recipe, recipe.getExperience(), recipe.getCookingTime());
} }
} }
*/

View file

@ -1,9 +0,0 @@
package org.betterx.betterend.integration.rei;
public class REIContainer implements Runnable {
@Override
public void run() {
//ContainerInfoHandler.registerContainerInfo(AlloyingRecipe.ID, CraftingContainerInfoWrapper.create(EndStoneSmelterScreenHandler.class));
}
}

View file

@ -1,5 +1,8 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
/*
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import me.shedaniel.math.Point; import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
@ -9,103 +12,100 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.EntryStack;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import ru.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.NotNull;
public class REIInfusionCategory implements DisplayCategory<REIInfusionDisplay> { public class REIInfusionCategory implements DisplayCategory<REIInfusionDisplay> {
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png"); private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
private final EntryStack ICON; private final EntryStack ICON;
REIInfusionCategory(EntryStack icon) { REIInfusionCategory(EntryStack icon) {
ICON = icon; ICON = icon;
} }
@Override @Override
public @NotNull CategoryIdentifier getCategoryIdentifier() { public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.INFUSION; return REIPlugin.INFUSION;
} }
@Override @Override
public @NotNull Component getTitle() { public @NotNull Component getTitle() {
return Component.translatable(EndBlocks.INFUSION_PEDESTAL.getDescriptionId()); return Component.translatable(EndBlocks.INFUSION_PEDESTAL.getDescriptionId());
} }
@Override @Override
public @NotNull EntryStack getIcon() { public @NotNull EntryStack getIcon() {
return ICON; return ICON;
} }
@Override @Override
public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) { public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) {
Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2); Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2);
List<Widget> widgets = Lists.newArrayList(); List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds)); widgets.add(Widgets.createRecipeBase(bounds));
List<EntryIngredient> inputEntries = display.getInputEntries(); List<EntryIngredient> inputEntries = display.getInputEntries();
List<EntryIngredient> outputEntries = display.getOutputEntries(); List<EntryIngredient> outputEntries = display.getOutputEntries();
if (inputEntries.size() < 9) { if (inputEntries.size() < 9) {
List<EntryIngredient> newList = new ArrayList<EntryIngredient>(9); List<EntryIngredient> newList = new ArrayList<EntryIngredient>(9);
newList.addAll(inputEntries); newList.addAll(inputEntries);
for (int i = inputEntries.size(); i < 9; i++) { for (int i = inputEntries.size(); i < 9; i++) {
newList.add(EntryIngredient.empty()); newList.add(EntryIngredient.empty());
} }
inputEntries = newList; inputEntries = newList;
} }
widgets.add(Widgets.createTexturedWidget(BACKGROUND, bounds.x, bounds.y, 0, 0, 150, 104, 150, 104)); widgets.add(Widgets.createTexturedWidget(BACKGROUND, bounds.x, bounds.y, 0, 0, 150, 104, 150, 104));
widgets.add(Widgets.createSlot(centerPoint).entries(inputEntries.get(0)).disableBackground().markInput()); widgets.add(Widgets.createSlot(centerPoint).entries(inputEntries.get(0)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28)) widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28))
.entries(inputEntries.get(1)) .entries(inputEntries.get(1))
.disableBackground() .disableBackground()
.markInput()); .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y)) widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y))
.entries(inputEntries.get(3)) .entries(inputEntries.get(3))
.disableBackground() .disableBackground()
.markInput()); .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28)) widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28))
.entries(inputEntries.get(5)) .entries(inputEntries.get(5))
.disableBackground() .disableBackground()
.markInput()); .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y)) widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y))
.entries(inputEntries.get(7)) .entries(inputEntries.get(7))
.disableBackground() .disableBackground()
.markInput()); .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24)) widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24))
.entries(inputEntries.get(2)) .entries(inputEntries.get(2))
.disableBackground() .disableBackground()
.markInput()); .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24)) widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24))
.entries(inputEntries.get(4)) .entries(inputEntries.get(4))
.disableBackground() .disableBackground()
.markInput()); .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)) widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24))
.entries(inputEntries.get(6)) .entries(inputEntries.get(6))
.disableBackground() .disableBackground()
.markInput()); .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)) widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24))
.entries(inputEntries.get(8)) .entries(inputEntries.get(8))
.disableBackground() .disableBackground()
.markInput()); .markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)) widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y))
.entries(outputEntries.get(0)) .entries(outputEntries.get(0))
.disableBackground() .disableBackground()
.markOutput()); .markOutput());
widgets.add(Widgets.createLabel( widgets.add(Widgets.createLabel(
new Point(bounds.getMaxX() - 5, bounds.y + 6), new Point(bounds.getMaxX() - 5, bounds.y + 6),
Component.translatable("category.rei.infusion.time&val", display.getInfusionTime()) Component.translatable("category.rei.infusion.time&val", display.getInfusionTime())
).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB)); ).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
return widgets; return widgets;
} }
@Override @Override
public int getDisplayHeight() { public int getDisplayHeight() {
return 104; return 104;
} }
} }
*/

View file

@ -1,63 +1,63 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
/*
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.Recipe;
import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay; import me.shedaniel.rei.api.common.display.SimpleGridMenuDisplay;
import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.display.basic.BasicDisplay;
import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryIngredients;
import net.minecraft.resources.ResourceLocation; import org.betterx.betterend.recipe.builders.InfusionRecipe;
import net.minecraft.world.item.crafting.Recipe;
import org.jetbrains.annotations.NotNull;
import ru.betterend.recipe.builders.InfusionRecipe;
import java.util.Collections; import java.util.Collections;
import java.util.Optional; import java.util.Optional;
import org.jetbrains.annotations.NotNull;
public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDisplay { public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
private final InfusionRecipe recipe; private final InfusionRecipe recipe;
private final int time; private final int time;
public REIInfusionDisplay(InfusionRecipe recipe) { public REIInfusionDisplay(InfusionRecipe recipe) {
super( super(
EntryIngredients.ofIngredients(recipe.getIngredients()), EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem())) Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
); );
this.recipe = recipe; this.recipe = recipe;
this.time = recipe.getInfusionTime(); this.time = recipe.getInfusionTime();
} }
public int getInfusionTime() { public int getInfusionTime() {
return this.time; return this.time;
} }
@Override @Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() { public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId); return Optional.ofNullable(recipe).map(Recipe::getId);
} }
@Override @Override
public CategoryIdentifier<?> getCategoryIdentifier() { public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.INFUSION; return REIPlugin.INFUSION;
} }
// @Override // @Override
// public @NotNull List<List<EntryStack>> getRequiredEntries() { // public @NotNull List<List<EntryStack>> getRequiredEntries() {
// return this.input; // return this.input;
// } // }
@Override @Override
public int getWidth() { public int getWidth() {
return 0; return 0;
} }
@Override @Override
public int getHeight() { public int getHeight() {
return 0; return 0;
} }
// @Override // @Override
// public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) { // public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) {
// return this.input; // return this.input;
//} //}
} }
*/

View file

@ -1,5 +1,11 @@
package org.betterx.betterend.integration.rei; package org.betterx.betterend.integration.rei;
/*
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;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
@ -8,19 +14,14 @@ import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryIngredients;
import me.shedaniel.rei.api.common.util.EntryStacks; import me.shedaniel.rei.api.common.util.EntryStacks;
import me.shedaniel.rei.plugin.common.DefaultPlugin; import me.shedaniel.rei.plugin.common.BuiltinPlugin;
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;
import org.betterx.bclib.blocks.BaseFurnaceBlock; import org.betterx.bclib.blocks.BaseFurnaceBlock;
import org.betterx.bclib.recipes.AnvilRecipe; import org.betterx.bclib.recipes.AnvilRecipe;
import org.betterx.betterend.BetterEnd; import org.betterx.betterend.BetterEnd;
import ru.betterend.blocks.basis.EndAnvilBlock; import org.betterx.betterend.blocks.basis.EndAnvilBlock;
import ru.betterend.recipe.builders.AlloyingRecipe; import org.betterx.betterend.recipe.builders.AlloyingRecipe;
import ru.betterend.recipe.builders.InfusionRecipe; import org.betterx.betterend.recipe.builders.InfusionRecipe;
import ru.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -28,72 +29,71 @@ 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 //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 class REIPlugin implements REIClientPlugin {
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin"); public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");
public final static CategoryIdentifier<REIAlloyingFuelDisplay> ALLOYING_FUEL = CategoryIdentifier.of( public final static CategoryIdentifier<REIAlloyingFuelDisplay> ALLOYING_FUEL = CategoryIdentifier.of(
BetterEnd.MOD_ID, BetterEnd.MOD_ID,
"alloying_fuel" "alloying_fuel"
); );
public final static CategoryIdentifier<REIAlloyingDisplay> ALLOYING = CategoryIdentifier.of( public final static CategoryIdentifier<REIAlloyingDisplay> ALLOYING = CategoryIdentifier.of(
BetterEnd.MOD_ID, BetterEnd.MOD_ID,
AlloyingRecipe.GROUP AlloyingRecipe.GROUP
); );
public final static CategoryIdentifier<REIAnvilDisplay> SMITHING = CategoryIdentifier.of( public final static CategoryIdentifier<REIAnvilDisplay> SMITHING = CategoryIdentifier.of(
BetterEnd.MOD_ID, BetterEnd.MOD_ID,
AnvilRecipe.ID.getPath() AnvilRecipe.ID.getPath()
); );
public final static CategoryIdentifier<REIInfusionDisplay> INFUSION = CategoryIdentifier.of( public final static CategoryIdentifier<REIInfusionDisplay> INFUSION = CategoryIdentifier.of(
BetterEnd.MOD_ID, BetterEnd.MOD_ID,
InfusionRecipe.GROUP InfusionRecipe.GROUP
); );
@Override
public void registerDisplays(DisplayRegistry registry) {
registry.registerRecipeFiller(AlloyingRecipe.class, AlloyingRecipe.TYPE, REIAlloyingDisplay::new);
registry.registerRecipeFiller(BlastingRecipe.class, RecipeType.BLASTING, REIBlastingDisplay::new);
registry.registerRecipeFiller(AnvilRecipe.class, AnvilRecipe.TYPE, REIAnvilDisplay::new);
registry.registerRecipeFiller(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new);
//TODO: 1.18 REI fix this @Override
public void registerDisplays(DisplayRegistry registry) {
registry.registerRecipeFiller(AlloyingRecipe.class, AlloyingRecipe.TYPE, REIAlloyingDisplay::new);
registry.registerRecipeFiller(BlastingRecipe.class, RecipeType.BLASTING, REIBlastingDisplay::new);
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) -> { // FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
// if (time >= 2000) { // if (time >= 2000) {
// final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item)); // final List<EntryIngredient> list = Collections.singletonList(EntryIngredients.of(item));
// registry.add(new REIAlloyingFuelDisplay(list, time)); // registry.add(new REIAlloyingFuelDisplay(list, time));
// } // }
// }); // });
} }
@Override @Override
public void registerCategories(CategoryRegistry registry) { public void registerCategories(CategoryRegistry registry) {
EntryStack<ItemStack> endStoneSmelter = EntryStacks.of(EndBlocks.END_STONE_SMELTER); EntryStack<ItemStack> endStoneSmelter = EntryStacks.of(EndBlocks.END_STONE_SMELTER);
EntryStack<ItemStack> infusionRitual = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL); EntryStack<ItemStack> infusionRitual = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL);
List<EntryStack<?>> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks() List<EntryStack<?>> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks()
.stream() .stream()
.filter(EndAnvilBlock.class::isInstance) .filter(EndAnvilBlock.class::isInstance)
.collect(Collectors.toList()))); .collect(Collectors.toList())));
anvils.add(0, EntryStacks.of(Blocks.ANVIL)); anvils.add(0, EntryStacks.of(Blocks.ANVIL));
List<EntryStack<?>> ITEM_FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks() List<EntryStack<?>> ITEM_FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks()
.stream() .stream()
.filter(BaseFurnaceBlock.class::isInstance) .filter(BaseFurnaceBlock.class::isInstance)
.collect(Collectors.toList()))); .collect(Collectors.toList())));
EntryStack<?>[] anvilsArray = anvils.toArray(new EntryStack[0]); EntryStack<?>[] anvilsArray = anvils.toArray(new EntryStack[0]);
EntryStack<?>[] ITEM_FURNACESArray = ITEM_FURNACES.toArray(new EntryStack[0]); EntryStack<?>[] ITEM_FURNACESArray = ITEM_FURNACES.toArray(new EntryStack[0]);
registry.add( registry.add(
new REIAlloyingFuelCategory(), new REIAlloyingFuelCategory(),
new REIAlloyingCategory(endStoneSmelter), new REIAlloyingCategory(endStoneSmelter),
new REIInfusionCategory(infusionRitual), new REIInfusionCategory(infusionRitual),
new REIAnvilCategory(anvilsArray) new REIAnvilCategory(anvilsArray)
); );
registry.addWorkstations(ALLOYING_FUEL, endStoneSmelter); registry.addWorkstations(ALLOYING_FUEL, endStoneSmelter);
registry.addWorkstations(ALLOYING, endStoneSmelter); registry.addWorkstations(ALLOYING, endStoneSmelter);
registry.addWorkstations(INFUSION, infusionRitual); registry.addWorkstations(INFUSION, infusionRitual);
registry.addWorkstations(SMITHING, anvilsArray); registry.addWorkstations(SMITHING, anvilsArray);
registry.removePlusButton(ALLOYING_FUEL); registry.removePlusButton(ALLOYING_FUEL);
registry.removePlusButton(SMITHING); registry.removePlusButton(SMITHING);
registry.addWorkstations(DefaultPlugin.SMELTING, ITEM_FURNACESArray); registry.addWorkstations(BuiltinPlugin.SMELTING, ITEM_FURNACESArray);
registry.addWorkstations(DefaultPlugin.FUEL, ITEM_FURNACESArray); registry.addWorkstations(BuiltinPlugin.FUEL, ITEM_FURNACESArray);
} }
} }
*/

View file

@ -94,7 +94,7 @@ public abstract class ServerPlayerMixin extends Player implements TeleportingEnt
LevelData worldProperties = destination.getLevelData(); LevelData worldProperties = destination.getLevelData();
ServerPlayer player = ServerPlayer.class.cast(this); ServerPlayer player = ServerPlayer.class.cast(this);
connection.send(new ClientboundRespawnPacket( connection.send(new ClientboundRespawnPacket(
new Holder.Direct(destination.dimensionType()), destination.dimensionTypeId(),
destination.dimension(), destination.dimension(),
BiomeManager.obfuscateSeed(destination.getSeed()), BiomeManager.obfuscateSeed(destination.getSeed()),
gameMode.getGameModeForPlayer(), gameMode.getGameModeForPlayer(),

View file

@ -65,7 +65,7 @@ public class EndBiomes {
CAVE_BIOMES = new BiomePicker(registry); CAVE_BIOMES = new BiomePicker(registry);
registry.stream() registry.stream()
.filter(biome -> registry.getResourceKey(biome).isPresent()) .filter(biome -> registry.getResourceKey(biome).isPresent())
.map(biome -> registry.getOrCreateHolder(registry.getResourceKey(biome).get())) .map(biome -> registry.getOrCreateHolderOrThrow(registry.getResourceKey(biome).get()))
.map(biome -> biome.unwrapKey().orElseThrow().location()) .map(biome -> biome.unwrapKey().orElseThrow().location())
.filter(id -> BiomeAPI.wasRegisteredAs(id, END_CAVE)) .filter(id -> BiomeAPI.wasRegisteredAs(id, END_CAVE))
.map(id -> BiomeAPI.getBiome(id)) .map(id -> BiomeAPI.getBiome(id))

View file

@ -43,9 +43,9 @@
], ],
"depends": { "depends": {
"fabricloader": ">=0.14.3", "fabricloader": ">=0.14.5",
"fabric": ">=0.52.1", "fabric": ">=0.52.4",
"minecraft": "1.19-alpha.22.18.a", "minecraft": "1.19-beta.1",
"bclib": "2.0.x" "bclib": "2.0.x"
}, },
"suggests": { "suggests": {