Fix custom ingredients not being read correctly over the network. (#7980)

This commit is contained in:
Sirttas authored and GitHub committed 2021-08-09 12:09:24 -07:00
1 parent dbdc345d4a
commit 4721d4c461
1 file changed
+9 -1
@@ -62,7 +62,15 @@
public static Ingredient m_43938_(Stream<? extends Ingredient.Value> p_43939_) {
Ingredient ingredient = new Ingredient(p_43939_);
return ingredient.f_43902_.length == 0 ? f_43901_ : ingredient;
@@ -146,6 +_,8 @@
@@ -141,11 +_,15 @@
}
public static Ingredient m_43940_(FriendlyByteBuf p_43941_) {
- return m_43938_(p_43941_.m_178366_(FriendlyByteBuf::m_130267_).stream().map(Ingredient.ItemValue::new));
+ var size = p_43941_.m_130242_();
+ if (size == -1) return net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_43941_.m_130281_(), p_43941_);
+ return m_43938_(Stream.generate(() -> new Ingredient.ItemValue(p_43941_.m_130267_())).limit(size));
}
public static Ingredient m_43917_(@Nullable JsonElement p_43918_) {
if (p_43918_ != null && !p_43918_.isJsonNull()) {