Skip to content

Commit

Permalink
Add game tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Nov 25, 2024
1 parent d6af405 commit f290dce
Show file tree
Hide file tree
Showing 7 changed files with 1,116 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
public class RegistryEntries {

public static final DeferredHolderCommon<Item, Item> ITEM_CHEST = DeferredHolderCommon.create(Registries.ITEM, ResourceLocation.parse("minecraft:chest"));
public static final DeferredHolderCommon<Item, Item> ITEM_UPGRADE_TOOL = DeferredHolderCommon.create(Registries.ITEM, ResourceLocation.parse("colossalchests:upgrade_tool"));
public static final DeferredHolderCommon<Item, Item> ITEM_UPGRADE_TOOL_REVERSE = DeferredHolderCommon.create(Registries.ITEM, ResourceLocation.parse("colossalchests:upgrade_tool_reverse"));

public static final DeferredHolderCommon<Block, Block> BLOCK_UNCOLOSSAL_CHEST = DeferredHolderCommon.create(Registries.BLOCK, ResourceLocation.parse("colossalchests:uncolossal_chest"));

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ && consumeItems(player, requiredWalls, true))) {
tileInterface.setCorePosition(coreLocation.get());
}

RegistryEntries.TRIGGER_CHEST_FORMED.value().test((ServerPlayer) player, newType, size.getX() + 1);
if (player instanceof ServerPlayer serverPlayer) {
RegistryEntries.TRIGGER_CHEST_FORMED.value().test(serverPlayer, newType, size.getX() + 1);
}
}

// Add the lower tier items to the players inventory again.
Expand Down
Binary file not shown.
3 changes: 3 additions & 0 deletions loader-fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"entrypoints": {
"main": [
"org.cyclops.colossalchests.ColossalChestsFabric"
],
"fabric-gametest": [
"org.cyclops.colossalchests.gametest.GameTestsCommon"
]
},
"accessWidener" : "colossalchests.accesswidener",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.cyclops.colossalchests.gametest;

import net.minecraft.gametest.framework.GameTestGenerator;
import net.minecraft.gametest.framework.TestFunction;
import net.minecraftforge.gametest.GameTestHolder;
import org.cyclops.cyclopscore.gametest.GameTestLoaderHelpers;
import org.cyclops.colossalchests.Reference;

import java.util.Collection;

/**
* @author rubensworks
*/
@GameTestHolder(Reference.MOD_ID)
public class GameTestsLoaderForge extends GameTestsCommon {
@GameTestGenerator
public Collection<TestFunction> generateCommonTests() throws InstantiationException, IllegalAccessException {
return GameTestLoaderHelpers.generateCommonTests(Reference.MOD_ID, new Class[]{
GameTestsCommon.class
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.cyclops.colossalchests.gametest;

import net.minecraft.gametest.framework.GameTestGenerator;
import net.minecraft.gametest.framework.TestFunction;
import net.neoforged.neoforge.gametest.GameTestHolder;
import org.cyclops.colossalchests.Reference;
import org.cyclops.cyclopscore.gametest.GameTestLoaderHelpers;

import java.util.Collection;

/**
* @author rubensworks
*/
@GameTestHolder(Reference.MOD_ID)
public class GameTestsLoaderNeoForge extends GameTestsCommon {
@GameTestGenerator
public Collection<TestFunction> generateCommonTests() throws InstantiationException, IllegalAccessException {
return GameTestLoaderHelpers.generateCommonTests(Reference.MOD_ID, new Class[]{
GameTestsCommon.class
});
}
}

0 comments on commit f290dce

Please sign in to comment.