Skip to content

Commit

Permalink
Fix room generation tests and core refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
robotgryphon committed Feb 23, 2024
1 parent b1a047c commit 7730546
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Compo

if (sneaking && worldIn != null) {
getTemplate(worldIn.registryAccess(), stack).ifPresent(actualTemplate -> {
final var roomDimensions = actualTemplate.dimensions();
final var roomDimensions = actualTemplate.internalDimensions();
tooltip.add(Component.literal("Size: " + roomDimensions.toShortString()).withStyle(ChatFormatting.YELLOW));

final var templateId = getTemplateId(stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import net.minecraft.gametest.framework.GameTestGenerator;
import net.minecraft.gametest.framework.GameTestHelper;
import net.minecraft.gametest.framework.TestFunction;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.gametest.GameTestHolder;
import net.neoforged.neoforge.gametest.PrefixGameTestTemplate;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -52,9 +54,10 @@ public static Collection<TestFunction> roomTests() {

private static void makeTemplateTest(GameTestHelper testHelper, RoomTemplate template) {
final AABB localBounds = TestUtil.localBounds(testHelper);
final AABB worldBounds = testHelper.getBounds();
final BlockPos testCenter = BlockPos.containing(localBounds.getCenter());

CompactRoomGenerator.generateRoom(testHelper.getLevel(), localBounds);
CompactRoomGenerator.generateRoom(testHelper.getLevel(), template.getBoundariesCenteredAt(worldBounds.getCenter()));

testHelper.setBlock(testCenter, Blocks.RED_STAINED_GLASS);
testHelper.succeed();
Expand Down

0 comments on commit 7730546

Please sign in to comment.