Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.20.5 #3

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'maven-publish'
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.2
minecraft_version=24w09a
yarn_mappings=24w09a+build.5
loader_version=0.15.7
# Mod Properties
mod_version=0.4.0
maven_group=mctester
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void handleTick(long tick) {
gameTestHelperReferenceLongConsumer.accept(this, tick);
}
}
if (!this.gameTest.isCompleted() && this.gameTest.getTestFunction().getTickLimit() <= tick) {
if (!this.gameTest.isCompleted() && this.gameTest.getTestFunction().tickLimit() <= tick) {
this.handleTimeout();
}
}
Expand Down Expand Up @@ -244,7 +244,7 @@ public void pressButton(int x, int y, int z) {
BlockState blockState = this.getBlockState(x, y, z);
if (blockState.getBlock() instanceof ButtonBlock) {
BlockPos blockPos = GameTestUtil.transformRelativeToAbsolutePos(this.gameTest, x, y, z);
blockState.onUse(this.gameTest.getWorld(), null, null, new BlockHitResult(new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()), Direction.DOWN, blockPos, false));
blockState.onUse(this.gameTest.getWorld(), null, new BlockHitResult(new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()), Direction.DOWN, blockPos, false));
} else {
throw new PositionedException("No pushable button found.", GameTestUtil.transformRelativeToAbsolutePos(this.gameTest, new BlockPos(x, y, z)), new BlockPos(x, y, z), this.currTick);
}
Expand Down
42 changes: 27 additions & 15 deletions src/main/java/mctester/common/test/creation/TestConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package mctester.common.test.creation;

import mctester.mixin.accessor.TestContextAccessor;
import mctester.mixin.accessor.TestFunctionAccessor;
import mctester.common.util.TestFunctionWithVariant;
import net.minecraft.test.TestContext;
import net.minecraft.test.TestFunction;
Expand All @@ -19,9 +18,10 @@ public class TestConfig {
private int timeout = 400; //time after which the test automatically fails
private boolean required = true;
private BlockRotation rotation = BlockRotation.NONE;
private int repetitions;
private int requiredSuccessCount;

private boolean manualOnly = false;
private int repetitions = 1;
private int requiredSuccessCount = 1;
private boolean skyAccess = false;
private Consumer<TestContext> starter;

private int variant;
Expand All @@ -35,21 +35,23 @@ private TestConfig() {}

public static TestConfig from(TestFunction testFunction) {
TestConfig testConfig = new TestConfig();
testConfig.batchId = testFunction.getBatchId();
testConfig.structurePath = testFunction.getTemplatePath();
testConfig.structureName = testFunction.getTemplateName();
testConfig.cooldown = testFunction.getDuration();
testConfig.timeout = testFunction.getTickLimit();
testConfig.required = testFunction.isRequired();
testConfig.rotation = testFunction.getRotation();
testConfig.repetitions = testFunction.getMaxAttempts();
testConfig.requiredSuccessCount = testFunction.getRequiredSuccesses();
testConfig.starter = ((TestFunctionAccessor) testFunction).getStarter();
testConfig.batchId = testFunction.batchId();
testConfig.structurePath = testFunction.templatePath();
testConfig.structureName = testFunction.templateName();
testConfig.cooldown = testFunction.setupTicks();
testConfig.timeout = testFunction.tickLimit();
testConfig.required = testFunction.required();
testConfig.rotation = testFunction.rotation();
testConfig.manualOnly = testFunction.manualOnly();
testConfig.repetitions = testFunction.maxAttempts();
testConfig.requiredSuccessCount = testFunction.requiredSuccesses();
testConfig.skyAccess = testFunction.skyAccess();
testConfig.starter = testFunction.starter();
return testConfig;
}

public TestFunction toTestFunction() {
TestFunction testFunction = new TestFunction(this.batchId, this.structurePath, this.structureName, this.rotation, this.timeout, this.cooldown, this.required, this.requiredSuccessCount, this.repetitions, this.starter);
TestFunction testFunction = new TestFunction(this.batchId, this.structurePath, this.structureName, this.rotation, this.timeout, this.cooldown, this.required, this.manualOnly, this.requiredSuccessCount, this.repetitions, this.skyAccess, this.starter);
((TestFunctionWithVariant) testFunction).mcTester$setVariant(this.variant);
return testFunction;
}
Expand Down Expand Up @@ -85,6 +87,11 @@ public TestConfig rotation(BlockRotation rotation) {
return this;
}

public TestConfig manualOnly(boolean manualOnly) {
this.manualOnly = manualOnly;
return this;
}

public TestConfig requiredSuccessCount(int requiredSuccessCount) {
this.requiredSuccessCount = requiredSuccessCount;
return this;
Expand All @@ -95,6 +102,11 @@ public TestConfig repetitions(int repetitions) {
return this;
}

public TestConfig skyAccess(boolean skyAccess) {
this.skyAccess = skyAccess;
return this;
}

public TestConfig variant(int variant) {
this.variant = variant;
return this;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mctester/common/util/GameTestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static <T extends Entity> T spawnEntityWithTransforms(GameTestState gameT
throw new IllegalStateException("Could not create entity of Type " + entityType);
}
if (entity instanceof MobEntity) {
((MobEntity) entity).initialize(serverWorld, serverWorld.getLocalDifficulty(entity.getBlockPos()), SpawnReason.COMMAND, null, null);
((MobEntity) entity).initialize(serverWorld, serverWorld.getLocalDifficulty(entity.getBlockPos()), SpawnReason.COMMAND, null);
}

if (entityTag != null) {
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/mctester/mixin/accessor/TestFunctionAccessor.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class TestCommandMixin {

@Redirect(
method = "run(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/test/TestSet;Z)V",
method = "find",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/entity/StructureBlockBlockEntity;getMetadata()Ljava/lang/String;"
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},

"icon": "assets/mctester/icon.png",

"accessWidener" : "mctester.accesswidener",
"environment": "*",
"entrypoints": {
"main": [
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/mctester.accesswidener
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
accessWidener v1 named

extendable class net/minecraft/test/TestFunction
1 change: 0 additions & 1 deletion src/main/resources/mctester.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"accessor.GoalSelectorAccessor",
"accessor.MobEntityAccessor",
"accessor.TestContextAccessor",
"accessor.TestFunctionAccessor",
"after_test.TestCommandMixin",
"after_test.crash_exit_code_fix.MinecraftServerMixin",
"enable_testing.ArgumentTypesMixin",
Expand Down
Loading