Merge pull request #5 from microsoft/beta
Fixes for the latest beta APIs
This commit is contained in:
Коммит
ab41f8f9e4
|
@ -9,6 +9,7 @@
|
|||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
*.cmd
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
@ -33,6 +34,7 @@ bld/
|
|||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as GameTest from "GameTest";
|
||||
import { BlockTypes, BlockLocation, World } from "Minecraft";
|
||||
import * as GameTest from "mojang-gametest";
|
||||
import { MinecraftBlockTypes, BlockLocation, World } from "mojang-minecraft";
|
||||
import { Utilities } from "scripts/Utilities.js";
|
||||
|
||||
function minibiomes(test) {
|
||||
|
@ -9,13 +9,13 @@ function minibiomes(test) {
|
|||
let minecart = test.spawn(minecartEntityType, new BlockLocation(9, 7, 7));
|
||||
let pig = test.spawn(pigEntityType, new BlockLocation(9, 7, 7));
|
||||
|
||||
test.setBlockType(BlockTypes.cobblestone, new BlockLocation(10, 7, 7));
|
||||
test.setBlockType(MinecraftBlockTypes.cobblestone, new BlockLocation(10, 7, 7));
|
||||
|
||||
let minecartRideableComp = minecart.getComponent("minecraft:rideable");
|
||||
|
||||
minecartRideableComp.addRider(pig);
|
||||
|
||||
test.succeedWhenEntityPresent(pigEntityType, new BlockLocation(8, 3, 1));
|
||||
test.succeedWhenEntityPresent(pigEntityType, new BlockLocation(8, 3, 1), true);
|
||||
}
|
||||
|
||||
GameTest.register("ChallengeTests", "minibiomes", minibiomes).structureName("gametests:minibiomes").maxTicks(160);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BlockLocation } from "Minecraft";
|
||||
import { BlockLocation } from "mojang-minecraft";
|
||||
|
||||
// ======= UTILITIES =================================================================================================
|
||||
|
||||
|
@ -52,7 +52,7 @@ export class Utilities {
|
|||
for (let j = yFrom; j <= yTo; j++) {
|
||||
for (let k = zFrom; k <= zTo; k++) {
|
||||
try {
|
||||
test.assertEntityNotPresent(entityType, new BlockLocation(i, j, k));
|
||||
test.assertEntityPresent(entityType, new BlockLocation(i, j, k), false);
|
||||
} catch (Exception) {
|
||||
count++;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ export class Utilities {
|
|||
for (let j = yFrom; j <= yTo; j++) {
|
||||
for (let k = zFrom; k <= zTo; k++) {
|
||||
try {
|
||||
test.assertEntityNotPresent(entityType, new BlockLocation(i, j, k));
|
||||
test.assertEntityPresent(entityType, new BlockLocation(i, j, k), false);
|
||||
} catch (Exception) {
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import * as GameTest from "GameTest";
|
||||
import { BlockLocation, BlockTypes } from "Minecraft";
|
||||
import * as GameTest from "mojang-gametest";
|
||||
import { BlockLocation, MinecraftBlockTypes } from "mojang-minecraft";
|
||||
|
||||
function runAsLlama(test) {
|
||||
const llamaEntityType = "llama";
|
||||
|
||||
// spawn a llama in one cell
|
||||
test.spawn(llamaEntityType, new BlockLocation(4, 2, 2));
|
||||
test.spawn(llamaEntityType, new BlockLocation(4, 2, 1));
|
||||
|
||||
// press a button which triggers a command block that "runs as llama" and moves them into a different block
|
||||
test.pressButton(new BlockLocation(2, 2, 2));
|
||||
test.succeedWhenEntityPresent(llamaEntityType, new BlockLocation(4, 2, 5)); // has the llama moved cells?
|
||||
test.succeedWhenEntityPresent(llamaEntityType, new BlockLocation(4, 2, 3), true); // has the llama moved cells?
|
||||
}
|
||||
GameTest.register("CommandTests", "runAsLlama", runAsLlama).structureName("gametests:LlamaCommands");
|
||||
|
||||
|
@ -24,19 +24,19 @@ function cloneBlocksCommand(test) {
|
|||
test.pressButton(new BlockLocation(1, 2, 6));
|
||||
|
||||
test.runAtTickTime(10, () => {
|
||||
test.assertBlockTypePresent(BlockTypes.purpleGlazedTerracotta, new BlockLocation(5, 2, 1));
|
||||
test.assertBlockTypePresent(BlockTypes.pinkGlazedTerracotta, new BlockLocation(6, 2, 2));
|
||||
test.assertBlockTypePresent(BlockTypes.log, new BlockLocation(5, 2, 2));
|
||||
test.assertBlockPresent(MinecraftBlockTypes.purpleGlazedTerracotta, new BlockLocation(5, 2, 1), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.pinkGlazedTerracotta, new BlockLocation(6, 2, 2), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.log, new BlockLocation(5, 2, 2), true);
|
||||
|
||||
// test that the chest was cloned.
|
||||
test.assertBlockTypePresent(BlockTypes.chest, new BlockLocation(5, 2, 4));
|
||||
test.assertBlockTypePresent(BlockTypes.chest, new BlockLocation(6, 2, 4));
|
||||
test.assertBlockPresent(MinecraftBlockTypes.chest, new BlockLocation(5, 2, 4), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.chest, new BlockLocation(6, 2, 4), true);
|
||||
|
||||
// test that the andesite stairs was cloned.
|
||||
test.assertBlockTypePresent(BlockTypes.andesiteStairs, new BlockLocation(5, 2, 8));
|
||||
test.assertBlockTypePresent(BlockTypes.andesiteStairs, new BlockLocation(6, 2, 8));
|
||||
test.assertBlockTypePresent(BlockTypes.andesiteStairs, new BlockLocation(5, 2, 9));
|
||||
test.assertBlockTypePresent(BlockTypes.andesiteStairs, new BlockLocation(6, 2, 9));
|
||||
test.assertBlockPresent(MinecraftBlockTypes.andesiteStairs, new BlockLocation(5, 2, 8), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.andesiteStairs, new BlockLocation(6, 2, 8), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.andesiteStairs, new BlockLocation(5, 2, 9), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.andesiteStairs, new BlockLocation(6, 2, 9), true);
|
||||
});
|
||||
|
||||
test.runAtTickTime(20, () => {
|
||||
|
@ -51,19 +51,19 @@ function cloneBlocksCommand(test) {
|
|||
});
|
||||
|
||||
test.runAtTickTime(30, () => {
|
||||
test.assertBlockTypePresent(BlockTypes.purpleGlazedTerracotta, new BlockLocation(8, 2, 1));
|
||||
test.assertBlockTypePresent(BlockTypes.pinkGlazedTerracotta, new BlockLocation(9, 2, 2));
|
||||
test.assertBlockTypePresent(BlockTypes.cobblestone, new BlockLocation(9, 2, 1));
|
||||
test.assertBlockTypePresent(BlockTypes.chest, new BlockLocation(5, 2, 4));
|
||||
test.assertBlockTypePresent(BlockTypes.purpleGlazedTerracotta, new BlockLocation(6, 2, 4));
|
||||
test.assertBlockTypePresent(BlockTypes.log, new BlockLocation(6, 2, 5));
|
||||
test.assertBlockTypePresent(BlockTypes.pinkGlazedTerracotta, new BlockLocation(7, 2, 5));
|
||||
test.assertBlockPresent(MinecraftBlockTypes.purpleGlazedTerracotta, new BlockLocation(8, 2, 1), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.pinkGlazedTerracotta, new BlockLocation(9, 2, 2), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.cobblestone, new BlockLocation(9, 2, 1), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.chest, new BlockLocation(5, 2, 4), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.purpleGlazedTerracotta, new BlockLocation(6, 2, 4), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.log, new BlockLocation(6, 2, 5), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.pinkGlazedTerracotta, new BlockLocation(7, 2, 5), true);
|
||||
|
||||
// test that only one of the andesite stairs was cloned.
|
||||
test.assertBlockTypePresent(BlockTypes.air, new BlockLocation(8, 2, 8));
|
||||
test.assertBlockTypePresent(BlockTypes.air, new BlockLocation(9, 2, 8));
|
||||
test.assertBlockTypePresent(BlockTypes.air, new BlockLocation(8, 2, 9));
|
||||
test.assertBlockTypePresent(BlockTypes.andesiteStairs, new BlockLocation(9, 2, 9));
|
||||
test.assertBlockPresent(MinecraftBlockTypes.air, new BlockLocation(8, 2, 8), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.air, new BlockLocation(9, 2, 8), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.air, new BlockLocation(8, 2, 9), true);
|
||||
test.assertBlockPresent(MinecraftBlockTypes.andesiteStairs, new BlockLocation(9, 2, 9), true);
|
||||
});
|
||||
test.runAtTickTime(40, () => {
|
||||
test.succeed();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as GameTest from "GameTest";
|
||||
import { BlockTypes, BlockLocation } from "Minecraft";
|
||||
import * as GameTest from "mojang-gametest";
|
||||
import { MinecraftBlockTypes, BlockLocation } from "mojang-minecraft";
|
||||
import { Utilities } from "scripts/Utilities.js";
|
||||
|
||||
// Tests the behavior of zombies chasing villagers around some walls.
|
||||
|
@ -7,13 +7,13 @@ function zombieVillagerChase(test) {
|
|||
const villagerType = "villager_v2";
|
||||
const zombieType = "zombie";
|
||||
|
||||
Utilities.addFourNotchedWalls(test, BlockTypes.brickBlock, 2, 1, 2, 4, 6, 4);
|
||||
Utilities.addFourNotchedWalls(test, MinecraftBlockTypes.brickBlock, 2, 1, 2, 4, 6, 4);
|
||||
|
||||
test.spawn(villagerType, new BlockLocation(1, 3, 1));
|
||||
test.spawn(zombieType, new BlockLocation(5, 3, 5));
|
||||
|
||||
test.runAtTickTime(180, () => {
|
||||
test.assertEntityPresentInArea(villagerType);
|
||||
test.assertEntityPresentInArea(villagerType, true);
|
||||
test.succeed();
|
||||
});
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ function ironGolemArena(test) {
|
|||
test.spawn(zombieType, new BlockLocation(5, 3, 2));
|
||||
|
||||
test.succeedWhen(() => {
|
||||
test.assertEntityNotPresentInArea(zombieType);
|
||||
test.assertEntityNotPresentInArea(skeletonType);
|
||||
test.assertEntityPresentInArea(ironGolemType);
|
||||
test.assertEntityPresentInArea(zombieType, false);
|
||||
test.assertEntityPresentInArea(skeletonType, false);
|
||||
test.assertEntityPresentInArea(ironGolemType, true);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ function phantomsShouldFlyFromCats(test) {
|
|||
test.spawn(catEntityType, new BlockLocation(4, 3, 3));
|
||||
test.spawn(phantomEntityType, new BlockLocation(4, 3, 3));
|
||||
|
||||
test.succeedWhenEntityPresent(phantomEntityType, new BlockLocation(4, 6, 3)); // has the phantom flown up in their column?
|
||||
test.succeedWhenEntityPresent(phantomEntityType, new BlockLocation(4, 6, 3), true); // has the phantom flown up in their column?
|
||||
}
|
||||
|
||||
GameTest.register("MobBehaviorTests", "phantoms_should_fly_from_cats", phantomsShouldFlyFromCats)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BlockLocation } from "Minecraft";
|
||||
import { BlockLocation } from "mojang-minecraft";
|
||||
|
||||
// ======= UTILITIES =================================================================================================
|
||||
|
||||
|
@ -52,7 +52,7 @@ export class Utilities {
|
|||
for (let j = yFrom; j <= yTo; j++) {
|
||||
for (let k = zFrom; k <= zTo; k++) {
|
||||
try {
|
||||
test.assertEntityNotPresent(entityType, new BlockLocation(i, j, k));
|
||||
test.assertEntityPresent(entityType, new BlockLocation(i, j, k), false);
|
||||
} catch (Exception) {
|
||||
count++;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ export class Utilities {
|
|||
for (let j = yFrom; j <= yTo; j++) {
|
||||
for (let k = zFrom; k <= zTo; k++) {
|
||||
try {
|
||||
test.assertEntityNotPresent(entityType, new BlockLocation(i, j, k));
|
||||
test.assertEntityPresent(entityType, new BlockLocation(i, j, k), false);
|
||||
} catch (Exception) {
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as GameTest from "GameTest";
|
||||
import { BlockLocation } from "Minecraft";
|
||||
import * as GameTest from "mojang-gametest";
|
||||
import { BlockLocation } from "mojang-minecraft";
|
||||
|
||||
GameTest.register("StarterTests", "simpleMobTest", (test) => {
|
||||
const attackerId = "fox";
|
||||
|
@ -8,11 +8,11 @@ GameTest.register("StarterTests", "simpleMobTest", (test) => {
|
|||
test.spawn(attackerId, new BlockLocation(5, 2, 5));
|
||||
test.spawn(victimId, new BlockLocation(2, 2, 2));
|
||||
|
||||
test.assertEntityPresentInArea(victimId);
|
||||
test.assertEntityPresentInArea(victimId, true);
|
||||
|
||||
// Succeed when the victim dies
|
||||
test.succeedWhen(() => {
|
||||
test.assertEntityNotPresentInArea(victimId);
|
||||
test.assertEntityPresentInArea(victimId, false);
|
||||
});
|
||||
})
|
||||
.maxTicks(400)
|
||||
|
|
Загрузка…
Ссылка в новой задаче