Only mapping updates.
This commit is contained in:
modmuss50 2022-06-02 15:41:09 +01:00
parent d27d619843
commit e62f51a37f
14 changed files with 31 additions and 33 deletions

View file

@ -24,7 +24,7 @@ import net.minecraft.test.TestContext;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
public class FabricApiBaseGameTest {
@GameTest(structureName = FabricGameTest.EMPTY_STRUCTURE)
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void auditMixins(TestContext context) {
MixinEnvironment.getCurrentEnvironment().audit();

View file

@ -27,7 +27,7 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionOptions;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.structure.StructureType;
import net.minecraft.world.gen.structure.Structure;
import net.fabricmc.fabric.impl.biome.modification.BuiltInRegistryKeys;
@ -121,8 +121,8 @@ public interface BiomeSelectionContext {
*
* <p>This method is intended for use with the Vanilla configured structures found in {@link net.minecraft.world.gen.structure.StructureTypes}.
*/
default boolean validForBuiltInStructure(StructureType structureFeature) {
RegistryKey<StructureType> key = BuiltInRegistryKeys.get(structureFeature);
default boolean validForBuiltInStructure(Structure structureFeature) {
RegistryKey<Structure> key = BuiltInRegistryKeys.get(structureFeature);
return validForStructure(key);
}
@ -130,14 +130,14 @@ public interface BiomeSelectionContext {
* Returns true if the configured structure with the given key can start in this biome in any chunk generator
* used by the current world-save.
*/
boolean validForStructure(RegistryKey<StructureType> key);
boolean validForStructure(RegistryKey<Structure> key);
/**
* Tries to retrieve the registry key for the given configured feature, which should be from this biomes
* current structure list. May be empty if the configured feature is not registered, or does not come
* from this biomes feature list.
*/
Optional<RegistryKey<StructureType>> getStructureKey(StructureType structureFeature);
Optional<RegistryKey<Structure>> getStructureKey(Structure structureFeature);
/**
* Tries to determine whether this biome generates in a specific dimension, based on the {@link net.minecraft.world.gen.GeneratorOptions}

View file

@ -54,7 +54,6 @@ import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.carver.ConfiguredCarver;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.structure.StructureType;
import net.fabricmc.fabric.api.biome.v1.BiomeModificationContext;
@ -197,7 +196,6 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
private class GenerationSettingsContextImpl implements GenerationSettingsContext {
private final Registry<ConfiguredCarver<?>> carvers = registries.get(Registry.CONFIGURED_CARVER_KEY);
private final Registry<PlacedFeature> features = registries.get(Registry.PLACED_FEATURE_KEY);
private final Registry<StructureType> structures = registries.get(Registry.STRUCTURE_KEY);
private final GenerationSettings generationSettings = biome.getGenerationSettings();
private boolean rebuildFlowerFeatures;

View file

@ -29,7 +29,7 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionOptions;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.structure.StructureType;
import net.minecraft.world.gen.structure.Structure;
import net.minecraft.world.level.LevelProperties;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext;
@ -78,8 +78,8 @@ public class BiomeSelectionContextImpl implements BiomeSelectionContext {
}
@Override
public boolean validForStructure(RegistryKey<StructureType> key) {
StructureType instance = dynamicRegistries.get(Registry.STRUCTURE_KEY).get(key);
public boolean validForStructure(RegistryKey<Structure> key) {
Structure instance = dynamicRegistries.get(Registry.STRUCTURE_KEY).get(key);
if (instance == null) {
return false;
@ -89,9 +89,9 @@ public class BiomeSelectionContextImpl implements BiomeSelectionContext {
}
@Override
public Optional<RegistryKey<StructureType>> getStructureKey(StructureType structureFeature) {
Registry<StructureType> registry = dynamicRegistries.get(Registry.STRUCTURE_KEY);
return registry.getKey(structureFeature);
public Optional<RegistryKey<Structure>> getStructureKey(Structure structure) {
Registry<Structure> registry = dynamicRegistries.get(Registry.STRUCTURE_KEY);
return registry.getKey(structure);
}
@Override

View file

@ -23,7 +23,7 @@ import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.gen.carver.ConfiguredCarver;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.structure.StructureType;
import net.minecraft.world.gen.structure.Structure;
/**
* Utility class for getting the registry keys of built-in worldgen objects and throwing proper exceptions if they
@ -34,7 +34,7 @@ public final class BuiltInRegistryKeys {
private BuiltInRegistryKeys() {
}
public static RegistryKey<StructureType> get(StructureType structureFeature) {
public static RegistryKey<Structure> get(Structure structureFeature) {
return BuiltinRegistries.STRUCTURE.getKey(structureFeature)
.orElseThrow(() -> new IllegalArgumentException("Given structure is not built-in: " + structureFeature));
}

View file

@ -25,8 +25,8 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientCommandSource;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.network.MessageSender;
import net.minecraft.network.MessageType;
import net.minecraft.network.message.MessageSender;
import net.minecraft.network.message.MessageType;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Util;

View file

@ -30,7 +30,7 @@ import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.resource.Resource;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.structure.Structure;
import net.minecraft.structure.StructureTemplate;
import net.minecraft.test.StructureTestUtil;
import net.minecraft.util.Identifier;
@ -39,8 +39,8 @@ public abstract class StructureTestUtilMixin {
private static final String GAMETEST_STRUCTURE_PATH = "gametest/structures/";
// Replace the default test structure loading with something that works a bit better for mods.
@Inject(at = @At("HEAD"), method = "createStructure(Ljava/lang/String;Lnet/minecraft/server/world/ServerWorld;)Lnet/minecraft/structure/Structure;", cancellable = true)
private static void createStructure(String id, ServerWorld world, CallbackInfoReturnable<Structure> cir) {
@Inject(at = @At("HEAD"), method = "createStructureTemplate(Ljava/lang/String;Lnet/minecraft/server/world/ServerWorld;)Lnet/minecraft/structure/StructureTemplate;", cancellable = true)
private static void createStructure(String id, ServerWorld world, CallbackInfoReturnable<StructureTemplate> cir) {
Identifier baseId = new Identifier(id);
Identifier structureId = new Identifier(baseId.getNamespace(), GAMETEST_STRUCTURE_PATH + baseId.getPath() + ".snbt");
@ -58,7 +58,7 @@ public abstract class StructureTestUtilMixin {
}
NbtCompound nbtCompound = NbtHelper.fromNbtProviderString(snbt);
Structure structure = world.getStructureManager().createStructure(nbtCompound);
StructureTemplate structure = world.getStructureTemplateManager().createTemplate(nbtCompound);
cir.setReturnValue(structure);
} catch (IOException | CommandSyntaxException e) {

View file

@ -43,8 +43,8 @@ public abstract class TestFunctionsMixin {
String modId = FabricGameTestModInitializer.getModIdForTestClass(method.getDeclaringClass());
String structureName = "%s:%s".formatted(modId, testCaseName);
if (!gameTest.structureName().isEmpty()) {
structureName = gameTest.structureName();
if (!gameTest.templateName().isEmpty()) {
structureName = gameTest.templateName();
}
TestFunction testFunction = new TestFunction(gameTest.batchId(),

View file

@ -51,12 +51,12 @@ public class ExampleFabricTestSuite implements FabricGameTest {
);
}
@GameTest(structureName = "fabric-gametest-api-v1-testmod:exampletestsuite.diamond")
@GameTest(templateName = "fabric-gametest-api-v1-testmod:exampletestsuite.diamond")
public void diamond(TestContext context) {
// Nothing to do as the structure placed the block.
}
@GameTest(structureName = EMPTY_STRUCTURE)
@GameTest(templateName = EMPTY_STRUCTURE)
public void noStructure(TestContext context) {
context.setBlockState(0, 2, 0, Blocks.DIAMOND_BLOCK);
}

View file

@ -31,7 +31,7 @@ public class ExampleTestSuite {
);
}
@GameTest(structureName = FabricGameTest.EMPTY_STRUCTURE)
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void noStructure(TestContext context) {
context.setBlockState(0, 2, 0, Blocks.DIAMOND_BLOCK);

View file

@ -30,7 +30,7 @@ public class ConditionalResourcesTest {
return new Identifier(MOD_ID, path);
}
@GameTest(structureName = FabricGameTest.EMPTY_STRUCTURE)
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void conditionalRecipes(TestContext context) {
RecipeManager manager = context.getWorld().getRecipeManager();

View file

@ -40,7 +40,7 @@ public class VanillaStorageTests {
* Regression test for https://github.com/FabricMC/fabric/issues/1972.
* Ensures that furnace cook time is only reset when extraction is actually committed.
*/
@GameTest(structureName = FabricGameTest.EMPTY_STRUCTURE)
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void testFurnaceCookTime(TestContext context) {
BlockPos pos = new BlockPos(0, 1, 0);
context.setBlockState(pos, Blocks.FURNACE.getDefaultState());
@ -86,7 +86,7 @@ public class VanillaStorageTests {
/**
* Tests that containers such as chests don't update adjacent comparators until the very end of a committed transaction.
*/
@GameTest(structureName = FabricGameTest.EMPTY_STRUCTURE)
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void testChestComparator(TestContext context) {
World world = context.getWorld();

View file

@ -29,7 +29,7 @@ import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributes;
public class WorldDependentAttributesTest {
@GameTest(structureName = FabricGameTest.EMPTY_STRUCTURE)
@GameTest(templateName = FabricGameTest.EMPTY_STRUCTURE)
public void testViscosity(TestContext context) {
ServerWorld overworld = context.getWorld();
ServerWorld nether = overworld.getServer().getWorld(ServerWorld.NETHER);

View file

@ -1,8 +1,8 @@
org.gradle.jvmargs=-Xmx2560M
version=0.54.0
minecraft_version=1.19-pre4
yarn_version=+build.2
minecraft_version=1.19-rc1
yarn_version=+build.1
loader_version=0.14.6
prerelease=true