Skip to content

Commit 9965b3d

Browse files
committed
Backport Fixes
1 parent 123be7c commit 9965b3d

11 files changed

+59
-55
lines changed

gradle.properties

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,19 @@ org.gradle.jvmargs=-Xmx1G
55
minecraft_base_version=1.19
66
minecraft_version=1.19.2
77
yarn_mappings=1.19.2+build.28
8-
loader_version=0.14.22
8+
loader_version=0.14.25
99
# Mod Properties
1010
mod_version=2.1.1
1111
maven_group=io.wispforest
1212
archives_base_name=alloy-forgery
1313
# Dependencies
14-
fabric_version=0.64.0+1.19.2
15-
14+
fabric_version=0.77.0+1.19.2
1615
# https://maven.shedaniel.me/me/shedaniel/RoughlyEnoughItems-fabric/
17-
rei_version=9.0.472
18-
arch_version = 6.3.49
19-
16+
rei_version=9.1.668
17+
arch_version=6.5.82
2018
# https://www.curseforge.com/minecraft/mc-mods/modmenu/files
21-
modmenu_version=4.1.1
22-
19+
modmenu_version=4.2.0-beta.2
2320
# https://maven.wispforest.io/io/wispforest/owo-lib
24-
owo_version=0.8.5+1.19
25-
21+
owo_version=0.9.3+1.19
2622
# https://maven.terraformersmc.com/releases/dev/emi/emi
27-
emi_version=0.5.2+1.19.2
23+
emi_version=1.0.8+1.19.2

