|
1 | 1 | package org.cyclops.integratedscripting.evaluate.translation; |
2 | 2 |
|
| 3 | +import com.google.common.collect.Maps; |
3 | 4 | import com.google.common.collect.Sets; |
| 5 | +import net.minecraft.SharedConstants; |
4 | 6 | import net.minecraft.nbt.*; |
5 | 7 | import net.minecraft.network.chat.MutableComponent; |
6 | 8 | import net.minecraft.resources.ResourceLocation; |
|
9 | 11 | import net.minecraft.world.item.Items; |
10 | 12 | import net.minecraft.world.level.block.Blocks; |
11 | 13 | import net.minecraft.world.level.material.Fluids; |
| 14 | +import net.neoforged.fml.loading.LoadingModList; |
12 | 15 | import net.neoforged.neoforge.fluids.FluidStack; |
| 16 | +import org.cyclops.commoncapabilities.api.capability.itemhandler.ItemMatch; |
| 17 | +import org.cyclops.commoncapabilities.ingredient.DataComparator; |
| 18 | +import org.cyclops.cyclopscore.helper.CyclopsCoreInstance; |
13 | 19 | import org.cyclops.integrateddynamics.api.evaluate.EvaluationException; |
14 | 20 | import org.cyclops.integrateddynamics.api.evaluate.operator.IOperator; |
15 | 21 | import org.cyclops.integrateddynamics.api.evaluate.variable.IValue; |
|
28 | 34 | import org.junit.Test; |
29 | 35 |
|
30 | 36 | import java.io.IOException; |
| 37 | +import java.util.Collections; |
31 | 38 | import java.util.Iterator; |
32 | 39 |
|
33 | 40 | import static org.hamcrest.CoreMatchers.equalTo; |
|
39 | 46 | */ |
40 | 47 | public class ValueTranslatorsJavaScriptTests { |
41 | 48 |
|
42 | | - static { |
43 | | - Bootstrap.bootStrap(); |
44 | | - } |
45 | | - |
46 | 49 | private static ValueDeseralizationContext VDC = null; |
47 | 50 | private static Context CTX = null; |
48 | 51 | private static IEvaluationExceptionFactory EF = ScriptHelpers.getDummyEvaluationExceptionFactory(); |
49 | 52 |
|
50 | 53 | @BeforeClass |
51 | 54 | public static void beforeAll() { |
| 55 | + CyclopsCoreInstance.MOD = new ModBaseMocked(); |
| 56 | + // Derived from NeoForge's JUnitMain |
| 57 | + SharedConstants.tryDetectVersion(); |
| 58 | + LoadingModList.of(Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Maps.newHashMap()); |
| 59 | + Bootstrap.bootStrap(); |
| 60 | + ItemMatch.DATA_COMPARATOR = new DataComparator(null); |
| 61 | + |
52 | 62 | ValueTypeListProxyFactories.load(); |
53 | 63 | Operators.load(); |
54 | 64 | ValueTranslators.load(); |
@@ -470,7 +480,7 @@ public void testObjectItemBidirectional() throws EvaluationException { |
470 | 480 |
|
471 | 481 | @Test |
472 | 482 | public void testObjectItemMethods() throws EvaluationException { |
473 | | - assertThat(ValueTranslators.REGISTRY.translateToGraal(CTX, ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.ARROW)), EF, VDC).invokeMember("canBurn").asBoolean(), is(false)); |
| 483 | + assertThat(ValueTranslators.REGISTRY.translateToGraal(CTX, ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.ARROW)), EF, VDC).invokeMember("isEnchanted").asBoolean(), is(false)); |
474 | 484 |
|
475 | 485 | assertThat(ValueTranslators.REGISTRY.translateToGraal(CTX, ValueObjectTypeItemStack.ValueItemStack.of(new ItemStack(Items.ACACIA_SAPLING)), EF, VDC).invokeMember("block").invokeMember("plantAge").asInt(), is(0)); |
476 | 486 |
|
|
0 commit comments