Skip to content

Commit

Permalink
Add fabric test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotori316 committed Dec 7, 2024
1 parent a90e734 commit 1d5b3ae
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fabric/game-test/server.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Minecraft server properties
#Sun Dec 01 00:54:35 JST 2024
#Sat Dec 07 23:11:08 JST 2024
accepts-transfers=false
allow-flight=true
allow-nether=true
Expand Down
38 changes: 38 additions & 0 deletions fabric/src/gameTest/java/com/yogpc/qp/fabric/EnchantmentTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.yogpc.qp.fabric;

import com.yogpc.qp.PlatformAccess;
import com.yogpc.qp.gametest.GameTestFunctions;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
import net.minecraft.gametest.framework.GameTest;
import net.minecraft.gametest.framework.GameTestHelper;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantments;

import static org.junit.jupiter.api.Assertions.assertTrue;

public final class EnchantmentTest implements FabricGameTest {

@GameTest(template = EMPTY_STRUCTURE)
public void quarryEnchantmentEfficiency(GameTestHelper helper) {
var enchantment = GameTestFunctions.getEnchantment(helper, Enchantments.EFFICIENCY);
var stack = new ItemStack(PlatformAccess.getAccess().registerObjects().quarryBlock().get());
assertTrue(enchantment.value().canEnchant(stack));
helper.succeed();
}

@GameTest(template = EMPTY_STRUCTURE)
public void quarryEnchantmentUnbreaking(GameTestHelper helper) {
var enchantment = GameTestFunctions.getEnchantment(helper, Enchantments.UNBREAKING);
var stack = new ItemStack(PlatformAccess.getAccess().registerObjects().quarryBlock().get());
assertTrue(enchantment.value().canEnchant(stack));
helper.succeed();
}

@GameTest(template = EMPTY_STRUCTURE)
public void quarryEnchantmentFortune(GameTestHelper helper) {
var enchantment = GameTestFunctions.getEnchantment(helper, Enchantments.FORTUNE);
var stack = new ItemStack(PlatformAccess.getAccess().registerObjects().quarryBlock().get());
assertTrue(enchantment.value().canEnchant(stack));
helper.succeed();
}
}
1 change: 1 addition & 0 deletions fabric/src/gameTest/java/com/yogpc/qp/fabric/LoadTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static void register() {
field.setAccessible(true);
var map = (Map<Class<?>, String>) field.get(null);
map.put(LoadTest.class, QuarryPlus.modID);
map.put(EnchantmentTest.class, QuarryPlus.modID);

GameTestRegistry.register(LoadTest.class);
QuarryPlus.LOGGER.info("Registered GameTest for Fabric");
Expand Down
2 changes: 1 addition & 1 deletion forge/game-test/server.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Minecraft server properties
#Sun Dec 01 00:54:38 JST 2024
#Sat Dec 07 23:11:09 JST 2024
accepts-transfers=false
allow-flight=true
allow-nether=true
Expand Down
2 changes: 1 addition & 1 deletion neoforge/game-test/server.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Minecraft server properties
#Sun Dec 01 00:54:36 JST 2024
#Sat Dec 07 23:11:33 JST 2024
accepts-transfers=false
allow-flight=true
allow-nether=true
Expand Down

0 comments on commit 1d5b3ae

Please sign in to comment.