11package dev .isxander .debugify .test .suites ;
22
33import dev .isxander .debugify .test .DebugifyTestUtils ;
4- import net .fabricmc .fabric .api .gametest .v1 .FabricGameTest ;
4+ import net .fabricmc .fabric .api .gametest .v1 .GameTest ;
55import net .minecraft .core .BlockPos ;
6- import net .minecraft .gametest .framework .GameTest ;
76import net .minecraft .gametest .framework .GameTestHelper ;
7+ import net .minecraft .network .chat .Component ;
88import net .minecraft .tags .BlockTags ;
99import net .minecraft .world .level .block .*;
1010import net .minecraft .world .level .block .state .BlockState ;
1717 * @author Ampflower
1818 * @since 1.20.1+1.2
1919 **/
20- public class MC8187 implements FabricGameTest {
20+ public class MC8187 {
2121 private static final String TEMPLATE = "debugify:mc-8187" ;
2222
2323 // Adjust this if you move the center, as the tests assume this is accurate.
@@ -36,7 +36,7 @@ public class MC8187 implements FabricGameTest {
3636 */
3737 private static void testTreeRandomTick (GameTestHelper ctx , Block sapling , Block log , BlockPos growCorner , boolean small ) {
3838 // Ensure that parameters are correct.
39- ctx .assertTrue (sapling instanceof SaplingBlock , sapling + " is not a sapling" );
39+ ctx .assertTrue (sapling instanceof SaplingBlock , Component . literal ( sapling + " is not a sapling" ) );
4040 testTreeParamCommon (ctx , sapling , log , growCorner , true );
4141
4242 // Setup
@@ -52,7 +52,7 @@ private static void testTreeRandomTick(GameTestHelper ctx, Block sapling, Block
5252 */
5353 private static void testTreeBonemeal (GameTestHelper ctx , Block sapling , Block log , BlockPos growCorner , boolean small ) {
5454 // Ensure that parameters are correct.
55- ctx .assertTrue (sapling instanceof SaplingBlock , sapling + " is not a sapling" );
55+ ctx .assertTrue (sapling instanceof SaplingBlock , Component . literal ( sapling + " is not a sapling" ) );
5656 testTreeParamCommon (ctx , sapling , log , growCorner , false );
5757
5858 // Setup
@@ -68,7 +68,7 @@ private static void testTreeBonemeal(GameTestHelper ctx, Block sapling, Block lo
6868 */
6969 private static void testAzalea (GameTestHelper ctx , Block sapling , Block log , BlockPos growCorner ) {
7070 // Ensure that parameters are correct.
71- ctx .assertTrue (sapling instanceof AzaleaBlock , sapling + " is not a sapling" );
71+ ctx .assertTrue (sapling instanceof AzaleaBlock , Component . literal ( sapling + " is not a sapling" ) );
7272 testTreeParamCommon (ctx , sapling , log , growCorner , false );
7373
7474 DebugifyTestUtils .bonemealIndefinitely (ctx , growCorner );
@@ -82,9 +82,9 @@ private static void testAzalea(GameTestHelper ctx, Block sapling, Block log, Blo
8282 * This is to catch errors quickly as the input is sensitive to off by 1 errors.
8383 */
8484 private static void testTreeParamCommon (GameTestHelper ctx , Block sapling , Block log , BlockPos growCorner , boolean requiresDay ) {
85- ctx .assertTrue (log instanceof RotatedPillarBlock , log + " does not appear like a log" );
85+ ctx .assertTrue (log instanceof RotatedPillarBlock , Component . literal ( log + " does not appear like a log" ) );
8686 ctx .assertTrue (growCorner .getY () == START_CORNER .getY (),
87- "Incorrect Y, got " + growCorner .getY () + ", expected " + START_CORNER .getY ());
87+ Component . literal ( "Incorrect Y, got " + growCorner .getY () + ", expected " + START_CORNER .getY () ));
8888
8989 // Ensure that the structure is correctly set up.
9090 assertSuitable (ctx , requiresDay );
@@ -97,86 +97,86 @@ private static void testTreeCommon(GameTestHelper ctx, BlockState sapling, Block
9797 DebugifyTestUtils .fill (ctx , START_CORNER , END_CORNER , sapling );
9898
9999 if (small ) {
100- ctx .succeedWhen (() -> ctx .assertBlock (growCorner , block -> block == log , "Incorrect log, expected " + log ));
100+ ctx .succeedWhen (() -> ctx .assertBlock (growCorner , block -> block == log , block -> Component . literal ( "Incorrect log, expected " + log ) ));
101101 } else {
102102 ctx .succeedWhen (() -> DebugifyTestUtils .assertBlockFill (ctx , START_CORNER , END_CORNER , block -> block == log ,
103103 "Incorrect log, expected " + log ));
104104 }
105105 }
106106
107- @ GameTest (template = TEMPLATE , batch = "daylight" )
107+ @ GameTest (structure = TEMPLATE , skyAccess = true )
108108 public void oak_randomTick_NW (GameTestHelper ctx ) {
109109 testTreeRandomTick (ctx , Blocks .OAK_SAPLING , Blocks .OAK_LOG , START_CORNER , true );
110110 }
111111
112- @ GameTest (template = TEMPLATE , batch = "daylight" )
112+ @ GameTest (structure = TEMPLATE , skyAccess = true )
113113 public void birch_randomTick_NW (GameTestHelper ctx ) {
114114 testTreeRandomTick (ctx , Blocks .BIRCH_SAPLING , Blocks .BIRCH_LOG , START_CORNER , true );
115115 }
116116
117- @ GameTest (template = TEMPLATE , batch = "daylight" )
117+ @ GameTest (structure = TEMPLATE , skyAccess = true )
118118 public void spruce_randomTick_NW (GameTestHelper ctx ) {
119119 testTreeRandomTick (ctx , Blocks .SPRUCE_SAPLING , Blocks .SPRUCE_LOG , START_CORNER , false );
120120 }
121121
122- @ GameTest (template = TEMPLATE , batch = "daylight" )
122+ @ GameTest (structure = TEMPLATE , skyAccess = true )
123123 public void jungle_randomTick_NW (GameTestHelper ctx ) {
124124 testTreeRandomTick (ctx , Blocks .JUNGLE_SAPLING , Blocks .JUNGLE_LOG , START_CORNER , false );
125125 }
126126
127- @ GameTest (template = TEMPLATE , batch = "daylight" )
127+ @ GameTest (structure = TEMPLATE , skyAccess = true )
128128 public void acacia_randomTick_NW (GameTestHelper ctx ) {
129129 testTreeRandomTick (ctx , Blocks .ACACIA_SAPLING , Blocks .ACACIA_LOG , START_CORNER , true );
130130 }
131131
132- @ GameTest (template = TEMPLATE , batch = "daylight" )
132+ @ GameTest (structure = TEMPLATE , skyAccess = true )
133133 public void darkOak_randomTick_NW (GameTestHelper ctx ) {
134134 testTreeRandomTick (ctx , Blocks .DARK_OAK_SAPLING , Blocks .DARK_OAK_LOG , START_CORNER , false );
135135 }
136136
137- @ GameTest (template = TEMPLATE , batch = "daylight" )
137+ @ GameTest (structure = TEMPLATE , skyAccess = true )
138138 public void cherry_randomTick_NW (GameTestHelper ctx ) {
139139 testTreeRandomTick (ctx , Blocks .CHERRY_SAPLING , Blocks .CHERRY_LOG , START_CORNER , true );
140140 }
141141
142142
143- @ GameTest (template = TEMPLATE )
143+ @ GameTest (structure = TEMPLATE )
144144 public void oak_bonemeal_NW (GameTestHelper ctx ) {
145145 testTreeBonemeal (ctx , Blocks .OAK_SAPLING , Blocks .OAK_LOG , START_CORNER , true );
146146 }
147147
148- @ GameTest (template = TEMPLATE )
148+ @ GameTest (structure = TEMPLATE )
149149 public void birch_bonemeal_NW (GameTestHelper ctx ) {
150150 testTreeBonemeal (ctx , Blocks .BIRCH_SAPLING , Blocks .BIRCH_LOG , START_CORNER , true );
151151 }
152152
153- @ GameTest (template = TEMPLATE )
153+ @ GameTest (structure = TEMPLATE )
154154 public void spruce_bonemeal_NW (GameTestHelper ctx ) {
155155 testTreeBonemeal (ctx , Blocks .SPRUCE_SAPLING , Blocks .SPRUCE_LOG , START_CORNER , false );
156156 }
157157
158- @ GameTest (template = TEMPLATE )
158+ @ GameTest (structure = TEMPLATE )
159159 public void jungle_bonemeal_NW (GameTestHelper ctx ) {
160160 testTreeBonemeal (ctx , Blocks .JUNGLE_SAPLING , Blocks .JUNGLE_LOG , START_CORNER , false );
161161 }
162162
163- @ GameTest (template = TEMPLATE )
163+ @ GameTest (structure = TEMPLATE )
164164 public void acacia_bonemeal_NW (GameTestHelper ctx ) {
165165 testTreeBonemeal (ctx , Blocks .ACACIA_SAPLING , Blocks .ACACIA_LOG , START_CORNER , true );
166166 }
167167
168- @ GameTest (template = TEMPLATE )
168+ @ GameTest (structure = TEMPLATE )
169169 public void darkOak_bonemeal_NW (GameTestHelper ctx ) {
170170 testTreeBonemeal (ctx , Blocks .DARK_OAK_SAPLING , Blocks .DARK_OAK_LOG , START_CORNER , false );
171171 }
172172
173- @ GameTest (template = TEMPLATE )
173+ @ GameTest (structure = TEMPLATE )
174174 public void cherry_bonemeal_NW (GameTestHelper ctx ) {
175175 testTreeBonemeal (ctx , Blocks .CHERRY_SAPLING , Blocks .CHERRY_LOG , START_CORNER , true );
176176 }
177177
178178 // The following two needs to be special-cased.
179- @ GameTest (template = TEMPLATE )
179+ @ GameTest (structure = TEMPLATE )
180180 public void azaleaNW (GameTestHelper ctx ) {
181181 testAzalea (ctx , Blocks .AZALEA , Blocks .OAK_LOG , START_CORNER );
182182 }
@@ -199,6 +199,6 @@ private static void assertSuitable(GameTestHelper ctx, boolean requiresDay) {
199199 final var pos = CORNER ;
200200 DebugifyTestUtils .assertBlockStateFill (ctx , pos , pos .offset (1 , 0 , 1 ), b -> b .is (BlockTags .DIRT ), "Invalid template; not dirt" );
201201 DebugifyTestUtils .assertBlockFill (ctx , pos .above (), pos .offset (1 , 1 , 1 ), b -> b == Blocks .AIR , "Invalid template; not air" );
202- ctx .assertBlockState (pos .offset (-1 , 1 , -1 ), b -> !b .canBeReplaced (), () -> "Invalid template; NW block not solid" );
202+ ctx .assertBlockState (pos .offset (-1 , 1 , -1 ), b -> !b .canBeReplaced (), block -> Component . literal ( "Invalid template; NW block not solid" ) );
203203 }
204204}
0 commit comments