Skip to content

Commit 27e142a

Browse files
committed
more gametests
1 parent e2d99f4 commit 27e142a

File tree

10 files changed

+1191
-491
lines changed

10 files changed

+1191
-491
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package io.github.fusionflux.portalcubed_gametests.gametests;
2+
3+
import io.github.fusionflux.portalcubed_gametests.PortalCubedGameTests;
4+
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
5+
import net.minecraft.core.BlockPos;
6+
import net.minecraft.gametest.framework.GameTest;
7+
import net.minecraft.gametest.framework.GameTestHelper;
8+
import net.minecraft.world.level.block.RedstoneLampBlock;
9+
10+
public class ButtonGameTests implements FabricGameTest {
11+
private static final String GROUP = PortalCubedGameTests.ID + ":buttons/";
12+
13+
//Tests wind charges being able to activate pedestal buttons
14+
@GameTest(template = GROUP + "wind_charge_button")
15+
public void windChargeButton(GameTestHelper helper) {
16+
helper.pullLever(0, 1, 2);
17+
helper.pullLever(4, 5, 2);
18+
19+
helper.succeedWhen(() -> {
20+
helper.assertBlockProperty(new BlockPos(4, 1, 1), RedstoneLampBlock.LIT, false);
21+
helper.assertBlockProperty(new BlockPos(0, 5, 3), RedstoneLampBlock.LIT, false);
22+
});
23+
}
24+
}

src/gametests/java/io/github/fusionflux/portalcubed_gametests/gametests/PortalGameTests.java

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import net.minecraft.util.RandomSource;
1717
import net.minecraft.world.entity.EntityType;
1818
import net.minecraft.world.level.block.Blocks;
19+
import net.minecraft.world.level.block.CopperBulbBlock;
1920
import net.minecraft.world.level.block.RedstoneLampBlock;
2021
import net.minecraft.world.phys.Vec3;
2122