src/main/java/wraith/alloyforgery/block/ForgeControllerBlockEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public void tick() {
273273
if (remainderList != null) this.handleForgingRemainders(remainderList);
274274

275275
var outputStack = this.getStack(10);
276-
var recipeOutput = recipe.craft(this, this.world.getRegistryManager());
276+
var recipeOutput = recipe.craft(this);
277277

278278
recipe.consumeIngredients(this);
279279

src/main/java/wraith/alloyforgery/compat/emi/AlloyForgeryEmiRecipeHandler.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package wraith.alloyforgery.compat.emi;
22

3-
import dev.emi.emi.api.EmiRecipeHandler;
3+
import dev.emi.emi.api.recipe.handler.EmiRecipeHandler;
4+
import dev.emi.emi.api.recipe.handler.StandardRecipeHandler;
45
import dev.emi.emi.api.recipe.EmiRecipe;
56
import net.minecraft.screen.slot.Slot;
67
import org.jetbrains.annotations.Nullable;
@@ -9,7 +10,7 @@
910
import java.util.ArrayList;
1011
import java.util.List;
1112

12-
public class AlloyForgeryEmiRecipeHandler implements EmiRecipeHandler<AlloyForgeScreenHandler> {
13+
public class AlloyForgeryEmiRecipeHandler implements StandardRecipeHandler<AlloyForgeScreenHandler> {
1314
@Override
1415
public List<Slot> getInputSources(AlloyForgeScreenHandler handler) {
1516
List<Slot> slots = new ArrayList<>();
@@ -31,7 +32,7 @@ public List<Slot> getCraftingSlots(AlloyForgeScreenHandler handler) {
3132

3233
@Override
3334
public @Nullable Slot getOutputSlot(AlloyForgeScreenHandler handler) {
34-
return EmiRecipeHandler.super.getOutputSlot(handler);
35+
return StandardRecipeHandler.super.getOutputSlot(handler);
3536
}
3637

3738
@Override

src/main/java/wraith/alloyforgery/compat/emi/CustomButtonWidget.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package wraith.alloyforgery.compat.emi;
22

33
import com.mojang.blaze3d.systems.RenderSystem;
4-
import dev.emi.emi.EmiPort;
54
import dev.emi.emi.api.widget.Bounds;
65
import dev.emi.emi.api.widget.ButtonWidget;
76
import dev.emi.emi.api.widget.Widget;
@@ -37,7 +36,6 @@ public Bounds getBounds() {
3736

3837
@Override
3938
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
40-
EmiPort.setPositionTexShader();
4139
RenderSystem.setShaderTexture(0, AlloyForgeryEmiRecipe.GUI_TEXTURE);
4240
int v = 68;
4341
boolean active = this.isActive.getAsBoolean();

src/main/java/wraith/alloyforgery/compat/emi/CustomSlotWidget.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void setMutableStack(EmiIngredient stack) {
2020
}
2121

2222
@Override
23-
protected EmiIngredient getStack() {
23+
public EmiIngredient getStack() {
2424
return mutableStack;
2525
}
2626
}

src/main/java/wraith/alloyforgery/data/DelayedTagGroupLoader.java

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package wraith.alloyforgery.data;
22

3-
import com.google.common.collect.ImmutableSet;
4-
import com.google.common.collect.Maps;
3+
import com.google.common.collect.*;
54
import com.mojang.logging.LogUtils;
65
import net.minecraft.recipe.Recipe;
7-
import net.minecraft.registry.tag.TagEntry;
8-
import net.minecraft.registry.tag.TagGroupLoader;
9-
import net.minecraft.resource.DependencyTracker;
6+
import net.minecraft.tag.TagEntry;
7+
import net.minecraft.tag.TagGroupLoader;
108
import net.minecraft.util.Identifier;
119
import net.minecraft.util.Pair;
1210
import org.jetbrains.annotations.Nullable;
@@ -67,26 +65,38 @@ public Map<Identifier, Collection<T>> buildGroup(Map<Identifier, List<TrackedEnt
6765
@Nullable @Override public Collection<T> tag(Identifier id) { return map.get(id); }
6866
};
6967

70-
DependencyTracker<Identifier, TagDependencies> dependencyTracker = new DependencyTracker<>();
71-
72-
tags.forEach((id, entries) -> dependencyTracker.add(id, new TagDependencies(entries)));
73-
74-
dependencyTracker.traverse((id, dependencies) -> {
75-
var pair = this.resolveAll(valueGetter, dependencies.entries());
76-
77-
var missingReferences = pair.getLeft();
78-
79-
if(!missingReferences.isEmpty()){
80-
LOGGER.error(
81-
"Couldn't load the given entries within tag {}: {}",
82-
id,
83-
missingReferences.stream().map(Objects::toString).collect(Collectors.joining(", "))
68+
Multimap<Identifier, Identifier> multimap = HashMultimap.create();
69+
tags.forEach(
70+
(tagId, entries) -> entries.forEach(entry -> entry.entry().forEachRequiredTagId(referencedTagId -> addReference(multimap, tagId, referencedTagId)))
71+
);
72+
tags.forEach(
73+
(tagId, entries) -> entries.forEach(entry -> entry.entry().forEachOptionalTagId(referencedTagId -> addReference(multimap, tagId, referencedTagId)))
74+
);
75+
Set<Identifier> set = Sets.newHashSet();
76+
tags.keySet()
77+
.forEach(
78+
tagId -> resolveAll(
79+
tags,
80+
multimap,
81+
set,
82+
tagId,
83+
(tagId2, entries) -> {
84+
var pair = this.resolveAll(valueGetter, entries);
85+
86+
var missingReferences = pair.getLeft();
87+
88+
if(!missingReferences.isEmpty()){
89+
LOGGER.error(
90+
"Couldn't load the given entries within tag {}: {}",
91+
tagId2,
92+
missingReferences.stream().map(Objects::toString).collect(Collectors.joining(", "))
93+
);
94+
}
95+
96+
map.put(tagId2, pair.getRight());
97+
}
98+
)
8499
);
85-
}
86-
87-
map.put(id, pair.getRight());
88-
});
89-
90100
return map;
91101
}
92102
}

src/main/java/wraith/alloyforgery/data/RecipeTagLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
66
import net.fabricmc.fabric.api.resource.IdentifiableResourceReloadListener;
77
import net.minecraft.recipe.Recipe;
8-
import net.minecraft.registry.tag.TagGroupLoader;
8+
import net.minecraft.tag.TagGroupLoader;
99
import net.minecraft.resource.LifecycledResourceManager;
1010
import net.minecraft.resource.ResourceManager;
1111
import net.minecraft.resource.SinglePreparationResourceReloader;

src/main/java/wraith/alloyforgery/recipe/AlloyForgeRecipe.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ public ItemStack getOutput() {
234234
*/
235235
@ApiStatus.Internal
236236
public ItemStack getBaseOutput() {
237+
return this.output.copy();
237238
}
238239

239240
public ItemStack getOutput(int forgeTier) {

src/main/java/wraith/alloyforgery/recipe/BlastFurnaceRecipeAdapter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import net.minecraft.recipe.BlastingRecipe;
77
import net.minecraft.recipe.Recipe;
88
import net.minecraft.recipe.RecipeType;
9-
import net.minecraft.registry.Registries;
10-
import net.minecraft.registry.RegistryKeys;
11-
import net.minecraft.registry.tag.TagKey;
9+
import net.minecraft.tag.TagKey;
10+
import net.minecraft.tag.TagKey;
1211
import net.minecraft.util.Identifier;
12+
import net.minecraft.util.registry.Registry;
1313
import wraith.alloyforgery.AlloyForgery;
1414
import wraith.alloyforgery.forges.ForgeDefinition;
1515
import wraith.alloyforgery.utils.RecipeInjector;
@@ -25,7 +25,7 @@
2525
*/
2626
public class BlastFurnaceRecipeAdapter implements RecipeInjector.AddRecipes {
2727

28-
private static final TagKey<Item> DUSTS_TAG = TagKey.of(RegistryKeys.ITEM, new Identifier("c", "dusts"));
28+
private static final TagKey<Item> DUSTS_TAG = TagKey.of(Registry.ITEM_KEY, new Identifier("c", "dusts"));
2929

3030
/**
3131
* Recipe tag for all {@link RecipeType#BLASTING} recipes to be disallowed for adaption
@@ -53,7 +53,7 @@ public void addRecipes(RecipeInjector instance) {
5353
path = path.replace("blasting", "forging");
5454
}
5555

56-
var mainOutput = recipe.getOutput(null);
56+
var mainOutput = recipe.getOutput();
5757

5858
var extraOutput = ImmutableMap.<AlloyForgeRecipe.OverrideRange, ItemStack>builder();
5959

@@ -113,7 +113,7 @@ private static boolean isDustRecipe(Recipe<?> blastRecipe){
113113
for (ItemStack stack : inputIngredient.getMatchingStacks()) {
114114
if(stack.isIn(DUSTS_TAG)) return true;
115115

116-
Identifier id = Registries.ITEM.getId(stack.getItem());
116+
Identifier id = Registry.ITEM.getId(stack.getItem());
117117

118118
if(id.getPath().contains("dust")) return true;
119119
}

src/main/java/wraith/alloyforgery/utils/RecipeInjector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import net.minecraft.recipe.Recipe;
1010
import net.minecraft.recipe.RecipeManager;
1111
import net.minecraft.recipe.RecipeType;
12-
import net.minecraft.registry.Registries;
12+
import net.minecraft.util.registry.Registry;
1313
import net.minecraft.server.MinecraftServer;
1414
import net.minecraft.util.Identifier;
1515
import org.slf4j.Logger;
@@ -57,7 +57,7 @@ public RecipeInjector(RecipeManager manager){
5757
* @param <T> Type of the given Recipe
5858
*/
5959
public <T extends Recipe<C>, C extends Inventory> void addRecipe(T recipe){
60-
if(Registries.RECIPE_TYPE.getId(recipe.getType()) == null){
60+
if(Registry.RECIPE_TYPE.getId(recipe.getType()) == null){
6161
throw new IllegalStateException("Unable to add Recipe for a RecipeType not registered!");
6262
}
6363

0 commit comments

Comments
 (0)