mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-14 10:15:38 +01:00
Make loading of ingredients more reliable
This commit is contained in:
parent
0e02355cca
commit
af37f248ce
@ -471,13 +471,15 @@ public class BIngredients {
|
||||
List<Ingredient> ing = new ArrayList<>(size);
|
||||
for (; size > 0; size--) {
|
||||
ItemLoader itemLoader = new ItemLoader(dataVersion, in, in.readUTF());
|
||||
if (Ingredient.LOADERS.containsKey(itemLoader.getSaveID())) {
|
||||
Ingredient loaded = Ingredient.LOADERS.get(itemLoader.getSaveID()).apply(itemLoader);
|
||||
int amount = in.readShort();
|
||||
if (loaded != null) {
|
||||
loaded.setAmount(amount);
|
||||
ing.add(loaded);
|
||||
}
|
||||
if (!Ingredient.LOADERS.containsKey(itemLoader.getSaveID())) {
|
||||
P.p.errorLog("Ingredient Loader not found: " + itemLoader.getSaveID());
|
||||
break;
|
||||
}
|
||||
Ingredient loaded = Ingredient.LOADERS.get(itemLoader.getSaveID()).apply(itemLoader);
|
||||
int amount = in.readShort();
|
||||
if (loaded != null) {
|
||||
loaded.setAmount(amount);
|
||||
ing.add(loaded);
|
||||
}
|
||||
}
|
||||
return new BIngredients(ing, cookedTime);
|
||||
|
@ -132,8 +132,9 @@ public class SimpleItem extends RecipeItem implements Ingredient {
|
||||
try {
|
||||
DataInputStream in = loader.getInputStream();
|
||||
Material mat = Material.getMaterial(in.readUTF());
|
||||
short dur = in.readShort();
|
||||
if (mat != null) {
|
||||
SimpleItem item = new SimpleItem(mat, in.readShort());
|
||||
SimpleItem item = new SimpleItem(mat, dur);
|
||||
return item;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user