This commit is contained in:
modmuss50 2022-02-16 19:24:00 +00:00
parent 55dca1a4f3
commit 5a05a77ac9
10 changed files with 50 additions and 73 deletions

View file

@ -1,7 +1,5 @@
accessWidener v1 named
accessible class net/minecraft/world/biome/Biome$Weather
accessible field net/minecraft/world/gen/chunk/placement/StructuresConfig configuredStructures Lcom/google/common/collect/ImmutableMap;
mutable field net/minecraft/world/gen/chunk/placement/StructuresConfig configuredStructures Lcom/google/common/collect/ImmutableMap;
# Rebuilding biome source feature lists
accessible method net/minecraft/world/biome/source/BiomeSource method_39525 (Ljava/util/List;Z)Ljava/util/List;

View file

@ -24,7 +24,6 @@ import com.google.common.base.Preconditions;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.Block;
import net.minecraft.tag.TagKey;
import net.minecraft.data.DataProvider;
import net.minecraft.data.server.AbstractTagProvider;
import net.minecraft.entity.EntityType;
@ -36,6 +35,8 @@ import net.minecraft.tag.FluidTags;
import net.minecraft.tag.GameEventTags;
import net.minecraft.tag.ItemTags;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.tag.TagManagerLoader;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
@ -64,6 +65,19 @@ public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
private final String path;
private final String name;
/**
* Construct a new {@link FabricTagProvider} with the default computed path.
*
* <p>Common implementations of this class are provided. For example @see BlockTagProvider
*
* @param dataGenerator The data generator instance
* @param registry The backing registry for the Tag type.
* @param name The name used for {@link DataProvider#getName()}
*/
protected FabricTagProvider(FabricDataGenerator dataGenerator, Registry<T> registry, String name) {
this(dataGenerator, registry, TagManagerLoader.getPath(registry.getKey()), name);
}
/**
* Construct a new {@link FabricTagProvider}.
*
@ -91,9 +105,9 @@ public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
protected abstract void generateTags();
/**
* Creates a new instance of {@link FabricTagBuilder} for the given {@link net.minecraft.tag.Tag.Identified} tag.
* Creates a new instance of {@link FabricTagBuilder} for the given {@link TagKey} tag.
*
* @param tag The {@link net.minecraft.tag.Tag.Identified} tag to create the builder for
* @param tag The {@link TagKey} tag to create the builder for
* @return The {@link FabricTagBuilder} instance
*/
@Override

View file