@@ -179,8 +180,8 @@ public void portalAgainstSolidBlocks(GameTestHelper helper) {
179180
verticalGrate.secondary().placeOn(new BlockPos(7, 2, 8), Direction.NORTH);
180181
horizontalGrate.secondary().placeOn(new BlockPos(2, 4, 6), Direction.DOWN, 0);
181182

182-
helper.setBlock(7, 3, 2, Blocks.AIR);
183-
helper.setBlock(2, 3, 2, Blocks.AIR);
183+
helper.setBlock(7, 3, 3, Blocks.AIR);
184+
helper.setBlock(2, 3, 3, Blocks.AIR);
184185

185186
helper.runAfterDelay(40, () -> helper.succeedWhen(() -> {
186187
helper.assertBlockProperty(new BlockPos(7, 1, 8), RedstoneLampBlock.LIT, false);
@@ -243,9 +244,51 @@ public void portalCommandCreate(GameTestHelper helper) {
243244
@GameTest(template = GROUP + "portal_command_remove")
244245
public void portalCommandRemove(GameTestHelper helper) {
245246

246-
//todo
247+
PortalHelper removeSingle = new PortalHelper(helper, "removesingle", 0x2055fe, 0xfe7020);
248+
PortalHelper removePair = new PortalHelper(helper, "removepair", 0x2055fe, 0xfe7020);
249+
250+
removeSingle.primary().placeOn(new BlockPos(0, 2, 4), Direction.NORTH);
251+
removePair.primary().placeOn(new BlockPos(2, 2, 4), Direction.NORTH);
252+
removePair.secondary().placeOn(new BlockPos(4, 2, 4), Direction.NORTH);
253+
254+
helper.runAfterDelay(20, () -> helper.pullLever(2, 1, 0));
255+
helper.succeedWhen(() -> {
256+
//removesingle.primary().assertNotPresent();
257+
//removepair.primary().assertNotPresent();
258+
//removepair.secondary().assertNotPresent();
259+
260+
helper.assertBlockPresent(Blocks.SPONGE, 0, 0, 0); //todo: leave this here until the portal existence checks are implemented, so the test doesn't pass instantly. Remove later
261+
});
247262
}
248263

264+
//Tests the "create" portion of the portal command
265+
@GameTest(template = GROUP + "projectiles_through_portals")
266+
public void projectilesThroughPortals(GameTestHelper helper) {
267+
268+
PortalHelper windCharge = new PortalHelper(helper, "wind_charge", 0x2055fe, 0xfe7020);
269+
PortalHelper snowball = new PortalHelper(helper, "snowball", 0x2055fe, 0xfe7020);
270+
PortalHelper fireworkRocket = new PortalHelper(helper, "firework_rocket", 0x2055fe, 0xfe7020);
271+
PortalHelper arrow = new PortalHelper(helper, "arrow", 0x2055fe, 0xfe7020);
272+
273+
windCharge.primary().shootFrom(new Vec3(1.5, 2, 4.5), Direction.UP);
274+
windCharge.secondary().shootFrom(new Vec3(1.5, 2.5, 1.5), Direction.DOWN);
275+
snowball.primary().shootFrom(new Vec3(3.5, 2, 4.5), Direction.UP);
276+
snowball.secondary().shootFrom(new Vec3(3.5, 2.5, 1.5), Direction.DOWN);
277+
fireworkRocket.primary().shootFrom(new Vec3(5.5, 2, 4.5), Direction.UP);
278+
fireworkRocket.secondary().shootFrom(new Vec3(5.5, 2.5, 1.5), Direction.DOWN);
279+
arrow.primary().shootFrom(new Vec3(7.5, 2, 4.5), Direction.UP);
280+
arrow.secondary().shootFrom(new Vec3(7.5, 2.5, 1.5), Direction.DOWN);
281+
282+
helper.pullLever(6, 1, 4);
283+
helper.pullLever(2, 1, 4);
284+
285+
helper.succeedWhen(() -> {
286+
helper.assertBlockProperty(new BlockPos(1, 4, 1), CopperBulbBlock.LIT, true);
287+
helper.assertBlockProperty(new BlockPos(3, 4, 1), CopperBulbBlock.LIT, true);
288+
helper.assertBlockProperty(new BlockPos(5, 4, 1), RedstoneLampBlock.LIT, true);
289+
helper.assertBlockProperty(new BlockPos(7, 4, 1), CopperBulbBlock.LIT, true);
290+
});
291+
}
249292

250293
//Tests portals becoming obstructed by solid blocks
251294
@GameTest(template = GROUP + "portal_become_obstructed")

src/gametests/java/io/github/fusionflux/portalcubed_gametests/gametests/PropGameTests.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public void burnCompanionCube(GameTestHelper helper) {
120120
}
121121

122122
//Tests dirty/charred props being washed when dropped into water
123-
//Note - add redirection cubes to this once they get added.
124123
@GameTest(template = GROUP + "prop_washing")
125124
public void propWashing(GameTestHelper helper) {
126125
Prop p2StorageCube = spawnDirtyProp(helper, PropType.STORAGE_CUBE, new BlockPos(1, 2, 1));
@@ -135,8 +134,33 @@ public void propWashing(GameTestHelper helper) {
135134
});
136135
}
137136

137+
//Tests dirty/charred props being washed when hit with splash/lingering water
138+
@GameTest(template = GROUP + "prop_washing_splash")
139+
public void propWashingSplash(GameTestHelper helper) {
140+
Prop p2StorageCube = spawnDirtyProp(helper, PropType.STORAGE_CUBE, new BlockPos(8, 2, 2));
141+
Prop p1CompanionCube = spawnDirtyProp(helper, PropType.PORTAL_1_COMPANION_CUBE, new BlockPos(1, 2, 2));
142+
143+
helper.pullLever(4, 1, 1);
144+
145+
helper.succeedWhen(() -> {
146+
assertPropVariant(helper, p2StorageCube, 0);
147+
assertPropVariant(helper, p1CompanionCube, 0);
148+
});
149+
}
150+
151+
//Tests dirty/charred props not being washed in goo
152+
@GameTest(template = GROUP + "prop_washing_goo")
153+
public void propWashingGoo(GameTestHelper helper) {
154+
Prop radio = spawnDirtyProp(helper, PropType.RADIO, new BlockPos(2, 4, 2));
155+
156+
helper.runAfterDelay(40, () ->
157+
helper.succeedIf(() -> { //wait for it to drop into the goo
158+
assertPropVariant(helper, radio, 1);
159+
})
160+
);
161+
}
162+
138163
//Tests dirty/charred props being washed when the weather is rain
139-
//Note - add redirection cubes to this once they get added
140164
@GameTest(template = GROUP + "prop_washing_in_rain", batch = Batches.RAINY, skyAccess = true)
141165
public void propWashingInRain(GameTestHelper helper) {
142166
Prop p2StorageCube = spawnDirtyProp(helper, PropType.STORAGE_CUBE, new BlockPos(1, 2, 1));
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
{
2+
DataVersion: 4189,
3+
size: [5, 7, 5],
4+
data: [
5+
{pos: [0, 0, 0], state: "minecraft:polished_andesite"},
6+
{pos: [0, 0, 1], state: "minecraft:polished_andesite"},
7+
{pos: [0, 0, 2], state: "minecraft:polished_andesite"},
8+
{pos: [0, 0, 3], state: "minecraft:polished_andesite"},
9+
{pos: [0, 0, 4], state: "minecraft:polished_andesite"},
10+
{pos: [1, 0, 0], state: "minecraft:polished_andesite"},
11+
{pos: [1, 0, 1], state: "minecraft:polished_andesite"},
12+
{pos: [1, 0, 2], state: "minecraft:polished_andesite"},
13+
{pos: [1, 0, 3], state: "minecraft:polished_andesite"},
14+
{pos: [1, 0, 4], state: "minecraft:polished_andesite"},
15+
{pos: [2, 0, 0], state: "minecraft:polished_andesite"},
16+
{pos: [2, 0, 1], state: "minecraft:polished_andesite"},
17+
{pos: [2, 0, 2], state: "minecraft:polished_andesite"},
18+
{pos: [2, 0, 3], state: "minecraft:polished_andesite"},
19+
{pos: [2, 0, 4], state: "minecraft:polished_andesite"},
20+
{pos: [3, 0, 0], state: "minecraft:polished_andesite"},
21+
{pos: [3, 0, 1], state: "minecraft:polished_andesite"},
22+
{pos: [3, 0, 2], state: "minecraft:polished_andesite"},
23+
{pos: [3, 0, 3], state: "minecraft:polished_andesite"},
24+
{pos: [3, 0, 4], state: "minecraft:polished_andesite"},
25+
{pos: [4, 0, 0], state: "minecraft:polished_andesite"},
26+
{pos: [4, 0, 1], state: "minecraft:polished_andesite"},
27+
{pos: [4, 0, 2], state: "minecraft:polished_andesite"},
28+
{pos: [4, 0, 3], state: "minecraft:polished_andesite"},
29+
{pos: [4, 0, 4], state: "minecraft:polished_andesite"},
30+
{pos: [0, 1, 0], state: "minecraft:air"},
31+
{pos: [0, 1, 1], state: "minecraft:air"},
32+
{pos: [0, 1, 2], state: "minecraft:lever{face:wall,facing:north,powered:false}"},
33+
{pos: [0, 1, 3], state: "minecraft:polished_andesite"},
34+
{pos: [0, 1, 4], state: "minecraft:air"},
35+
{pos: [1, 1, 0], state: "minecraft:air"},
36+
{pos: [1, 1, 1], state: "minecraft:air"},
37+
{pos: [1, 1, 2], state: "minecraft:air"},
38+
{pos: [1, 1, 3], state: "minecraft:dispenser{facing:up,triggered:false}", nbt: {Items: [{Slot: 0b, count: 64, id: "minecraft:wind_charge"}], id: "minecraft:dispenser"}},
39+
{pos: [1, 1, 4], state: "minecraft:air"},
40+
{pos: [2, 1, 0], state: "minecraft:air"},
41+
{pos: [2, 1, 1], state: "minecraft:air"},
42+
{pos: [2, 1, 2], state: "minecraft:air"},
43+
{pos: [2, 1, 3], state: "minecraft:air"},
44+
{pos: [2, 1, 4], state: "minecraft:air"},
45+
{pos: [3, 1, 0], state: "minecraft:air"},
46+
{pos: [3, 1, 1], state: "portalcubed:old_ap_pedestal_button{active:false,base:false,face:west,facing:north,offset:none,waterlogged:false}", nbt: {id: "portalcubed:pedestal_button", press_time: 60}},
47+
{pos: [3, 1, 2], state: "minecraft:air"},
48+
{pos: [3, 1, 3], state: "minecraft:air"},
49+
{pos: [3, 1, 4], state: "minecraft:air"},
50+
{pos: [4, 1, 0], state: "minecraft:air"},
51+
{pos: [4, 1, 1], state: "minecraft:redstone_lamp{lit:false}"},
52+
{pos: [4, 1, 2], state: "minecraft:air"},
53+
{pos: [4, 1, 3], state: "minecraft:air"},
54+
{pos: [4, 1, 4], state: "minecraft:air"},
55+
{pos: [0, 2, 0], state: "minecraft:air"},
56+
{pos: [0, 2, 1], state: "minecraft:air"},
57+
{pos: [0, 2, 2], state: "minecraft:air"},
58+
{pos: [0, 2, 3], state: "minecraft:polished_andesite"},
59+
{pos: [0, 2, 4], state: "minecraft:air"},
60+
{pos: [1, 2, 0], state: "minecraft:air"},
61+
{pos: [1, 2, 1], state: "minecraft:air"},
62+
{pos: [1, 2, 2], state: "minecraft:air"},
63+
{pos: [1, 2, 3], state: "minecraft:air"},
64+
{pos: [1, 2, 4], state: "minecraft:air"},
65+
{pos: [2, 2, 0], state: "minecraft:air"},
66+
{pos: [2, 2, 1], state: "minecraft:air"},
67+
{pos: [2, 2, 2], state: "minecraft:air"},
68+
{pos: [2, 2, 3], state: "minecraft:air"},
69+
{pos: [2, 2, 4], state: "minecraft:air"},
70+
{pos: [3, 2, 0], state: "minecraft:air"},
71+
{pos: [3, 2, 1], state: "minecraft:air"},
72+
{pos: [3, 2, 2], state: "minecraft:air"},
73+
{pos: [3, 2, 3], state: "minecraft:air"},
74+
{pos: [3, 2, 4], state: "minecraft:air"},
75+
{pos: [4, 2, 0], state: "minecraft:air"},
76+
{pos: [4, 2, 1], state: "minecraft:polished_andesite"},
77+
{pos: [4, 2, 2], state: "minecraft:air"},
78+
{pos: [4, 2, 3], state: "minecraft:air"},
79+
{pos: [4, 2, 4], state: "minecraft:air"},
80+
{pos: [0, 3, 0], state: "minecraft:air"},
81+
{pos: [0, 3, 1], state: "minecraft:air"},
82+
{pos: [0, 3, 2], state: "minecraft:air"},
83+
{pos: [0, 3, 3], state: "minecraft:polished_andesite"},
84+
{pos: [0, 3, 4], state: "minecraft:air"},
85+
{pos: [1, 3, 0], state: "minecraft:air"},
86+
{pos: [1, 3, 1], state: "minecraft:air"},
87+
{pos: [1, 3, 2], state: "minecraft:air"},
88+
{pos: [1, 3, 3], state: "minecraft:air"},
89+
{pos: [1, 3, 4], state: "minecraft:air"},
90+
{pos: [2, 3, 0], state: "minecraft:air"},
91+
{pos: [2, 3, 1], state: "minecraft:air"},
92+
{pos: [2, 3, 2], state: "minecraft:air"},
93+
{pos: [2, 3, 3], state: "minecraft:air"},
94+
{pos: [2, 3, 4], state: "minecraft:air"},
95+
{pos: [3, 3, 0], state: "minecraft:air"},
96+
{pos: [3, 3, 1], state: "minecraft:air"},
97+
{pos: [3, 3, 2], state: "minecraft:air"},
98+
{pos: [3, 3, 3], state: "minecraft:air"},
99+
{pos: [3, 3, 4], state: "minecraft:air"},
100+
{pos: [4, 3, 0], state: "minecraft:air"},
101+
{pos: [4, 3, 1], state: "minecraft:polished_andesite"},
102+
{pos: [4, 3, 2], state: "minecraft:air"},
103+
{pos: [4, 3, 3], state: "minecraft:air"},
104+
{pos: [4, 3, 4], state: "minecraft:air"},
105+
{pos: [0, 4, 0], state: "minecraft:air"},
106+
{pos: [0, 4, 1], state: "minecraft:air"},
107+
{pos: [0, 4, 2], state: "minecraft:air"},
108+
{pos: [0, 4, 3], state: "minecraft:polished_andesite"},
109+
{pos: [0, 4, 4], state: "minecraft:air"},
110+
{pos: [1, 4, 0], state: "minecraft:air"},
111+
{pos: [1, 4, 1], state: "minecraft:air"},
112+
{pos: [1, 4, 2], state: "minecraft:air"},
113+
{pos: [1, 4, 3], state: "minecraft:air"},
114+
{pos: [1, 4, 4], state: "minecraft:air"},
115+
{pos: [2, 4, 0], state: "minecraft:air"},
116+
{pos: [2, 4, 1], state: "minecraft:air"},
117+
{pos: [2, 4, 2], state: "minecraft:air"},
118+
{pos: [2, 4, 3], state: "minecraft:air"},
119+
{pos: [2, 4, 4], state: "minecraft:air"},
120+
{pos: [3, 4, 0], state: "minecraft:air"},
121+
{pos: [3, 4, 1], state: "minecraft:air"},
122+
{pos: [3, 4, 2], state: "minecraft:air"},
123+
{pos: [3, 4, 3], state: "minecraft:air"},
124+
{pos: [3, 4, 4], state: "minecraft:air"},
125+
{pos: [4, 4, 0], state: "minecraft:air"},
126+
{pos: [4, 4, 1], state: "minecraft:polished_andesite"},
127+
{pos: [4, 4, 2], state: "minecraft:air"},
128+
{pos: [4, 4, 3], state: "minecraft:air"},
129+
{pos: [4, 4, 4], state: "minecraft:air"},
130+
{pos: [0, 5, 0], state: "minecraft:air"},
131+
{pos: [0, 5, 1], state: "minecraft:air"},
132+
{pos: [0, 5, 2], state: "minecraft:air"},
133+
{pos: [0, 5, 3], state: "minecraft:redstone_lamp{lit:false}"},
134+
{pos: [0, 5, 4], state: "minecraft:air"},
135+
{pos: [1, 5, 0], state: "minecraft:air"},
136+
{pos: [1, 5, 1], state: "minecraft:air"},
137+
{pos: [1, 5, 2], state: "minecraft:air"},
138+
{pos: [1, 5, 3], state: "portalcubed:pedestal_button{active:false,base:false,face:east,facing:south,offset:none,waterlogged:false}", nbt: {id: "portalcubed:pedestal_button", press_time: 60}},
139+
{pos: [1, 5, 4], state: "minecraft:air"},
140+
{pos: [2, 5, 0], state: "minecraft:air"},
141+
{pos: [2, 5, 1], state: "minecraft:air"},
142+
{pos: [2, 5, 2], state: "minecraft:air"},
143+
{pos: [2, 5, 3], state: "minecraft:air"},
144+
{pos: [2, 5, 4], state: "minecraft:air"},
145+
{pos: [3, 5, 0], state: "minecraft:air"},
146+
{pos: [3, 5, 1], state: "minecraft:dispenser{facing:down,triggered:false}", nbt: {Items: [{Slot: 0b, count: 64, id: "minecraft:wind_charge"}], id: "minecraft:dispenser"}},
147+
{pos: [3, 5, 2], state: "minecraft:air"},
148+
{pos: [3, 5, 3], state: "minecraft:air"},
149+
{pos: [3, 5, 4], state: "minecraft:air"},
150+
{pos: [4, 5, 0], state: "minecraft:air"},
151+
{pos: [4, 5, 1], state: "minecraft:polished_andesite"},
152+
{pos: [4, 5, 2], state: "minecraft:lever{face:wall,facing:south,powered:false}"},
153+
{pos: [4, 5, 3], state: "minecraft:air"},
154+
{pos: [4, 5, 4], state: "minecraft:air"},
155+
{pos: [0, 6, 0], state: "minecraft:air"},
156+
{pos: [0, 6, 1], state: "minecraft:air"},
157+
{pos: [0, 6, 2], state: "minecraft:polished_andesite"},
158+
{pos: [0, 6, 3], state: "minecraft:polished_andesite"},
159+
{pos: [0, 6, 4], state: "minecraft:polished_andesite"},
160+
{pos: [1, 6, 0], state: "minecraft:air"},
161+
{pos: [1, 6, 1], state: "minecraft:air"},
162+
{pos: [1, 6, 2], state: "minecraft:polished_andesite"},
163+
{pos: [1, 6, 3], state: "minecraft:polished_andesite"},
164+
{pos: [1, 6, 4], state: "minecraft:polished_andesite"},
165+
{pos: [2, 6, 0], state: "minecraft:polished_andesite"},
166+
{pos: [2, 6, 1], state: "minecraft:polished_andesite"},
167+
{pos: [2, 6, 2], state: "minecraft:polished_andesite"},
168+
{pos: [2, 6, 3], state: "minecraft:polished_andesite"},
169+
{pos: [2, 6, 4], state: "minecraft:polished_andesite"},
170+
{pos: [3, 6, 0], state: "minecraft:polished_andesite"},
171+
{pos: [3, 6, 1], state: "minecraft:polished_andesite"},
172+
{pos: [3, 6, 2], state: "minecraft:polished_andesite"},
173+
{pos: [3, 6, 3], state: "minecraft:air"},
174+
{pos: [3, 6, 4], state: "minecraft:air"},
175+
{pos: [4, 6, 0], state: "minecraft:polished_andesite"},
176+
{pos: [4, 6, 1], state: "minecraft:polished_andesite"},
177+
{pos: [4, 6, 2], state: "minecraft:polished_andesite"},
178+
{pos: [4, 6, 3], state: "minecraft:air"},
179+
{pos: [4, 6, 4], state: "minecraft:air"}
180+
],
181+
entities: [],
182+
palette: [
183+
"minecraft:polished_andesite",
184+
"minecraft:redstone_lamp{lit:false}",
185+
"minecraft:air",
186+
"minecraft:lever{face:wall,facing:north,powered:false}",
187+
"minecraft:lever{face:wall,facing:south,powered:false}",
188+
"minecraft:dispenser{facing:up,triggered:false}",
189+
"portalcubed:old_ap_pedestal_button{active:false,base:false,face:west,facing:north,offset:none,waterlogged:false}",
190+
"portalcubed:pedestal_button{active:false,base:false,face:east,facing:south,offset:none,waterlogged:false}",
191+
"minecraft:dispenser{facing:down,triggered:false}"
192+
]
193+
}

0 commit comments

Comments
 (0)