|
4 | 4 | import net.minecraft.core.BlockPos; |
5 | 5 | import net.minecraft.gametest.framework.GameTestAssertException; |
6 | 6 | import net.minecraft.gametest.framework.GameTestHelper; |
7 | | -import net.minecraft.nbt.Tag; |
| 7 | +import net.minecraft.nbt.CompoundTag; |
8 | 8 | import net.minecraft.nbt.TagParser; |
9 | 9 | import net.minecraft.network.chat.Component; |
10 | 10 | import net.minecraft.resources.Identifier; |
|
21 | 21 | import org.cyclops.integrateddynamics.RegistryEntries; |
22 | 22 | import org.cyclops.integrateddynamics.api.evaluate.variable.IValue; |
23 | 23 | import org.cyclops.integrateddynamics.api.evaluate.variable.IVariable; |
24 | | -import org.cyclops.integrateddynamics.api.evaluate.variable.ValueDeseralizationContext; |
25 | 24 | import org.cyclops.integrateddynamics.api.part.PartPos; |
26 | 25 | import org.cyclops.integrateddynamics.api.part.PartTarget; |
27 | 26 | import org.cyclops.integrateddynamics.api.part.write.IPartStateWriter; |
|
31 | 30 | import org.cyclops.integrateddynamics.core.evaluate.variable.Variable; |
32 | 31 | import org.cyclops.integrateddynamics.core.helper.PartHelpers; |
33 | 32 | import org.cyclops.integrateddynamics.core.part.event.PartVariableDrivenVariableContentsUpdatedEvent; |
| 33 | +import org.cyclops.integrateddynamics.core.test.TestHelpers; |
34 | 34 |
|
35 | 35 | import static org.cyclops.integratedcrafting.gametest.GameTestHelpersIntegratedCrafting.createBasicNetwork; |
36 | 36 | import static org.cyclops.integratedcrafting.gametest.GameTestHelpersIntegratedCrafting.enableRecipeInWriter; |
@@ -161,20 +161,19 @@ public void testAdvancementInsertRecipePlanks(GameTestHelper helper) { |
161 | 161 |
|
162 | 162 | // Deserialize the recipe value from the exact same SNBT that the advancement JSON expects. |
163 | 163 | // This guarantees ValuePredicate.test() will find equal values via ValueHelpers.areValuesEqual(). |
164 | | - Tag recipeTag; |
| 164 | + CompoundTag recipeTag; |
165 | 165 | try { |
166 | 166 | recipeTag = |
167 | | - TagParser.parseTag( |
| 167 | + TagParser.parseCompoundFully( |
168 | 168 | "{output:{\"minecraft:itemstack\":[{id:\"minecraft:oak_planks\",Count:4}]}," |
169 | 169 | + "input:{\"minecraft:itemstack\":[{val:[{condition:5,prototype:{id:\"minecraft:oak_log\",Count:1}}],type:0b}]}}"); |
170 | 170 | } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { |
171 | 171 | throw new RuntimeException(e); |
172 | 172 | } |
173 | 173 | IValue recipeValue = |
174 | | - ValueHelpers.deserializeRaw( |
175 | | - ValueDeseralizationContext.of(helper.getLevel()), |
176 | | - ValueTypes.OBJECT_RECIPE, |
177 | | - recipeTag); |
| 174 | + TestHelpers.deserialize( |
| 175 | + recipeTag, |
| 176 | + valueInput -> ValueHelpers.deserializeRaw(valueInput, ValueTypes.OBJECT_RECIPE)); |
178 | 177 | IVariable<?> variable = new Variable<>(recipeValue); |
179 | 178 |
|
180 | 179 | // Fire the event directly, mirroring what PartTypeInterfaceCrafting.State.reloadRecipe() does |
@@ -317,20 +316,19 @@ public void testAdvancementCraftCraftingWriterNegative(GameTestHelper helper) { |
317 | 316 | public void testAdvancementInsertRecipePlanksNegative(GameTestHelper helper) { |
318 | 317 | ServerPlayer player = helper.makeMockServerPlayerInLevel(); |
319 | 318 |
|
320 | | - Tag recipeTag; |
| 319 | + CompoundTag recipeTag; |
321 | 320 | try { |
322 | 321 | recipeTag = |
323 | | - TagParser.parseTag( |
| 322 | + TagParser.parseCompoundFully( |
324 | 323 | "{output:{\"minecraft:itemstack\":[{id:\"minecraft:oak_planks\",Count:4}]}," |
325 | 324 | + "input:{\"minecraft:itemstack\":[{val:[{condition:5,prototype:{id:\"minecraft:oak_log\",Count:1}}],type:0b}]}}"); |
326 | 325 | } catch (com.mojang.brigadier.exceptions.CommandSyntaxException e) { |
327 | 326 | throw new RuntimeException(e); |
328 | 327 | } |
329 | 328 | IValue recipeValue = |
330 | | - ValueHelpers.deserializeRaw( |
331 | | - ValueDeseralizationContext.of(helper.getLevel()), |
332 | | - ValueTypes.OBJECT_RECIPE, |
333 | | - recipeTag); |
| 329 | + TestHelpers.deserialize( |
| 330 | + recipeTag, |
| 331 | + valueInput -> ValueHelpers.deserializeRaw(valueInput, ValueTypes.OBJECT_RECIPE)); |
334 | 332 | IVariable<?> variable = new Variable<>(recipeValue); |
335 | 333 |
|
336 | 334 | // Fire with wrong part type (crafting_writer instead of interface_crafting) |
|
0 commit comments