-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16740b6
commit 418b677
Showing
4 changed files
with
38 additions
and
9 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
specter-registry/src/testmod/java/dev/spiritstudios/testmod/SpecterRegistryGameTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package dev.spiritstudios.testmod; | ||
|
||
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest; | ||
import net.minecraft.test.GameTest; | ||
import net.minecraft.test.TestContext; | ||
import net.minecraft.util.math.BlockPos; | ||
|
||
@SuppressWarnings("unused") | ||
public class SpecterRegistryGameTest { | ||
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE) | ||
public void testRegistrar(TestContext context) { | ||
context.setBlockState(new BlockPos(0, 1, 0), SpecterRegistryTestBlockRegistrar.TEST_BLOCK); | ||
|
||
context.expectBlock(SpecterRegistryTestBlockRegistrar.TEST_BLOCK, new BlockPos(0, 1, 0)); | ||
context.complete(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...egistry/src/testmod/java/dev/spiritstudios/testmod/SpecterRegistryTestBlockRegistrar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.spiritstudios.testmod; | ||
|
||
import dev.spiritstudios.specter.api.registry.registration.BlockRegistrar; | ||
import net.minecraft.block.Block; | ||
|
||
@SuppressWarnings("unused") | ||
public class SpecterRegistryTestBlockRegistrar implements BlockRegistrar { | ||
public static final Block TEST_BLOCK = new Block(Block.Settings.copy(net.minecraft.block.Blocks.STONE)); | ||
} |
16 changes: 8 additions & 8 deletions
16
specter-registry/src/testmod/java/dev/spiritstudios/testmod/SpecterRegistryTestMod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
package dev.spiritstudios.testmod; | ||
|
||
import com.mojang.serialization.Codec; | ||
import dev.spiritstudios.specter.api.registry.attachment.Attachment; | ||
import dev.spiritstudios.specter.api.registry.registration.Registrar; | ||
import net.fabricmc.api.ModInitializer; | ||
|
||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.network.codec.PacketCodecs; | ||
import net.minecraft.registry.Registries; | ||
|
||
import dev.spiritstudios.specter.api.registry.attachment.Attachment; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class SpecterRegistryTestMod implements ModInitializer { | ||
|
||
public static final String MOD_ID = "specter-registry-testmod"; | ||
public static final Identifier ATTACHMENT_ID = Identifier.of(MOD_ID, "attachment_test"); | ||
public static final Attachment<Block, Integer> TEST_ATTACHMENT = Attachment.builder( | ||
Registries.BLOCK, | ||
ATTACHMENT_ID, | ||
Codec.INT, | ||
PacketCodecs.INTEGER.cast() | ||
Registries.BLOCK, | ||
ATTACHMENT_ID, | ||
Codec.INT, | ||
PacketCodecs.INTEGER.cast() | ||
).build(); | ||
|
||
@Override | ||
public void onInitialize() { | ||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { | ||
SpecterRegistryTestCommand.register(dispatcher); | ||
}); | ||
|
||
Registrar.process(SpecterRegistryTestBlockRegistrar.class, "specter-registry-testmod"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters