Skip to content

Commit dcfd256

Browse files
committed
Remove backwards-compat for old pendingIngredientInstances storage
1 parent a752d86 commit dcfd256

1 file changed

Lines changed: 5 additions & 31 deletions

File tree

src/main/java/org/cyclops/integratedcrafting/core/CraftingJobHandler.java

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@ public void readFromNBT(HolderLookup.Provider lookupProvider, CompoundTag tag) {
150150
CompoundTag entryTag = (CompoundTag) entry;
151151

152152
List<Map<IngredientComponent<?, ?>, List<IPrototypedIngredient<?, ?>>>> pendingIngredientInstanceEntries = Lists.newArrayList();
153-
if (entryTag.contains("pendingIngredientInstances")) {
154-
// TODO: for backwards-compatibility, remove this in the next major update
153+
ListTag ingredientsEntries = entryTag.getList("pendingIngredientInstanceEntries", Tag.TAG_LIST);
154+
for (Tag ingredientEntry : ingredientsEntries) {
155+
ListTag pendingIngredientsList = (ListTag) ingredientEntry;
156+
155157
Map<IngredientComponent<?, ?>, List<IPrototypedIngredient<?, ?>>> pendingIngredientInstances = Maps.newIdentityHashMap();
156-
ListTag pendingIngredientsList = entryTag.getList("pendingIngredientInstances", Tag.TAG_COMPOUND);
157158
for (Tag pendingIngredient : pendingIngredientsList) {
158159
CompoundTag pendingIngredientTag = (CompoundTag) pendingIngredient;
159160
String componentName = pendingIngredientTag.getString("ingredientComponent");
@@ -173,35 +174,8 @@ public void readFromNBT(HolderLookup.Provider lookupProvider, CompoundTag tag) {
173174

174175
pendingIngredientInstances.put(ingredientComponent, pendingIngredients);
175176
}
176-
pendingIngredientInstanceEntries.add(pendingIngredientInstances);
177-
} else {
178-
ListTag ingredientsEntries = entryTag.getList("pendingIngredientInstanceEntries", Tag.TAG_LIST);
179-
for (Tag ingredientEntry : ingredientsEntries) {
180-
ListTag pendingIngredientsList = (ListTag) ingredientEntry;
181-
182-
Map<IngredientComponent<?, ?>, List<IPrototypedIngredient<?, ?>>> pendingIngredientInstances = Maps.newIdentityHashMap();
183-
for (Tag pendingIngredient : pendingIngredientsList) {
184-
CompoundTag pendingIngredientTag = (CompoundTag) pendingIngredient;
185-
String componentName = pendingIngredientTag.getString("ingredientComponent");
186-
IngredientComponent<?, ?> ingredientComponent = IngredientComponent.REGISTRY.getValue(ResourceLocation.parse(componentName));
187-
if (ingredientComponent == null) {
188-
throw new IllegalArgumentException("Could not find the ingredient component type " + componentName);
189-
}
190-
IIngredientSerializer serializer = ingredientComponent.getSerializer();
191-
192-
List<IPrototypedIngredient<?, ?>> pendingIngredients = Lists.newArrayList();
193-
for (Tag instanceTagUnsafe : pendingIngredientTag.getList("instances", Tag.TAG_COMPOUND)) {
194-
CompoundTag instanceTag = (CompoundTag) instanceTagUnsafe;
195-
Object instance = serializer.deserializeInstance(lookupProvider, instanceTag.get("prototype"));
196-
Object condition = serializer.deserializeCondition(instanceTag.get("condition"));
197-
pendingIngredients.add(new PrototypedIngredient(ingredientComponent, instance, condition));
198-
}
199177

200-
pendingIngredientInstances.put(ingredientComponent, pendingIngredients);
201-
}
202-
203-
pendingIngredientInstanceEntries.add(pendingIngredientInstances);
204-
}
178+
pendingIngredientInstanceEntries.add(pendingIngredientInstances);
205179
}
206180

207181
CraftingJob craftingJob = CraftingJob.deserialize(lookupProvider, entryTag.getCompound("craftingJob"));

0 commit comments

Comments
 (0)