@ -24,6 +24,8 @@ transitive-accessible field net/minecraft/data/client/BlockStateModelGenerat
transitive-accessible method net/minecraft/data/client/TextureKey of (Ljava/lang/String;)Lnet/minecraft/data/client/TextureKey;
transitive-accessible method net/minecraft/data/client/TextureKey of (Ljava/lang/String;Lnet/minecraft/data/client/TextureKey;)Lnet/minecraft/data/client/TextureKey;
transitive-extendable method net/minecraft/data/server/AbstractTagProvider getOutput (Lnet/minecraft/util/Identifier;)Ljava/nio/file/Path;
transitive-accessible method net/minecraft/data/server/RecipeProvider saveRecipe (Lnet/minecraft/data/DataCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider saveRecipeAdvancement (Lnet/minecraft/data/DataCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider generate (Ljava/util/function/Consumer;)V

View file

@ -23,3 +23,5 @@ transitive-accessible field net/minecraft/data/client/BlockStateModelGenerat
transitive-accessible method net/minecraft/data/client/TextureKey of (Ljava/lang/String;)Lnet/minecraft/data/client/TextureKey;
transitive-accessible method net/minecraft/data/client/TextureKey of (Ljava/lang/String;Lnet/minecraft/data/client/TextureKey;)Lnet/minecraft/data/client/TextureKey;
transitive-extendable method net/minecraft/data/server/AbstractTagProvider getOutput (Lnet/minecraft/util/Identifier;)Ljava/nio/file/Path;

View file

@ -16,6 +16,7 @@
package net.fabricmc.fabric.test.dimension;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
@ -23,11 +24,16 @@ import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.block.BlockState;
import net.minecraft.util.dynamic.RegistryOps;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.ChunkRegion;
import net.minecraft.world.HeightLimitView;
import net.minecraft.world.Heightmap;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.source.BiomeAccess;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.biome.source.FixedBiomeSource;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.GenerationStep;
@ -36,24 +42,20 @@ import net.minecraft.world.gen.chunk.Blender;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.VerticalBlockSample;
import net.minecraft.world.gen.chunk.placement.StructuresConfig;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
public class VoidChunkGenerator extends ChunkGenerator {
// Just an example of adding a custom boolean
protected final boolean customBool;
public static final Codec<VoidChunkGenerator> CODEC = RecordCodecBuilder.create((instance) ->
public static final Codec<VoidChunkGenerator> CODEC = RecordCodecBuilder.create(instance ->
instance.group(
BiomeSource.CODEC.fieldOf("biome_source")
.forGetter((generator) -> generator.biomeSource),
Codec.BOOL.fieldOf("custom_bool")
.forGetter((generator) -> generator.customBool)
)
.apply(instance, instance.stable(VoidChunkGenerator::new))
);
RegistryOps.createRegistryCodec(Registry.CONFIGURED_STRUCTURE_FEATURE_KEY).forGetter(generator -> generator.field_36536),
RegistryOps.createRegistryCodec(Registry.BIOME_KEY).forGetter(generator -> generator.biomeRegistry)
).apply(instance, instance.stable(VoidChunkGenerator::new)));
public VoidChunkGenerator(BiomeSource biomeSource, boolean customBool) {
super(biomeSource, new StructuresConfig(false));
this.customBool = customBool;
private final Registry<Biome> biomeRegistry;
public VoidChunkGenerator(Registry<ConfiguredStructureFeature<?, ?>> configuredStructureFeatureRegistry, Registry<Biome> biomeRegistry) {
super(configuredStructureFeatureRegistry, new FixedBiomeSource(biomeRegistry.getOrCreateEntry(BiomeKeys.PLAINS)), new StructuresConfig(false));
this.biomeRegistry = biomeRegistry;
}
@Override
@ -69,7 +71,7 @@ public class VoidChunkGenerator extends ChunkGenerator {
@Override
public MultiNoiseUtil.MultiNoiseSampler getMultiNoiseSampler() {
// Mirror what Vanilla does in the debug chunk generator
return (x, y, z) -> MultiNoiseUtil.createNoiseValuePoint(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
return MultiNoiseUtil.method_40443();
}
@Override
@ -113,4 +115,8 @@ public class VoidChunkGenerator extends ChunkGenerator {
public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView heightLimitView) {
return new VerticalBlockSample(0, new BlockState[0]);
}
@Override
public void method_40450(List<String> list, BlockPos blockPos) {
}
}

View file

@ -24,7 +24,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.block.Blocks;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.class_6908;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.structure.ShiftableStructurePiece;
import net.minecraft.structure.StructureGeneratorFactory;
@ -39,6 +39,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.Heightmap;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.GenerationStep;
@ -58,7 +59,7 @@ public class StructureTest {
public static final RegistryEntry<ConfiguredStructureFeature<?, ?>> CONFIGURED_STRUCTURE = BuiltinRegistries.add(
BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE,
new Identifier("fabric", "test_structure"),
STRUCTURE.configure(new DefaultFeatureConfig())
STRUCTURE.configure(new DefaultFeatureConfig(), class_6908.DESERT_PYRAMID_HAS_STRUCTURE)
);
public static final StructurePieceType.Simple PIECE = TestStructureGenerator::new;

View file

@ -1,45 +0,0 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.fabricmc.fabric.test.structure.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.ConfiguredStructureFeatures;
import net.fabricmc.fabric.test.structure.StructureTest;
@Mixin(ConfiguredStructureFeatures.class)
public abstract class MixinConfiguredStructureFeatures {
@Shadow
private static void register(ConfiguredStructureFeatures.class_6896 arg, RegistryEntry<? extends ConfiguredStructureFeature<?, ?>> arg2, RegistryKey<Biome> biome) {
throw new AssertionError();
}
@Inject(method = "registerAll", at = @At("TAIL"))
private static void addStructuresToBiomes(ConfiguredStructureFeatures.class_6896 arg, CallbackInfo ci) {
register(arg, StructureTest.CONFIGURED_STRUCTURE, BiomeKeys.PLAINS);
}
}

View file

@ -3,8 +3,7 @@
"package": "net.fabricmc.fabric.test.structure.mixin",
"compatibilityLevel": "JAVA_16",
"mixins": [
"ChunkSerializerMixin",
"MixinConfiguredStructureFeatures"
"ChunkSerializerMixin"
],
"client": [
],

View file

@ -1,8 +1,8 @@
org.gradle.jvmargs=-Xmx2560M
version=0.47.1
minecraft_version=22w06a
yarn_version=+build.13
minecraft_version=22w07a
yarn_version=+build.2
loader_version=0.13.2
prerelease=true

View file

@ -14,7 +14,7 @@ rootProject.name = "fabric-api"
include 'fabric-api-base'
include 'fabric-api-lookup-api-v1'
include 'fabric-biome-api-v1'
//include 'fabric-biome-api-v1'
include 'fabric-blockrenderlayer-v1'
include 'fabric-commands-v0'
include 'fabric-command-api-v1'