Port to 22w06a ()

This snapshot is possibly one of the most impactful for API we have ever had. This PR is an inital port to support 22w06a, stuff will be missing and broken. 

# Removed modules:
- fabric-mining-levels-v0 - Previously deprecated
- fabric-object-builders-v0 - Previously deprecated
- fabric-tag-extensions-v0
- fabric-tool-attribute-api-v1

# Modules with API breaking changes:
- fabric-biome-api-v1
- fabric-content-registries-v0
- fabric-data-generation-api-v1
- fabric-mining-level-api-v1
- fabric-object-builder-api-v1
- fabric-resource-conditions-api-v1
- fabric-structure-api-v1

# Impactful API changes:
### fabric-object-builder-api-v1
- Removed - FabricBlockSettings.breakByHand
- Removed - FabricBlockSettings.breakByTool  - Previously deprecated

# Notable changes

- fabric-registry-sync-v0 moves vanilla's new registry freezing to a later point in time, allowing mods to add to the registry during init.

# Known issues:
- ServerBugfixMixin used to fix https://bugs.mojang.com/browse/MC-195468 has not yet been ported.
This commit is contained in:
modmuss50 2022-02-11 17:02:44 +00:00 committed by GitHub
parent 9b5f02e4eb
commit d882b91555
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
193 changed files with 838 additions and 5362 deletions
fabric-biome-api-v1
fabric-content-registries-v0/src/main
fabric-data-generation-api-v1
fabric-dimensions-v1/src
main
java/net/fabricmc/fabric/mixin/dimension
resources
testmod
java/net/fabricmc/fabric/test/dimension
resources/data/fabric_dimension/dimension_type
fabric-gametest-api-v1/src/main/java/net/fabricmc/fabric
impl/gametest
mixin/gametest/server
fabric-lifecycle-events-v1
build.gradle
src/main
java/net/fabricmc/fabric/mixin/event/lifecycle
resources
fabric-mining-level-api-v1
build.gradle
src/main
java/net/fabricmc/fabric
api/mininglevel/v1
impl/mininglevel
resources
fabric-mining-levels-v0
build.gradle
src/main
java/net/fabricmc/fabric/api
resources
assets/fabric-mining-levels-v0
fabric.mod.json
fabric-networking-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/channeltest
fabric-object-builder-api-v1
fabric-object-builders-v0
fabric-registry-sync-v0/src
fabric-renderer-api-v1
fabric-resource-conditions-api-v1/src/main/java/net/fabricmc/fabric
api/resource/conditions/v1
impl/resource/conditions
fabric-resource-loader-v0/src/main
fabric-screen-api-v1/src
main/java/net/fabricmc/fabric/mixin/screen
testmod/java/net/fabricmc/fabric/test/screen
fabric-structure-api-v1/src/main/java/net/fabricmc/fabric

View file

@ -8,5 +8,4 @@ loom {
dependencies {
testmodImplementation project(path: ':fabric-api-base', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-resource-loader-v0', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-tag-extensions-v0', configuration: 'namedElements')
}

View file

@ -20,7 +20,6 @@ import java.util.function.Predicate;
import com.google.common.base.Preconditions;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.Identifier;
@ -30,6 +29,7 @@ import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.carver.ConfiguredCarver;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
/**
* Provides an API to modify Biomes after they have been loaded and before they are used in the World.
@ -45,9 +45,9 @@ public final class BiomeModifications {
*
* @see BiomeSelectors
*/
public static void addFeature(Predicate<BiomeSelectionContext> biomeSelector, GenerationStep.Feature step, RegistryKey<PlacedFeature> configuredFeatureKey) {
create(configuredFeatureKey.getValue()).add(ModificationPhase.ADDITIONS, biomeSelector, context -> {
context.getGenerationSettings().addFeature(step, configuredFeatureKey);
public static void addFeature(Predicate<BiomeSelectionContext> biomeSelector, GenerationStep.Feature step, RegistryKey<PlacedFeature> placedFeatureRegistryKey) {
create(placedFeatureRegistryKey.getValue()).add(ModificationPhase.ADDITIONS, biomeSelector, context -> {
context.getGenerationSettings().addFeature(step, placedFeatureRegistryKey);
});
}

View file

@ -18,14 +18,15 @@ package net.fabricmc.fabric.api.biome.v1;
import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
import net.minecraft.world.dimension.DimensionOptions;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.registry.RegistryEntryList;
import net.minecraft.util.registry.RegistryKey;
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.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.fabricmc.fabric.impl.biome.modification.BuiltInRegistryKeys;
@ -67,11 +68,11 @@ public interface BiomeSelectionContext {
* Returns true if this biome contains a placed feature referencing a configured feature with the given key.
*/
default boolean hasFeature(RegistryKey<ConfiguredFeature<?, ?>> key) {
List<List<Supplier<PlacedFeature>>> featureSteps = getBiome().getGenerationSettings().getFeatures();
List<RegistryEntryList<PlacedFeature>> featureSteps = getBiome().getGenerationSettings().getFeatures();
for (List<Supplier<PlacedFeature>> featureSuppliers : featureSteps) {
for (Supplier<PlacedFeature> featureSupplier : featureSuppliers) {
if (featureSupplier.get().getDecoratedFeatures().anyMatch(cf -> getFeatureKey(cf).orElse(null) == key)) {
for (RegistryEntryList<PlacedFeature> featureSuppliers : featureSteps) {
for (RegistryEntry<PlacedFeature> featureSupplier : featureSuppliers) {
if (featureSupplier.value().getDecoratedFeatures().anyMatch(cf -> getFeatureKey(cf).orElse(null) == key)) {
return true;
}
}
@ -84,11 +85,11 @@ public interface BiomeSelectionContext {
* Returns true if this biome contains a placed feature with the given key.
*/
default boolean hasPlacedFeature(RegistryKey<PlacedFeature> key) {
List<List<Supplier<PlacedFeature>>> featureSteps = getBiome().getGenerationSettings().getFeatures();
List<RegistryEntryList<PlacedFeature>> featureSteps = getBiome().getGenerationSettings().getFeatures();
for (List<Supplier<PlacedFeature>> featureSuppliers : featureSteps) {
for (Supplier<PlacedFeature> featureSupplier : featureSuppliers) {
if (getPlacedFeatureKey(featureSupplier.get()).orElse(null) == key) {
for (RegistryEntryList<PlacedFeature> featureSuppliers : featureSteps) {
for (RegistryEntry<PlacedFeature> featureSupplier : featureSuppliers) {
if (getPlacedFeatureKey(featureSupplier.value()).orElse(null) == key) {
return true;
}
}

View file

@ -24,9 +24,9 @@ import java.util.function.Predicate;
import com.google.common.collect.ImmutableSet;
import net.minecraft.tag.TagKey;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.tag.Tag;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
@ -98,8 +98,8 @@ public final class BiomeSelectors {
*
* @see net.fabricmc.fabric.api.tag.TagFactory#BIOME
*/
public static Predicate<BiomeSelectionContext> tag(Tag<Biome> tag) {
return context -> tag.contains(context.getBiome());
public static Predicate<BiomeSelectionContext> tag(TagKey<Biome> tag) {
return context -> BuiltinRegistries.BIOME.containsTag(tag);
}
/**
@ -177,6 +177,6 @@ public final class BiomeSelectors {
Set<Biome.Category> categorySet = EnumSet.noneOf(Biome.Category.class);
Collections.addAll(categorySet, categories);
return context -> categorySet.contains(context.getBiome().getCategory());
return context -> categorySet.contains(context.getBiome().category);
}
}

View file

@ -103,12 +103,4 @@ public final class TheEndBiomes {
public static void addBarrensBiome(RegistryKey<Biome> highlands, RegistryKey<Biome> barrens, double weight) {
TheEndBiomeData.addEndBarrensReplacement(highlands, barrens, weight);
}
/**
* Returns true if the given biome can generate in the end, considering the Vanilla end biomes,
* and any biomes added to The End by mods.
*/
public static boolean canGenerateInTheEnd(RegistryKey<Biome> biome) {
return TheEndBiomeData.canGenerateInTheEnd(biome);
}
}

View file

@ -24,6 +24,7 @@ import java.util.Set;
import com.google.common.base.Preconditions;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
@ -59,8 +60,8 @@ public final class NetherBiomeData {
if (NETHER_BIOMES.isEmpty()) {
MultiNoiseBiomeSource source = MultiNoiseBiomeSource.Preset.NETHER.getBiomeSource(BuiltinRegistries.BIOME);
for (Biome netherBiome : source.getBiomes()) {
BuiltinRegistries.BIOME.getKey(netherBiome).ifPresent(NETHER_BIOMES::add);
for (RegistryEntry<Biome> entry : source.getBiomes().toList()) {
BuiltinRegistries.BIOME.getKey(entry.value()).ifPresent(NETHER_BIOMES::add);
}
}

View file

@ -16,119 +16,135 @@
package net.fabricmc.fabric.impl.biome;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Preconditions;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.util.math.noise.PerlinNoiseSampler;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
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.biome.source.TheEndBiomeSource;
import net.minecraft.world.gen.random.AtomicSimpleRandom;
import net.minecraft.world.gen.random.ChunkRandom;
/**
* Internal data for modding Vanilla's {@link TheEndBiomeSource}.
*/
@ApiStatus.Internal
public final class TheEndBiomeData {
// Cached sets of the biomes that would generate from Vanilla's default biome source without consideration
// for data packs (as those would be distinct biome sources).
private static final Set<RegistryKey<Biome>> THE_END_BIOMES = new HashSet<>();
private static final Map<RegistryKey<Biome>, WeightedBiomePicker> END_BIOMES_MAP = new IdentityHashMap<>();
private static final Map<RegistryKey<Biome>, WeightedBiomePicker> END_MIDLANDS_MAP = new IdentityHashMap<>();
private static final Map<RegistryKey<Biome>, WeightedBiomePicker> END_BARRENS_MAP = new IdentityHashMap<>();
private static final Map<RegistryKey<Biome>, WeightedPicker<RegistryKey<Biome>>> END_BIOMES_MAP = new IdentityHashMap<>();
private static final Map<RegistryKey<Biome>, WeightedPicker<RegistryKey<Biome>>> END_MIDLANDS_MAP = new IdentityHashMap<>();
private static final Map<RegistryKey<Biome>, WeightedPicker<RegistryKey<Biome>>> END_BARRENS_MAP = new IdentityHashMap<>();
static {
END_BIOMES_MAP.computeIfAbsent(BiomeKeys.THE_END, key -> new WeightedBiomePicker()).addBiome(BiomeKeys.THE_END, 1.0);
END_BIOMES_MAP.computeIfAbsent(BiomeKeys.END_HIGHLANDS, key -> new WeightedBiomePicker()).addBiome(BiomeKeys.END_HIGHLANDS, 1.0);
END_BIOMES_MAP.computeIfAbsent(BiomeKeys.SMALL_END_ISLANDS, key -> new WeightedBiomePicker()).addBiome(BiomeKeys.SMALL_END_ISLANDS, 1.0);
END_BIOMES_MAP.computeIfAbsent(BiomeKeys.THE_END, key -> new WeightedPicker<>())
.add(BiomeKeys.THE_END, 1.0);
END_BIOMES_MAP.computeIfAbsent(BiomeKeys.END_HIGHLANDS, key -> new WeightedPicker<>())
.add(BiomeKeys.END_HIGHLANDS, 1.0);
END_BIOMES_MAP.computeIfAbsent(BiomeKeys.SMALL_END_ISLANDS, key -> new WeightedPicker<>())
.add(BiomeKeys.SMALL_END_ISLANDS, 1.0);
END_MIDLANDS_MAP.computeIfAbsent(BiomeKeys.END_HIGHLANDS, key -> new WeightedBiomePicker()).addBiome(BiomeKeys.END_MIDLANDS, 1.0);
END_BARRENS_MAP.computeIfAbsent(BiomeKeys.END_HIGHLANDS, key -> new WeightedBiomePicker()).addBiome(BiomeKeys.END_BARRENS, 1.0);
END_MIDLANDS_MAP.computeIfAbsent(BiomeKeys.END_HIGHLANDS, key -> new WeightedPicker<>())
.add(BiomeKeys.END_MIDLANDS, 1.0);
END_BARRENS_MAP.computeIfAbsent(BiomeKeys.END_HIGHLANDS, key -> new WeightedPicker<>())
.add(BiomeKeys.END_BARRENS, 1.0);
}
private TheEndBiomeData() {
}
public static void addEndBiomeReplacement(RegistryKey<Biome> replaced, RegistryKey<Biome> variant, double weight) {
Preconditions.checkNotNull(replaced, "replaced biome is null");
Preconditions.checkNotNull(variant, "variant biome is null");
Preconditions.checkNotNull(replaced, "replaced entry is null");
Preconditions.checkNotNull(variant, "variant entry is null");
Preconditions.checkArgument(weight > 0.0, "Weight is less than or equal to 0.0 (got %s)", weight);
END_BIOMES_MAP.computeIfAbsent(replaced, key -> new WeightedBiomePicker()).addBiome(variant, weight);
clearBiomeSourceCache();
END_BIOMES_MAP.computeIfAbsent(replaced, key -> new WeightedPicker<>()).add(variant, weight);
}
public static void addEndMidlandsReplacement(RegistryKey<Biome> highlands, RegistryKey<Biome> midlands, double weight) {
Preconditions.checkNotNull(highlands, "highlands biome is null");
Preconditions.checkNotNull(midlands, "midlands biome is null");
Preconditions.checkNotNull(highlands, "highlands entry is null");
Preconditions.checkNotNull(midlands, "midlands entry is null");
Preconditions.checkArgument(weight > 0.0, "Weight is less than or equal to 0.0 (got %s)", weight);
END_MIDLANDS_MAP.computeIfAbsent(highlands, key -> new WeightedBiomePicker()).addBiome(midlands, weight);
clearBiomeSourceCache();
END_MIDLANDS_MAP.computeIfAbsent(highlands, key -> new WeightedPicker<>()).add(midlands, weight);
}
public static void addEndBarrensReplacement(RegistryKey<Biome> highlands, RegistryKey<Biome> barrens, double weight) {
Preconditions.checkNotNull(highlands, "highlands biome is null");
Preconditions.checkNotNull(barrens, "midlands biome is null");
Preconditions.checkNotNull(highlands, "highlands entry is null");
Preconditions.checkNotNull(barrens, "midlands entry is null");
Preconditions.checkArgument(weight > 0.0, "Weight is less than or equal to 0.0 (got %s)", weight);
END_BARRENS_MAP.computeIfAbsent(highlands, key -> new WeightedBiomePicker()).addBiome(barrens, weight);
clearBiomeSourceCache();
END_BARRENS_MAP.computeIfAbsent(highlands, key -> new WeightedPicker<>()).add(barrens, weight);
}
public static Map<RegistryKey<Biome>, WeightedBiomePicker> getEndBiomesMap() {
return END_BIOMES_MAP;
public static Overrides createOverrides(Registry<Biome> biomeRegistry, long seed) {
return new Overrides(biomeRegistry, seed);
}
public static Map<RegistryKey<Biome>, WeightedBiomePicker> getEndMidlandsMap() {
return END_MIDLANDS_MAP;
}
/**
* An instance of this class is attached to each {@link TheEndBiomeSource}.
*/
public static class Overrides {
private final PerlinNoiseSampler sampler;
public static Map<RegistryKey<Biome>, WeightedBiomePicker> getEndBarrensMap() {
return END_BARRENS_MAP;
}
// Vanilla entries to compare against
private final RegistryEntry<Biome> endMidlands;
private final RegistryEntry<Biome> endBarrens;
private final RegistryEntry<Biome> endHighlands;
public static boolean canGenerateInTheEnd(RegistryKey<Biome> biome) {
if (THE_END_BIOMES.isEmpty()) {
for (Biome endBiome : new TheEndBiomeSource(BuiltinRegistries.BIOME, 0).getBiomes()) {
BuiltinRegistries.BIOME.getKey(endBiome).ifPresent(THE_END_BIOMES::add);
}
// Maps where the keys have been resolved to actual entries
private final Map<RegistryEntry<Biome>, WeightedPicker<RegistryEntry<Biome>>> endBiomesMap;
private final Map<RegistryEntry<Biome>, WeightedPicker<RegistryEntry<Biome>>> endMidlandsMap;
private final Map<RegistryEntry<Biome>, WeightedPicker<RegistryEntry<Biome>>> endBarrensMap;
public Overrides(Registry<Biome> biomeRegistry, long seed) {
this.sampler = new PerlinNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(seed)));
this.endMidlands = biomeRegistry.entryOf(BiomeKeys.END_MIDLANDS);
this.endBarrens = biomeRegistry.entryOf(BiomeKeys.END_BARRENS);
this.endHighlands = biomeRegistry.entryOf(BiomeKeys.END_HIGHLANDS);
this.endBiomesMap = resolveOverrides(biomeRegistry, END_BIOMES_MAP);
this.endMidlandsMap = resolveOverrides(biomeRegistry, END_MIDLANDS_MAP);
this.endBarrensMap = resolveOverrides(biomeRegistry, END_BARRENS_MAP);
}
return THE_END_BIOMES.contains(biome);
}
// Resolves all RegistryKey instances to RegistryEntries
private Map<RegistryEntry<Biome>, WeightedPicker<RegistryEntry<Biome>>> resolveOverrides(Registry<Biome> biomeRegistry, Map<RegistryKey<Biome>, WeightedPicker<RegistryKey<Biome>>> overrides) {
var result = new IdentityHashMap<RegistryEntry<Biome>, WeightedPicker<RegistryEntry<Biome>>>(overrides.size());
private static void clearBiomeSourceCache() {
THE_END_BIOMES.clear(); // Clear cached biome source data
}
for (var entry : overrides.entrySet()) {
result.put(biomeRegistry.entryOf(entry.getKey()), entry.getValue().map(biomeRegistry::entryOf));
}
public static RegistryKey<Biome> pickEndBiome(int biomeX, int biomeY, int biomeZ, PerlinNoiseSampler sampler, RegistryKey<Biome> vanillaKey) {
RegistryKey<Biome> replacementKey;
return result;
}
// The x and z of the biome are divided by 64 to ensure custom biomes are large enough; going larger than this]
// seems to make custom biomes too hard to find.
if (vanillaKey == BiomeKeys.END_MIDLANDS || vanillaKey == BiomeKeys.END_BARRENS) {
// Since the highlands picker is statically populated by InternalBiomeData, picker will never be null.
WeightedBiomePicker highlandsPicker = TheEndBiomeData.getEndBiomesMap().get(BiomeKeys.END_HIGHLANDS);
RegistryKey<Biome> highlandsKey = highlandsPicker.pickFromNoise(sampler, biomeX / 64.0, 0, biomeZ / 64.0);
public RegistryEntry<Biome> pick(int x, int y, int z, RegistryEntry<Biome> vanillaBiome) {
RegistryEntry<Biome> replacementKey;
if (vanillaKey == BiomeKeys.END_MIDLANDS) {
WeightedBiomePicker midlandsPicker = TheEndBiomeData.getEndMidlandsMap().get(highlandsKey);
replacementKey = (midlandsPicker == null) ? vanillaKey : midlandsPicker.pickFromNoise(sampler, biomeX / 64.0, 0, biomeZ / 64.0);
// The x and z of the entry are divided by 64 to ensure custom biomes are large enough; going larger than this]
// seems to make custom biomes too hard to find.
if (vanillaBiome == endMidlands || vanillaBiome == endBarrens) {
// Since the highlands picker is statically populated by InternalBiomeData, picker will never be null.
var highlandsPicker = endBiomesMap.get(endHighlands);
RegistryEntry<Biome> highlandsKey = highlandsPicker.pickFromNoise(sampler, x / 64.0, 0, z / 64.0);
if (vanillaBiome == endMidlands) {
var midlandsPicker = endMidlandsMap.get(highlandsKey);
replacementKey = (midlandsPicker == null) ? vanillaBiome : midlandsPicker.pickFromNoise(sampler, x / 64.0, 0, z / 64.0);
} else {
var barrensPicker = endBarrensMap.get(highlandsKey);
replacementKey = (barrensPicker == null) ? vanillaBiome : barrensPicker.pickFromNoise(sampler, x / 64.0, 0, z / 64.0);
}
} else {
WeightedBiomePicker barrensPicker = TheEndBiomeData.getEndBarrensMap().get(highlandsKey);
replacementKey = (barrensPicker == null) ? vanillaKey : barrensPicker.pickFromNoise(sampler, biomeX / 64.0, 0, biomeZ / 64.0);
// Since the main island and small islands pickers are statically populated by InternalBiomeData, picker will never be null.
var picker = endBiomesMap.get(vanillaBiome);
replacementKey = picker.pickFromNoise(sampler, x / 64.0, 0, z / 64.0);
}
} else {
// Since the main island and small islands pickers are statically populated by InternalBiomeData, picker will never be null.
WeightedBiomePicker picker = TheEndBiomeData.getEndBiomesMap().get(vanillaKey);
replacementKey = picker.pickFromNoise(sampler, biomeX / 64.0, 0, biomeZ / 64.0);
}
return replacementKey;
return replacementKey;
}
}
}

View file

@ -1,30 +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.impl.biome;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
/**
* Represents a modded biome in The End, and its corresponding weight.
*
* @param biome the biome
* @param weight how often a biome will be chosen
* @param upperWeightBound the upper weight bound within the context of the other entries, used for the binary search
*/
record WeightedBiomeEntry(RegistryKey<Biome> biome, double weight, double upperWeightBound) {
}

View file

@ -18,39 +18,54 @@ package net.fabricmc.fabric.impl.biome;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import com.google.common.base.Preconditions;
import net.minecraft.util.math.noise.PerlinNoiseSampler;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
/**
* Picks biomes with arbitrary double weights using a binary search.
* Picks entries with arbitrary double weights using a binary search.
*/
public final class WeightedBiomePicker {
public final class WeightedPicker<T> {
private double currentTotal;
private final List<WeightedBiomeEntry> entries;
private final List<WeightedEntry<T>> entries;
WeightedBiomePicker() {
currentTotal = 0;
entries = new ArrayList<>();
WeightedPicker() {
this(0, new ArrayList<>());
}
void addBiome(final RegistryKey<Biome> biome, final double weight) {
private WeightedPicker(double currentTotal, List<WeightedEntry<T>> entries) {
this.currentTotal = currentTotal;
this.entries = entries;
}
void add(T biome, final double weight) {
currentTotal += weight;
entries.add(new WeightedBiomeEntry(biome, weight, currentTotal));
entries.add(new WeightedEntry<>(biome, weight, currentTotal));
}
double getCurrentWeightTotal() {
return currentTotal;
}
public RegistryKey<Biome> pickFromNoise(PerlinNoiseSampler sampler, double x, double y, double z) {
public T pickFromNoise(PerlinNoiseSampler sampler, double x, double y, double z) {
double target = Math.abs(sampler.sample(x, y, z)) * getCurrentWeightTotal();
return search(target).biome();
return search(target).entry();
}
/**
* Applies a mapping function to each entry and returns a picker with otherwise equivalent settings.
*/
<U> WeightedPicker<U> map(Function<T, U> mapper) {
return new WeightedPicker<U>(
currentTotal,
entries.stream()
.map(e -> new WeightedEntry<>(mapper.apply(e.entry), e.weight, e.upperWeightBound))
.toList()
);
}
/**
@ -59,10 +74,10 @@ public final class WeightedBiomePicker {
* @param target The target value, must satisfy the constraint 0 <= target <= currentTotal
* @return The result of the search
*/
WeightedBiomeEntry search(final double target) {
WeightedEntry<T> search(final double target) {
// Sanity checks, fail fast if stuff is going wrong.
Preconditions.checkArgument(target <= currentTotal, "The provided target value for biome selection must be less than or equal to the weight total");
Preconditions.checkArgument(target >= 0, "The provided target value for biome selection cannot be negative");
Preconditions.checkArgument(target <= currentTotal, "The provided target value for entry selection must be less than or equal to the weight total");
Preconditions.checkArgument(target >= 0, "The provided target value for entry selection cannot be negative");
int low = 0;
int high = entries.size() - 1;
@ -79,4 +94,14 @@ public final class WeightedBiomePicker {
return entries.get(low);
}
/**
* Represents a modded entry in a list, and its corresponding weight.
*
* @param entry the entry
* @param weight how often an entry will be chosen
* @param upperWeightBound the upper weight bound within the context of the other entries, used for the binary search
*/
record WeightedEntry<T>(T entry, double weight, double upperWeightBound) {
}
}

View file

@ -17,23 +17,24 @@
package net.fabricmc.fabric.impl.biome.modification;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiPredicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.registry.RegistryEntryList;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.sound.BiomeAdditionsSound;
@ -51,9 +52,9 @@ import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.carver.ConfiguredCarver;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.feature.StructureFeature;
import net.fabricmc.fabric.api.biome.v1.BiomeModificationContext;
@ -205,6 +206,8 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
private final Registry<ConfiguredStructureFeature<?, ?>> structures = registries.get(Registry.CONFIGURED_STRUCTURE_FEATURE_KEY);
private final GenerationSettings generationSettings = biome.getGenerationSettings();
private boolean rebuildFlowerFeatures;
/**
* Unfreeze the immutable lists found in the generation settings, and make sure they're filled up to every
* possible step if they're dense lists.
@ -212,42 +215,19 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
GenerationSettingsContextImpl() {
unfreezeCarvers();
unfreezeFeatures();
unfreezeFlowerFeatures();
rebuildFlowerFeatures = false;
}
private void unfreezeCarvers() {
Map<GenerationStep.Carver, List<Supplier<ConfiguredCarver<?>>>> carversByStep = new EnumMap<>(GenerationStep.Carver.class);
Map<GenerationStep.Carver, RegistryEntryList<ConfiguredCarver<?>>> carversByStep = new EnumMap<>(GenerationStep.Carver.class);
carversByStep.putAll(generationSettings.carvers);
for (GenerationStep.Carver step : GenerationStep.Carver.values()) {
List<Supplier<ConfiguredCarver<?>>> carvers = carversByStep.get(step);
if (carvers == null) {
carvers = new ArrayList<>();
} else {
carvers = new ArrayList<>(carvers);
}
carversByStep.put(step, carvers);
}
generationSettings.carvers = carversByStep;
}
private void unfreezeFeatures() {
List<List<Supplier<PlacedFeature>>> features = generationSettings.features;
features = new ArrayList<>(features);
for (int i = 0; i < features.size(); i++) {
features.set(i, new ArrayList<>(features.get(i)));
}
generationSettings.features = features;
generationSettings.allowedFeatures = new HashSet<>(generationSettings.allowedFeatures);
}
private void unfreezeFlowerFeatures() {
generationSettings.flowerFeatures = new ArrayList<>(generationSettings.flowerFeatures);
generationSettings.features = new ArrayList<>(generationSettings.features);
}
/**
@ -256,32 +236,31 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
public void freeze() {
freezeCarvers();
freezeFeatures();
freezeFlowerFeatures();
if (rebuildFlowerFeatures) {
rebuildFlowerFeatures();
}
}
private void freezeCarvers() {
Map<GenerationStep.Carver, List<Supplier<ConfiguredCarver<?>>>> carversByStep = generationSettings.carvers;
for (GenerationStep.Carver step : GenerationStep.Carver.values()) {
carversByStep.put(step, ImmutableList.copyOf(carversByStep.get(step)));
}
generationSettings.carvers = ImmutableMap.copyOf(carversByStep);
generationSettings.carvers = ImmutableMap.copyOf(generationSettings.carvers);
}
private void freezeFeatures() {
List<List<Supplier<PlacedFeature>>> featureSteps = generationSettings.features;
for (int i = 0; i < featureSteps.size(); i++) {
featureSteps.set(i, ImmutableList.copyOf(featureSteps.get(i)));
}
generationSettings.features = ImmutableList.copyOf(featureSteps);
generationSettings.allowedFeatures = (Set.copyOf(generationSettings.allowedFeatures));
generationSettings.features = ImmutableList.copyOf(generationSettings.features);
// Replace the supplier to force a rebuild next time its called.
generationSettings.allowedFeatures = Suppliers.memoize(() -> {
return generationSettings.features.stream().flatMap(RegistryEntryList::stream).map(RegistryEntry::value).collect(Collectors.toSet());
});
}
private void freezeFlowerFeatures() {
generationSettings.flowerFeatures = ImmutableList.copyOf(generationSettings.flowerFeatures);
private void rebuildFlowerFeatures() {
// Replace the supplier to force a rebuild next time its called.
generationSettings.flowerFeatures = Suppliers.memoize(() -> {
return generationSettings.features.stream().flatMap(RegistryEntryList::stream).map(RegistryEntry::value).flatMap(PlacedFeature::getDecoratedFeatures).filter((configuredFeature) -> {
return configuredFeature.feature() == Feature.FLOWER;
}).collect(ImmutableList.toImmutableList());
});
}
@Override
@ -289,16 +268,19 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
PlacedFeature configuredFeature = features.getOrThrow(placedFeatureKey);
int stepIndex = step.ordinal();
List<List<Supplier<PlacedFeature>>> featureSteps = generationSettings.features;
List<RegistryEntryList<PlacedFeature>> featureSteps = generationSettings.features;
if (stepIndex >= featureSteps.size()) {
return false; // The step was not populated with any features yet
}
List<Supplier<PlacedFeature>> featuresInStep = featureSteps.get(stepIndex);
RegistryEntryList<PlacedFeature> featuresInStep = featureSteps.get(stepIndex);
List<RegistryEntry<PlacedFeature>> features = new ArrayList<>(featuresInStep.stream().toList());
if (features.removeIf(feature -> feature.value() == configuredFeature)) {
featureSteps.set(stepIndex, RegistryEntryList.of(features));
rebuildFlowerFeatures = true;
if (featuresInStep.removeIf(supplier -> supplier.get() == configuredFeature)) {
rebuildFlowerFeatures();
return true;
}
@ -306,36 +288,38 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
}
@Override
public void addFeature(GenerationStep.Feature step, RegistryKey<PlacedFeature> placedFeatureKey) {
// We do not need to delay evaluation of this since the registries are already fully built
PlacedFeature placedFeature = features.getOrThrow(placedFeatureKey);
List<List<Supplier<PlacedFeature>>> featureSteps = generationSettings.features;
public void addFeature(GenerationStep.Feature step, RegistryKey<PlacedFeature> entry) {
List<RegistryEntryList<PlacedFeature>> featureSteps = generationSettings.features;
int index = step.ordinal();
// Add new empty lists for the generation steps that have no features yet
while (index >= featureSteps.size()) {
featureSteps.add(new ArrayList<>());
featureSteps.add(RegistryEntryList.of(Collections.emptyList()));
}
featureSteps.get(index).add(() -> placedFeature);
generationSettings.allowedFeatures.add(placedFeature);
featureSteps.set(index, plus(featureSteps.get(index), features.getEntry(entry).orElseThrow()));
// Ensure the list of flower features is up to date
rebuildFlowerFeatures();
rebuildFlowerFeatures = true;
}
@Override
public void addCarver(GenerationStep.Carver step, RegistryKey<ConfiguredCarver<?>> carverKey) {
public void addCarver(GenerationStep.Carver step, RegistryKey<ConfiguredCarver<?>> entry) {
// We do not need to delay evaluation of this since the registries are already fully built
ConfiguredCarver<?> carver = carvers.getOrThrow(carverKey);
generationSettings.carvers.get(step).add(() -> carver);
generationSettings.carvers.put(step, plus(generationSettings.carvers.get(step), carvers.getEntry(entry).orElseThrow()));
}
@Override
public boolean removeCarver(GenerationStep.Carver step, RegistryKey<ConfiguredCarver<?>> configuredCarverKey) {
ConfiguredCarver<?> carver = carvers.getOrThrow(configuredCarverKey);
return generationSettings.carvers.get(step).removeIf(supplier -> supplier.get() == carver);
List<RegistryEntry<ConfiguredCarver<?>>> genCarvers = new ArrayList<>(generationSettings.carvers.get(step).stream().toList());
if (genCarvers.removeIf(entry -> entry.value() == carver)) {
generationSettings.carvers.put(step, RegistryEntryList.of(genCarvers));
return true;
}
return false;
}
@Override
@ -357,20 +341,10 @@ public class BiomeModificationContextImpl implements BiomeModificationContext {
return BiomeStructureStartsImpl.removeStructureStarts(registries, structure, biomeKey);
}
/**
* See the constructor of {@link GenerationSettings} for reference.
*/
private void rebuildFlowerFeatures() {
List<ConfiguredFeature<?, ?>> flowerFeatures = generationSettings.flowerFeatures;
flowerFeatures.clear();
for (List<Supplier<PlacedFeature>> features : generationSettings.features) {
for (Supplier<PlacedFeature> supplier : features) {
supplier.get().getDecoratedFeatures()
.filter(configuredFeature -> configuredFeature.feature == Feature.FLOWER)
.forEachOrdered(flowerFeatures::add);
}
}
private <T> RegistryEntryList<T> plus(RegistryEntryList<T> values, RegistryEntry<T> entry) {
List<RegistryEntry<T>> list = new ArrayList<>(values.stream().toList());
list.add(entry);
return RegistryEntryList.of(list);
}
}

View file

@ -26,11 +26,13 @@ import java.util.function.Consumer;
import java.util.function.Predicate;
import com.google.common.base.Stopwatch;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import com.google.common.base.Suppliers;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.TestOnly;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.util.registry.Registry;
@ -105,13 +107,13 @@ public class BiomeModificationImpl {
}
@SuppressWarnings("ConstantConditions")
public void finalizeWorldGen(DynamicRegistryManager.Impl impl, LevelProperties levelProperties) {
public void finalizeWorldGen(DynamicRegistryManager impl, LevelProperties levelProperties) {
Stopwatch sw = Stopwatch.createStarted();
// Now that we apply biome modifications inside the MinecraftServer constructor, we should only ever do
// this once for a dynamic registry manager. Marking the dynamic registry manager as modified ensures a crash
// if the precondition is violated.
BiomeModificationMarker modificationTracker = (BiomeModificationMarker) (Object) impl;
BiomeModificationMarker modificationTracker = (BiomeModificationMarker) impl;
modificationTracker.fabric_markModified();
Registry<Biome> biomes = impl.get(Registry.BIOME_KEY);
@ -166,7 +168,11 @@ public class BiomeModificationImpl {
// The Biome source has a total ordering of feature generation that might have changed
// by us adding or removing features from biomes.
BiomeSource biomeSource = dimension.getChunkGenerator().getBiomeSource();
biomeSource.field_34469 = biomeSource.method_39525(new ArrayList<>(biomeSource.getBiomes()), true);
// Replace the Supplier to force it to rebuild on next call
biomeSource.field_34469 = Suppliers.memoize(() -> {
return biomeSource.method_39525(biomeSource.biomes.stream().map(RegistryEntry::value).toList(), true);
});
}
LOGGER.info("Applied {} biome modifications to {} of {} new biomes in {}", modifiersApplied, biomesChanged,

View file

@ -25,7 +25,7 @@ import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.dimension.DimensionOptions;
import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.chunk.placement.StructuresConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
@ -82,7 +82,7 @@ public class BiomeSelectionContextImpl implements BiomeSelectionContext {
for (DimensionOptions dimension : levelProperties.getGeneratorOptions().getDimensions()) {
StructuresConfig structuresConfig = dimension.getChunkGenerator().getStructuresConfig();
if (structuresConfig.getConfiguredStructureFeature(instance.feature).get(instance).contains(getBiomeKey())) {
if (structuresConfig.getConfiguredStructureFeature(instance.feature).get(key).contains(getBiomeKey())) {
return true;
}
}
@ -104,6 +104,6 @@ public class BiomeSelectionContextImpl implements BiomeSelectionContext {
return false;
}
return dimension.getChunkGenerator().getBiomeSource().getBiomes().contains(biome);
return dimension.getChunkGenerator().getBiomeSource().getBiomes().anyMatch(entry -> entry.value() == biome);
}
}

View file

@ -50,18 +50,15 @@ public final class BiomeStructureStartsImpl {
RegistryKey<Biome> biome
) {
changeStructureStarts(registries, structureMap -> {
Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>> configuredMap = structureMap.computeIfAbsent(configuredStructure.feature, k -> HashMultimap.create());
Multimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>> configuredMap = structureMap.computeIfAbsent(configuredStructure.feature, k -> HashMultimap.create());
// This is tricky, the keys might be either from builtin (Vanilla) or dynamic registries (modded)
RegistryKey<ConfiguredStructureFeature<?, ?>> configuredStructureKey = registries.get(Registry.CONFIGURED_STRUCTURE_FEATURE_KEY).getKey(configuredStructure).orElseThrow();
ConfiguredStructureFeature<?, ?> mapKey = BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.get(configuredStructureKey);
if (mapKey == null) {
// This means the configured structure passed in is not a (potentially modified) Vanilla entry,
// but rather a modded one. In this case, this will create a new entry in the map.
mapKey = configuredStructure;
}
RegistryKey<ConfiguredStructureFeature<?, ?>> mapKey = registries.get(Registry.CONFIGURED_STRUCTURE_FEATURE_KEY).getKey(configuredStructure)
.orElse(configuredStructureKey);
// orElse means the configured structure passed in is not a (potentially modified) Vanilla entry,
// but rather a modded one. In this case, this will create a new entry in the map.
configuredMap.put(mapKey, biome);
});
}
@ -74,7 +71,7 @@ public final class BiomeStructureStartsImpl {
AtomicBoolean result = new AtomicBoolean(false);
changeStructureStarts(registries, structureMap -> {
Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>> configuredMap = structureMap.get(configuredStructure.feature);
Multimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>> configuredMap = structureMap.get(configuredStructure.feature);
if (configuredMap == null) {
return;
@ -106,7 +103,7 @@ public final class BiomeStructureStartsImpl {
AtomicBoolean result = new AtomicBoolean(false);
changeStructureStarts(registries, structureMap -> {
Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>> configuredMap = structureMap.get(structure);
Multimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>> configuredMap = structureMap.get(structure);
if (configuredMap == null) {
return;
@ -120,11 +117,11 @@ public final class BiomeStructureStartsImpl {
return result.get();
}
private static void changeStructureStarts(DynamicRegistryManager registries, Consumer<Map<StructureFeature<?>, Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>>> modifier) {
private static void changeStructureStarts(DynamicRegistryManager registries, Consumer<Map<StructureFeature<?>, Multimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>>>> modifier) {
Registry<ChunkGeneratorSettings> chunkGenSettingsRegistry = registries.get(Registry.CHUNK_GENERATOR_SETTINGS_KEY);
for (Map.Entry<RegistryKey<ChunkGeneratorSettings>, ChunkGeneratorSettings> entry : chunkGenSettingsRegistry.getEntries()) {
Map<StructureFeature<?>, Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> structureMap = unfreeze(entry.getValue());
Map<StructureFeature<?>, Multimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>>> structureMap = unfreeze(entry.getValue());
modifier.accept(structureMap);
@ -132,18 +129,18 @@ public final class BiomeStructureStartsImpl {
}
}
private static Map<StructureFeature<?>, Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> unfreeze(ChunkGeneratorSettings settings) {
ImmutableMap<StructureFeature<?>, ImmutableMultimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> frozenMap = settings.getStructuresConfig().configuredStructures;
Map<StructureFeature<?>, Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> result = new HashMap<>(frozenMap.size());
private static Map<StructureFeature<?>, Multimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>>> unfreeze(ChunkGeneratorSettings settings) {
ImmutableMap<StructureFeature<?>, ImmutableMultimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>>> frozenMap = settings.getStructuresConfig().configuredStructures;
Map<StructureFeature<?>, Multimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>>> result = new HashMap<>(frozenMap.size());
for (Map.Entry<StructureFeature<?>, ImmutableMultimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> entry : frozenMap.entrySet()) {
for (Map.Entry<StructureFeature<?>, ImmutableMultimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>>> entry : frozenMap.entrySet()) {
result.put(entry.getKey(), HashMultimap.create(entry.getValue()));
}
return result;
}
private static void freeze(ChunkGeneratorSettings settings, Map<StructureFeature<?>, Multimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>>> structureStarts) {
private static void freeze(ChunkGeneratorSettings settings, Map<StructureFeature<?>, Multimap<RegistryKey<ConfiguredStructureFeature<?, ?>>, RegistryKey<Biome>>> structureStarts) {
settings.getStructuresConfig().configuredStructures = structureStarts.entrySet().stream()
.collect(ImmutableMap.toImmutableMap(
Map.Entry::getKey,

View file

@ -18,12 +18,12 @@ package net.fabricmc.fabric.impl.biome.modification;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.util.registry.BuiltinRegistries;
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.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.PlacedFeature;
/**
* Utility class for getting the registry keys of built-in worldgen objects and throwing proper exceptions if they

View file

@ -18,7 +18,6 @@ package net.fabricmc.fabric.mixin.biome;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import com.mojang.datafixers.util.Pair;
import org.spongepowered.asm.mixin.Mixin;
@ -27,6 +26,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.MultiNoiseBiomeSource;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
@ -40,15 +40,13 @@ import net.fabricmc.fabric.impl.biome.NetherBiomeData;
public class MixinMultiNoiseBiomeSource {
// NOTE: This is a lambda-function in the NETHER preset field initializer
@Inject(method = "method_31088", at = @At("RETURN"), cancellable = true)
private static void appendNetherBiomes(Registry<Biome> registry, CallbackInfoReturnable<MultiNoiseUtil.Entries<Supplier<Biome>>> cri) {
MultiNoiseUtil.Entries<Supplier<Biome>> biomes = cri.getReturnValue();
List<Pair<MultiNoiseUtil.NoiseHypercube, Supplier<Biome>>> entries = new ArrayList<>(biomes.getEntries());
private static void appendNetherBiomes(Registry<Biome> registry, CallbackInfoReturnable<MultiNoiseUtil.Entries<RegistryEntry<Biome>>> cri) {
MultiNoiseUtil.Entries<RegistryEntry<Biome>> biomes = cri.getReturnValue();
List<Pair<MultiNoiseUtil.NoiseHypercube, RegistryEntry<Biome>>> entries = new ArrayList<>(biomes.getEntries());
// add fabric biome noise point data to list && BiomeSource biome list
NetherBiomeData.getNetherBiomeNoisePoints().forEach((biomeKey, noisePoint) -> {
Biome biome = registry.getOrThrow(biomeKey);
// NOTE: Even though we have to pass in suppliers, BiomeSource's ctor will resolve them immediately
entries.add(Pair.of(noisePoint, () -> biome));
entries.add(Pair.of(noisePoint, registry.entryOf(biomeKey)));
});
cri.setReturnValue(new MultiNoiseUtil.Entries<>(entries));

View file

@ -16,44 +16,33 @@
package net.fabricmc.fabric.mixin.biome;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.util.math.noise.PerlinNoiseSampler;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.TheEndBiomeSource;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
import net.minecraft.world.gen.random.ChunkRandom;
import net.minecraft.world.gen.random.AtomicSimpleRandom;
import net.fabricmc.fabric.impl.biome.TheEndBiomeData;
@Mixin(TheEndBiomeSource.class)
public class MixinTheEndBiomeSource {
@Shadow
@Final
private Registry<Biome> biomeRegistry;
@Shadow
@Final
private long seed;
@Unique
private PerlinNoiseSampler sampler = new PerlinNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(seed)));
private TheEndBiomeData.Overrides overrides;
@Inject(method = "<init>", at = @At("RETURN"))
private void init(Registry<Biome> biomeRegistry, long seed, CallbackInfo ci) {
overrides = TheEndBiomeData.createOverrides(biomeRegistry, seed);
}
@Inject(method = "getBiome", at = @At("RETURN"), cancellable = true)
private void getWeightedEndBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseUtil.MultiNoiseSampler multiNoiseSampler, CallbackInfoReturnable<Biome> cir) {
Biome vanillaBiome = cir.getReturnValue();
// Since all vanilla biomes are added to the registry, this will never fail.
RegistryKey<Biome> vanillaKey = biomeRegistry.getKey(vanillaBiome).get();
RegistryKey<Biome> replacementKey = TheEndBiomeData.pickEndBiome(biomeX, biomeY, biomeZ, sampler, vanillaKey);
cir.setReturnValue(biomeRegistry.get(replacementKey));
private void getWeightedEndBiome(int biomeX, int biomeY, int biomeZ, MultiNoiseUtil.MultiNoiseSampler multiNoiseSampler, CallbackInfoReturnable<RegistryEntry<Biome>> cir) {
cir.setReturnValue(overrides.pick(biomeX, biomeY, biomeZ, cir.getReturnValue()));
}
}

View file

@ -27,7 +27,7 @@ import net.fabricmc.fabric.impl.biome.modification.BiomeModificationMarker;
* This Mixin allows us to keep backup copies of biomes for
* {@link net.fabricmc.fabric.impl.biome.modification.BiomeModificationImpl} on a per-DynamicRegistryManager basis.
*/
@Mixin(DynamicRegistryManager.Impl.class)
@Mixin(DynamicRegistryManager.class_6891.class)
public class DynamicRegistryManagerImplMixin implements BiomeModificationMarker {
@Unique
private boolean modified;

View file

@ -30,19 +30,19 @@ import net.minecraft.world.level.LevelProperties;
import net.fabricmc.fabric.impl.biome.modification.BiomeModificationImpl;
@Mixin(MinecraftServer.class)
public class MinecraftServerMixin {
@Shadow
private DynamicRegistryManager.Impl registryManager;
public abstract class MinecraftServerMixin {
@Shadow
private SaveProperties saveProperties;
@Shadow
public abstract DynamicRegistryManager.class_6890 getRegistryManager();
@Inject(method = "<init>", at = @At(value = "RETURN"))
private void finalizeWorldGen(CallbackInfo ci) {
if (!(saveProperties instanceof LevelProperties levelProperties)) {
throw new RuntimeException("Incompatible SaveProperties passed to MinecraftServer: " + saveProperties);
}
BiomeModificationImpl.INSTANCE.finalizeWorldGen(registryManager, levelProperties);
BiomeModificationImpl.INSTANCE.finalizeWorldGen(getRegistryManager(), levelProperties);
}
}

View file

@ -1,12 +1,13 @@
accessWidener v1 named
accessible class net/minecraft/world/biome/Biome$Weather
accessible field net/minecraft/world/gen/chunk/StructuresConfig configuredStructures Lcom/google/common/collect/ImmutableMap;
mutable field net/minecraft/world/gen/chunk/StructuresConfig configuredStructures Lcom/google/common/collect/ImmutableMap;
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;
accessible field net/minecraft/world/biome/source/BiomeSource field_34469 Ljava/util/List;
mutable field net/minecraft/world/biome/source/BiomeSource field_34469 Ljava/util/List;
accessible field net/minecraft/world/biome/source/BiomeSource biomes Ljava/util/Set;
accessible field net/minecraft/world/biome/source/BiomeSource field_34469 Ljava/util/function/Supplier;
mutable field net/minecraft/world/biome/source/BiomeSource field_34469 Ljava/util/function/Supplier;
# Top-Level Biome Fields Access
accessible field net/minecraft/world/biome/Biome weather Lnet/minecraft/world/biome/Biome$Weather;
@ -66,7 +67,7 @@ accessible field net/minecraft/world/biome/GenerationSettings carvers Ljava/util
mutable field net/minecraft/world/biome/GenerationSettings carvers Ljava/util/Map;
accessible field net/minecraft/world/biome/GenerationSettings features Ljava/util/List;
mutable field net/minecraft/world/biome/GenerationSettings features Ljava/util/List;
accessible field net/minecraft/world/biome/GenerationSettings flowerFeatures Ljava/util/List;
mutable field net/minecraft/world/biome/GenerationSettings flowerFeatures Ljava/util/List;
accessible field net/minecraft/world/biome/GenerationSettings allowedFeatures Ljava/util/Set;
mutable field net/minecraft/world/biome/GenerationSettings allowedFeatures Ljava/util/Set;
accessible field net/minecraft/world/biome/GenerationSettings flowerFeatures Ljava/util/function/Supplier;
mutable field net/minecraft/world/biome/GenerationSettings flowerFeatures Ljava/util/function/Supplier;
accessible field net/minecraft/world/biome/GenerationSettings allowedFeatures Ljava/util/function/Supplier;
mutable field net/minecraft/world/biome/GenerationSettings allowedFeatures Ljava/util/function/Supplier;

View file

@ -16,6 +16,10 @@
package net.fabricmc.fabric.test.biome;
import java.util.List;
import net.minecraft.tag.TagKey;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.sound.BiomeMoodSound;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
@ -30,15 +34,15 @@ import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.TheNetherBiomeCreator;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.placementmodifier.BiomePlacementModifier;
import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.EndPlacedFeatures;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.PlacedFeature;
import net.minecraft.world.gen.feature.PlacedFeatures;
import net.minecraft.world.gen.placementmodifier.BiomePlacementModifier;
import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
@ -46,7 +50,6 @@ import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.biome.v1.ModificationPhase;
import net.fabricmc.fabric.api.biome.v1.NetherBiomes;
import net.fabricmc.fabric.api.biome.v1.TheEndBiomes;
import net.fabricmc.fabric.api.tag.TagFactory;
/**
* <b>NOTES FOR TESTING:</b>
@ -94,11 +97,12 @@ public class FabricBiomeTest implements ModInitializer {
TheEndBiomes.addMidlandsBiome(TEST_END_HIGHLANDS, TEST_END_MIDLANDS, 1.0);
TheEndBiomes.addBarrensBiome(TEST_END_HIGHLANDS, TEST_END_BARRRENS, 1.0);
ConfiguredFeature<?, ?> COMMON_DESERT_WELL = Feature.DESERT_WELL.configure(FeatureConfig.DEFAULT);
ConfiguredFeature<?, ?> COMMON_DESERT_WELL = new ConfiguredFeature<>(Feature.DESERT_WELL, DefaultFeatureConfig.INSTANCE);
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier(MOD_ID, "fab_desert_well"), COMMON_DESERT_WELL);
RegistryEntry<ConfiguredFeature<?, ?>> featureEntry = BuiltinRegistries.CONFIGURED_FEATURE.getOrCreateEntry(BuiltinRegistries.CONFIGURED_FEATURE.getKey(COMMON_DESERT_WELL).orElseThrow());
// The placement config is taken from the vanilla desert well, but no randomness
PlacedFeature PLACED_COMMON_DESERT_WELL = COMMON_DESERT_WELL.withPlacement(SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of());
PlacedFeature PLACED_COMMON_DESERT_WELL = new PlacedFeature(featureEntry, List.of(SquarePlacementModifier.of(), PlacedFeatures.MOTION_BLOCKING_HEIGHTMAP, BiomePlacementModifier.of()));
Registry.register(BuiltinRegistries.PLACED_FEATURE, new Identifier(MOD_ID, "fab_desert_well"), PLACED_COMMON_DESERT_WELL);
BiomeModifications.create(new Identifier("fabric:test_mod"))
@ -109,11 +113,11 @@ public class FabricBiomeTest implements ModInitializer {
BiomeSelectors.categories(Biome.Category.DESERT),
context -> {
context.getGenerationSettings().addFeature(GenerationStep.Feature.TOP_LAYER_MODIFICATION,
BuiltinRegistries.PLACED_FEATURE.getKey(PLACED_COMMON_DESERT_WELL).get()
BuiltinRegistries.PLACED_FEATURE.getKey(PLACED_COMMON_DESERT_WELL).orElseThrow()
);
})
.add(ModificationPhase.ADDITIONS,
BiomeSelectors.tag(TagFactory.BIOME.create(new Identifier(MOD_ID, "tag_selector_test"))),
BiomeSelectors.tag(TagKey.intern(Registry.BIOME_KEY, new Identifier(MOD_ID, "tag_selector_test"))),
context -> context.getEffects().setSkyColor(0x770000));
}

View file

@ -16,22 +16,22 @@
package net.fabricmc.fabric.api.util;
import net.minecraft.tag.TagKey;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.tag.Tag;
public interface Item2ObjectMap<V> {
V get(ItemConvertible item);
void add(ItemConvertible item, V value);
void add(Tag<Item> tag, V value);
void add(TagKey<Item> tag, V value);
void remove(ItemConvertible item);
void remove(Tag<Item> tag);
void remove(TagKey<Item> tag);
void clear(ItemConvertible item);
void clear(Tag<Item> tag);
void clear(TagKey<Item> tag);
}

View file

@ -17,9 +17,9 @@
package net.fabricmc.fabric.impl.content.registry;
import net.minecraft.block.ComposterBlock;
import net.minecraft.tag.TagKey;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.tag.Tag;
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
@ -35,7 +35,7 @@ public class CompostingChanceRegistryImpl implements CompostingChanceRegistry {
}
@Override
public void add(Tag<Item> tag, Float value) {
public void add(TagKey<Item> tag, Float value) {
throw new UnsupportedOperationException("Tags currently not supported!");
}
@ -45,7 +45,7 @@ public class CompostingChanceRegistryImpl implements CompostingChanceRegistry {
}
@Override
public void remove(Tag<Item> tag) {
public void remove(TagKey<Item> tag) {
throw new UnsupportedOperationException("Tags currently not supported!");
}
@ -55,7 +55,7 @@ public class CompostingChanceRegistryImpl implements CompostingChanceRegistry {
}
@Override
public void clear(Tag<Item> tag) {
public void clear(TagKey<Item> tag) {
throw new UnsupportedOperationException("CompostingChanceRegistry operates directly on the vanilla map - clearing not supported!");
}
}

View file

@ -21,13 +21,15 @@ import java.util.Map;
import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.tag.TagKey;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.tag.Tag;
import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.registry.FuelRegistry;
@ -36,7 +38,7 @@ import net.fabricmc.fabric.api.registry.FuelRegistry;
public final class FuelRegistryImpl implements FuelRegistry {
private static final Logger LOGGER = LoggerFactory.getLogger(FuelRegistryImpl.class);
private final Object2IntMap<ItemConvertible> itemCookTimes = new Object2IntLinkedOpenHashMap<>();
private final Object2IntMap<Tag<Item>> tagCookTimes = new Object2IntLinkedOpenHashMap<>();
private final Object2IntMap<TagKey<Item>> tagCookTimes = new Object2IntLinkedOpenHashMap<>();
private volatile Map<Item, Integer> fuelTimeCache = null; // thread safe via copy-on-write mechanism
public FuelRegistryImpl() {
@ -73,7 +75,7 @@ public final class FuelRegistryImpl implements FuelRegistry {
}
@Override
public void add(Tag<Item> tag, Integer cookTime) {
public void add(TagKey<Item> tag, Integer cookTime) {
if (cookTime > 32767) {
LOGGER.warn("Tried to register an overly high cookTime: " + cookTime + " > 32767! (" + getTagName(tag) + ")");
}
@ -89,7 +91,7 @@ public final class FuelRegistryImpl implements FuelRegistry {
}
@Override
public void remove(Tag<Item> tag) {
public void remove(TagKey<Item> tag) {
add(tag, 0);
resetCache();
}
@ -101,19 +103,20 @@ public final class FuelRegistryImpl implements FuelRegistry {
}
@Override
public void clear(Tag<Item> tag) {
public void clear(TagKey<Item> tag) {
tagCookTimes.removeInt(tag);
resetCache();
}
public void apply(Map<Item, Integer> map) {
// tags take precedence before blocks
for (Tag<Item> tag : tagCookTimes.keySet()) {
for (TagKey<Item> tag : tagCookTimes.keySet()) {
int time = tagCookTimes.getInt(tag);
if (time <= 0) {
for (Item i : tag.values()) {
map.remove(i);
for (RegistryEntry<Item> key : Registry.ITEM.method_40286(tag)) {
final Item item = key.value();
map.remove(item);
}
} else {
AbstractFurnaceBlockEntity.addFuel(map, tag, time);
@ -131,12 +134,8 @@ public final class FuelRegistryImpl implements FuelRegistry {
}
}
private static String getTagName(Tag<?> tag) {
if (tag instanceof Tag.Identified) {
return ((Tag.Identified<?>) tag).getId().toString();
}
return tag.toString();
private static String getTagName(TagKey<?> tag) {
return tag.id().toString();
}
public void resetCache() {

View file

@ -1,4 +1,4 @@
accessWidener v1 named
accessible method net/minecraft/block/entity/AbstractFurnaceBlockEntity addFuel (Ljava/util/Map;Lnet/minecraft/tag/Tag;I)V
accessible method net/minecraft/block/entity/AbstractFurnaceBlockEntity addFuel (Ljava/util/Map;Lnet/minecraft/tag/TagKey;I)V
accessible method net/minecraft/block/entity/AbstractFurnaceBlockEntity addFuel (Ljava/util/Map;Lnet/minecraft/item/ItemConvertible;I)V

View file

@ -9,7 +9,6 @@ moduleDependencies(project, [
])
dependencies {
testmodImplementation project(path: ':fabric-tag-extensions-v0', configuration: 'namedElements')
}
sourceSets {
@ -60,18 +59,17 @@ import java.util.zip.ZipFile
task generateAccessWidener() {
doLast {
// This is using loom internals, dont copy from this.
File inputJar = loom.mappingsProvider.mappedProvider.baseMappedJar
File inputJar = loom.namedMinecraftProvider.parentMinecraftProvider.mergedJar.toFile()
String accessWidener = file("template.accesswidener").text + "\n"
visitMethods(inputJar, "net/minecraft/data/server/RecipesProvider.class") { name, desc, owner ->
visitMethods(inputJar, "net/minecraft/data/server/RecipeProvider.class") { name, desc, owner ->
if (it.name == "generate")
return
accessWidener += "transitive-accessible\tmethod\t${owner}\t${name}\t${desc}\n"
}
visitMethods(inputJar, "net/minecraft/data/client/model/BlockStateModelGenerator.class") { name, desc, owner ->
visitMethods(inputJar, "net/minecraft/data/client/BlockStateModelGenerator.class") { name, desc, owner ->
if (desc == "()V")
// Skip over methods that dont take any arguments, as they are specific to minecraft.
return
@ -89,6 +87,7 @@ task generateAccessWidener() {
def visitMethods(File input, String className, closure) {
def clazz = getClassNode(input, className)
clazz.methods.forEach {
if ((it.access & Opcodes.ACC_SYNTHETIC) != 0 || (it.access & Opcodes.ACC_PUBLIC) != 0)
return
@ -101,9 +100,7 @@ def visitMethods(File input, String className, closure) {
}
ClassNode getClassNode(File input, String className) {
File inputJar = loom.mappingsProvider.mappedProvider.baseMappedJar
new ZipFile(inputJar).withCloseable { ZipFile zip ->
new ZipFile(input).withCloseable { ZipFile zip ->
zip.getInputStream(zip.getEntry(className)).withCloseable { is ->
ClassReader reader = new ClassReader(is)
ClassNode classNode = new ClassNode()

View file

@ -16,9 +16,9 @@
package net.fabricmc.fabric.api.datagen.v1.provider;
import net.minecraft.data.client.BlockStateDefinitionProvider;
import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.client.model.BlockStateModelGenerator;
import net.minecraft.data.client.ModelProvider;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
@ -27,7 +27,7 @@ import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
*
* <p>Register an instance of the class with {@link FabricDataGenerator#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}
*/
public abstract class FabricModelProvider extends BlockStateDefinitionProvider {
public abstract class FabricModelProvider extends ModelProvider {
protected final FabricDataGenerator dataGenerator;
public FabricModelProvider(FabricDataGenerator dataGenerator) {

View file

@ -25,10 +25,10 @@ import com.google.common.collect.Sets;
import com.google.gson.JsonObject;
import net.minecraft.data.DataCache;
import net.minecraft.data.server.RecipesProvider;
import net.minecraft.data.server.RecipeProvider;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.data.server.recipe.ShapedRecipeJsonFactory;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonFactory;
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
@ -40,7 +40,7 @@ import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper;
*
* <p>Register an instance of the class with {@link FabricDataGenerator#addProvider} in a {@link net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint}
*/
public abstract class FabricRecipeProvider extends RecipesProvider {
public abstract class FabricRecipeProvider extends RecipeProvider {
protected final FabricDataGenerator dataGenerator;
public FabricRecipeProvider(FabricDataGenerator dataGenerator) {
@ -49,7 +49,7 @@ public abstract class FabricRecipeProvider extends RecipesProvider {
}
/**
* Implement this method and then use the range of methods in {@link RecipesProvider} or from one of the recipe json factories such as {@link ShapedRecipeJsonFactory} & {@link ShapelessRecipeJsonFactory}.
* Implement this method and then use the range of methods in {@link RecipeProvider} or from one of the recipe json factories such as {@link ShapedRecipeJsonBuilder} & {@link ShapelessRecipeJsonBuilder}.
*/
protected abstract void generateRecipes(Consumer<RecipeJsonProvider> exporter);

View file

@ -24,6 +24,7 @@ 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;
@ -44,7 +45,6 @@ import net.minecraft.world.event.GameEvent;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper;
import net.fabricmc.fabric.mixin.datagen.DynamicRegistryManagerAccessor;
import net.fabricmc.fabric.impl.datagen.FabricTagEntry;
/**
* Implement this class (or one of the inner classes) to generate a tag list.
@ -97,7 +97,7 @@ public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
* @return The {@link FabricTagBuilder} instance
*/
@Override
protected FabricTagBuilder<T> getOrCreateTagBuilder(Tag.Identified<T> tag) {
protected FabricTagBuilder<T> getOrCreateTagBuilder(TagKey<T> tag) {
return new FabricTagBuilder<>(super.getOrCreateTagBuilder(tag));
}
@ -130,7 +130,7 @@ public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
*/
public abstract static class ItemTagProvider extends FabricTagProvider<Item> {
@Nullable
private final Function<Tag.Identified<Block>, Tag.Builder> blockTagBuilderProvider;
private final Function<TagKey<Block>, Tag.Builder> blockTagBuilderProvider;
/**
* Construct an {@link ItemTagProvider} tag provider <b>with</b> an associated {@link BlockTagProvider} tag provider.
@ -162,10 +162,10 @@ public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
* @param blockTag The block tag to copy from.
* @param itemTag The item tag to copy to.
*/
public void copy(Tag.Identified<Block> blockTag, Tag.Identified<Item> itemTag) {
public void copy(TagKey<Block> blockTag, TagKey<Item> itemTag) {
Tag.Builder blockTagBuilder = Objects.requireNonNull(this.blockTagBuilderProvider, "Pass Block tag provider via constructor to use copy").apply(blockTag);
Tag.Builder itemTagBuilder = this.getTagBuilder(itemTag);
blockTagBuilder.streamEntries().filter((entry) -> entry.getEntry().canAdd(this.registry::containsId, (id) -> true)).forEach(itemTagBuilder::add);
blockTagBuilder.streamEntries().filter((entry) -> entry.entry().canAdd(this.registry::containsId, (id) -> true)).forEach(itemTagBuilder::add);
}
}
@ -288,7 +288,7 @@ public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
* <p><b>Note:</b> any vanilla tags can be added to the builder,
* but other tags can only be added if it has a builder registered in the same provider.
*
* <p>Use {@link #forceAddTag(Tag.Identified)} to force add any tag.
* <p>Use {@link #forceAddTag(TagKey)} to force add any tag.
*
* @return the {@link FabricTagBuilder} instance
* @see BlockTags
@ -298,19 +298,8 @@ public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
* @see ItemTags
*/
@Override
public FabricTagBuilder<T> addTag(Tag.Identified<T> tag) {
builder.add(new FabricTagEntry<>(registry, tag.getId(), false), source);
return this;
}
/**
* Add another tag to this tag.
*
* @return the {@link FabricTagBuilder} instance
* @throws ClassCastException if tag is not {@linkplain Tag.Identified identified}
*/
public FabricTagBuilder<T> addTag(Tag<T> tag) {
parent.addTag((Tag.Identified<T>) tag);
public FabricTagBuilder<T> addTag(TagKey<T> tag) {
builder.add(tag.id(), source);
return this;
}
@ -333,8 +322,8 @@ public abstract class FabricTagProvider<T> extends AbstractTagProvider<T> {
*
* @return the {@link FabricTagBuilder} instance
*/
public FabricTagBuilder<T> forceAddTag(Tag.Identified<T> tag) {
builder.add(new FabricTagEntry<>(registry, tag.getId(), true), source);
public FabricTagBuilder<T> forceAddTag(TagKey<T> tag) {
builder.add(tag.id(), source);
return this;
}

View file

@ -82,7 +82,7 @@ public final class FabricDataGenHelper {
* Therefore, this simply return true for all {@link Registry#containsId} call.
*/
@SuppressWarnings("rawtypes")
private static final Registry FAKE_DYNAMIC_REGISTRY = new SimpleRegistry<>(RegistryKey.ofRegistry(new Identifier("fabric:fake_dynamic_registry")), Lifecycle.experimental()) {
private static final Registry FAKE_DYNAMIC_REGISTRY = new SimpleRegistry<>(RegistryKey.ofRegistry(new Identifier("fabric:fake_dynamic_registry")), Lifecycle.experimental(), null) {
@Override
public boolean containsId(Identifier id) {
return true;

View file

@ -1,52 +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.impl.datagen;
import java.util.function.Predicate;
import net.minecraft.tag.RequiredTagListRegistry;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagGroup;
import net.minecraft.tag.TagManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class FabricTagEntry<T> extends Tag.TagEntry {
private static final TagManager TAG_MANAGER = RequiredTagListRegistry.createBuiltinTagManager();
private final Registry<T> registry;
private final Identifier id;
private final boolean allowNonVanilla;
public FabricTagEntry(Registry<T> registry, Identifier id, boolean allowNonVanilla) {
super(id);
this.registry = registry;
this.id = id;
this.allowNonVanilla = allowNonVanilla;
}
@Override
public boolean canAdd(Predicate<Identifier> existenceTest, Predicate<Identifier> duplicationTest) {
if (allowNonVanilla) {
return true;
}
TagGroup<T> tagGroup = TAG_MANAGER.getOrCreateTagGroup(registry.getKey());
return tagGroup.contains(id) || super.canAdd(existenceTest, duplicationTest);
}
}

View file

@ -35,18 +35,18 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.block.Block;
import net.minecraft.data.DataCache;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.client.BlockStateDefinitionProvider;
import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.client.BlockStateSupplier;
import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.client.model.BlockStateModelGenerator;
import net.minecraft.data.client.model.BlockStateSupplier;
import net.minecraft.data.client.ModelProvider;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
@Mixin(BlockStateDefinitionProvider.class)
@Mixin(ModelProvider.class)
public class ModelProviderMixin {
@Shadow
@Final
@ -55,7 +55,7 @@ public class ModelProviderMixin {
@Unique
private static ThreadLocal<DataGenerator> dataGeneratorThreadLocal = new ThreadLocal<>();
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/model/BlockStateModelGenerator;register()V"))
@Redirect(method = "run", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/BlockStateModelGenerator;register()V"))
private void registerBlockStateModels(BlockStateModelGenerator instance) {
if (((Object) this) instanceof FabricModelProvider fabricModelProvider) {
fabricModelProvider.generateBlockStateModels(instance);
@ -100,7 +100,7 @@ public class ModelProviderMixin {
}
}
@Inject(method = "method_25741", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/model/ModelIds;getItemModelId(Lnet/minecraft/item/Item;)Lnet/minecraft/util/Identifier;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
@Inject(method = "method_25741", at = @At(value = "INVOKE", target = "Lnet/minecraft/data/client/ModelIds;getItemModelId(Lnet/minecraft/item/Item;)Lnet/minecraft/util/Identifier;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
private static void filterItemsForProcessingMod(Set<Item> set, Map<Identifier, Supplier<JsonElement>> map, Block block, CallbackInfo ci, Item item) {
if (dataGeneratorThreadLocal.get() instanceof FabricDataGenerator dataGenerator) {
if (!dataGenerator.isStrictValidationEnabled()) {

View file

@ -1,6 +1,6 @@
accessWidener v2 named
accessible field net/minecraft/data/server/RecipesProvider root Lnet/minecraft/data/DataGenerator;
accessible field net/minecraft/data/server/RecipeProvider root Lnet/minecraft/data/DataGenerator;
extendable method net/minecraft/data/server/AbstractTagProvider$ObjectBuilder <init> (Lnet/minecraft/tag/Tag$Builder;Lnet/minecraft/util/registry/Registry;Ljava/lang/String;)V
extendable method net/minecraft/data/server/AbstractTagProvider$ObjectBuilder add ([Ljava/lang/Object;)Lnet/minecraft/data/server/AbstractTagProvider$ObjectBuilder;
@ -14,181 +14,181 @@ accessible field net/minecraft/data/server/BlockLootTableGenerator lootTabl
transitive-accessible method net/minecraft/data/family/BlockFamilies register (Lnet/minecraft/block/Block;)Lnet/minecraft/data/family/BlockFamily$Builder;
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Ljava/lang/String;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/data/client/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/data/client/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Ljava/lang/String;Lnet/minecraft/data/client/Model;)V
transitive-accessible field net/minecraft/data/client/model/BlockStateModelGenerator blockStateCollector Ljava/util/function/Consumer;
transitive-accessible field net/minecraft/data/client/model/BlockStateModelGenerator modelCollector Ljava/util/function/BiConsumer;
transitive-accessible field net/minecraft/data/client/BlockStateModelGenerator blockStateCollector Ljava/util/function/Consumer;
transitive-accessible field net/minecraft/data/client/BlockStateModelGenerator modelCollector Ljava/util/function/BiConsumer;
transitive-accessible method net/minecraft/data/client/model/TextureKey of (Ljava/lang/String;)Lnet/minecraft/data/client/model/TextureKey;
transitive-accessible method net/minecraft/data/client/model/TextureKey of (Ljava/lang/String;Lnet/minecraft/data/client/model/TextureKey;)Lnet/minecraft/data/client/model/TextureKey;
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-accessible method net/minecraft/data/server/RecipesProvider saveRecipe (Lnet/minecraft/data/DataCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider saveRecipeAdvancement (Lnet/minecraft/data/DataCache;Lcom/google/gson/JsonObject;Ljava/nio/file/Path;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider generate (Ljava/util/function/Consumer;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerSingleOutputShapelessRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerShapelessRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;I)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerSmelting (Ljava/util/function/Consumer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBlasting (Ljava/util/function/Consumer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerMultipleOptions (Ljava/util/function/Consumer;Lnet/minecraft/recipe/CookingRecipeSerializer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerNetheriteUpgradeRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerPlanksRecipe2 (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/tag/Tag;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerPlanksRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/tag/Tag;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBarkBlockRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBoatRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider createTransmutationRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createDoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createFenceRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createFenceGateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createPressurePlateRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider createPressurePlateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider offerSlabRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider createSlabRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createStairsRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createTrapdoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider createSignRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonFactory;
transitive-accessible method net/minecraft/data/server/RecipesProvider offerWoolDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerCarpetRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerCarpetDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBedRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBedDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerBannerRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStainedGlassDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStainedGlassPaneRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStainedGlassPaneDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerTerracottaDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerConcretePowderDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStonecuttingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerStonecuttingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;I)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerCrackingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerReversibleCompactingRecipes (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerReversibleCompactingRecipesWithCompactedItemGroup (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerReversibleCompactingRecipesWithInputItemGroup (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerReversibleCompactingRecipes (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider generateCookingRecipes (Ljava/util/function/Consumer;Ljava/lang/String;Lnet/minecraft/recipe/CookingRecipeSerializer;I)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerCookingRecipe (Ljava/util/function/Consumer;Ljava/lang/String;Lnet/minecraft/recipe/CookingRecipeSerializer;ILnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;F)V
transitive-accessible method net/minecraft/data/server/RecipesProvider offerWaxingRecipes (Ljava/util/function/Consumer;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider generateFamily (Ljava/util/function/Consumer;Lnet/minecraft/data/family/BlockFamily;)V
transitive-accessible method net/minecraft/data/server/RecipesProvider getVariantRecipeInput (Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/data/family/BlockFamily$Variant;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/data/server/RecipesProvider requireEnteringFluid (Lnet/minecraft/block/Block;)Lnet/minecraft/advancement/criterion/EnterBlockCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider conditionsFromItem (Lnet/minecraft/predicate/NumberRange$IntRange;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider conditionsFromItem (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider conditionsFromTag (Lnet/minecraft/tag/Tag;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider conditionsFromItemPredicates ([Lnet/minecraft/predicate/item/ItemPredicate;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipesProvider hasItem (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider getItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider getRecipeName (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider convertBetween (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider getSmeltingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipesProvider getBlastingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createStoneState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/Texture;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createDeepslateState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/Texture;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator excludeFromSimpleItemModelGeneration (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerParentedItemModel (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerParentedItemModel (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerItemModel (Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerItemModel (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerItemModel (Lnet/minecraft/block/Block;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createNorthDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createSouthDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createEastDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createNorthDefaultRotationStates ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createBlockStateWithRandomHorizontalRotations (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createModelVariantWithRandomHorizontalRotations (Lnet/minecraft/util/Identifier;)[Lnet/minecraft/data/client/model/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createBlockStateWithTwoModelAndRandomInversion (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createBooleanModelMap (Lnet/minecraft/state/property/BooleanProperty;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerMirrorable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerRotatable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createButtonBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator fillDoorVariantMap (Lnet/minecraft/data/client/model/BlockStateVariantMap$QuadrupleProperty;Lnet/minecraft/block/enums/DoubleBlockHalf;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateVariantMap$QuadrupleProperty;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createDoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createFenceBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createWallBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createFenceGateBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createStairsBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createOrientableTrapdoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createTrapdoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createSingletonBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createAxisRotatedVariantMap ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createAxisRotatedBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerNorthDefaultHorizontalRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createAxisRotatedBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createSubModel (Lnet/minecraft/block/Block;Ljava/lang/String;Lnet/minecraft/data/client/model/Model;Ljava/util/function/Function;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createPressurePlateBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createSlabBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSimpleCubeAll (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSingleton (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSingleton (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/Texture;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCubeAllModelTexturePool (Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/model/BlockStateModelGenerator$BlockTexturePool;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerDoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerOrientableTrapdoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTrapdoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerLog (Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/model/BlockStateModelGenerator$LogTexturePool;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSimpleState (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerStateWithModelReference (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTintableCross (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTintableCross (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;Lnet/minecraft/data/client/model/Texture;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTintableCrossBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTintableCrossBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;Lnet/minecraft/data/client/model/Texture;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerFlowerPotPlant (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCoralFan (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerGourd (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCoral (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerDoubleBlock (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerDoubleBlock (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTurnableRail (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerStraightRail (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBuiltin (Lnet/minecraft/util/Identifier;Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/model/BlockStateModelGenerator$BuiltinModelPool;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBuiltin (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/model/BlockStateModelGenerator$BuiltinModelPool;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBuiltinWithParticle (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBuiltinWithParticle (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCarpet (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerRandomHorizontalRotations (Lnet/minecraft/data/client/model/TexturedModel$Factory;[Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerSouthDefaultHorizontalFacing (Lnet/minecraft/data/client/model/TexturedModel$Factory;[Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerGlassPane (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCommandBlock (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAnvil (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getBambooBlockStateVariants (I)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createUpDefaultFacingVariantMap ()Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator createValueFencedModelMap (Lnet/minecraft/state/property/Property;Ljava/lang/Comparable;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/model/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBeehive (Lnet/minecraft/block/Block;Ljava/util/function/Function;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCrop (Lnet/minecraft/block/Block;Lnet/minecraft/state/property/Property;[I)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCooker (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCampfire ([Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAzalea (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerPottedAzaleaBush (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerMushroomBlock (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCubeWithCustomTexture (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Ljava/util/function/BiFunction;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerNorthDefaultHorizontalRotatable (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/Texture;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerFurnaceLikeOrientable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerAmethyst (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getDripstoneVariant (Lnet/minecraft/util/math/Direction;Lnet/minecraft/block/enums/Thickness;)Lnet/minecraft/data/client/model/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerNetherrackBottomCustomTop (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerRod (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getFireFloorModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getFireSideModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getFireUpModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator buildBlockStateVariants (Ljava/util/List;Ljava/util/function/UnaryOperator;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerLantern (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTopSoil (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/BlockStateVariant;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerPressurePlate (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerInfested (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerNorthDefaultHorizontalRotation (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerPiston (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/Texture;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerTorch (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getTurtleEggModel (ILjava/lang/String;Lnet/minecraft/data/client/model/Texture;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator getTurtleEggModel (Ljava/lang/Integer;Ljava/lang/Integer;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerWallPlant (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerShulkerBox (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerPlantPart (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerBed (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerRoots (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator addJigsawOrientationToVariant (Lnet/minecraft/block/enums/JigsawOrientation;Lnet/minecraft/data/client/model/BlockStateVariant;)Lnet/minecraft/data/client/model/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/model/BlockStateModelGenerator registerCandle (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
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
transitive-accessible method net/minecraft/data/server/RecipeProvider offerSingleOutputShapelessRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerShapelessRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;I)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerSmelting (Ljava/util/function/Consumer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerBlasting (Ljava/util/function/Consumer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerMultipleOptions (Ljava/util/function/Consumer;Lnet/minecraft/recipe/CookingRecipeSerializer;Ljava/util/List;Lnet/minecraft/item/ItemConvertible;FILjava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerNetheriteUpgradeRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerPlanksRecipe2 (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/tag/TagKey;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerPlanksRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/tag/TagKey;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerBarkBlockRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerBoatRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider createTransmutationRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider createDoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider createFenceRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider createFenceGateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider createPressurePlateRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider createPressurePlateRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider offerSlabRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider createSlabRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider createStairsRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider createTrapdoorRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider createSignRecipe (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/recipe/Ingredient;)Lnet/minecraft/data/server/recipe/CraftingRecipeJsonBuilder;
transitive-accessible method net/minecraft/data/server/RecipeProvider offerWoolDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerCarpetRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerCarpetDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerBedRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerBedDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerBannerRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerStainedGlassDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerStainedGlassPaneRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerStainedGlassPaneDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerTerracottaDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerConcretePowderDyeingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerStonecuttingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerStonecuttingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;I)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerCrackingRecipe (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerReversibleCompactingRecipes (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerReversibleCompactingRecipesWithCompactingRecipeGroup (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerReversibleCompactingRecipesWithReverseRecipeGroup (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerReversibleCompactingRecipes (Ljava/util/function/Consumer;Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider generateCookingRecipes (Ljava/util/function/Consumer;Ljava/lang/String;Lnet/minecraft/recipe/CookingRecipeSerializer;I)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerCookingRecipe (Ljava/util/function/Consumer;Ljava/lang/String;Lnet/minecraft/recipe/CookingRecipeSerializer;ILnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;F)V
transitive-accessible method net/minecraft/data/server/RecipeProvider offerWaxingRecipes (Ljava/util/function/Consumer;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider generateFamily (Ljava/util/function/Consumer;Lnet/minecraft/data/family/BlockFamily;)V
transitive-accessible method net/minecraft/data/server/RecipeProvider getVariantRecipeInput (Lnet/minecraft/data/family/BlockFamily;Lnet/minecraft/data/family/BlockFamily$Variant;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/data/server/RecipeProvider requireEnteringFluid (Lnet/minecraft/block/Block;)Lnet/minecraft/advancement/criterion/EnterBlockCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipeProvider conditionsFromItem (Lnet/minecraft/predicate/NumberRange$IntRange;Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipeProvider conditionsFromItem (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipeProvider conditionsFromTag (Lnet/minecraft/tag/TagKey;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipeProvider conditionsFromItemPredicates ([Lnet/minecraft/predicate/item/ItemPredicate;)Lnet/minecraft/advancement/criterion/InventoryChangedCriterion$Conditions;
transitive-accessible method net/minecraft/data/server/RecipeProvider hasItem (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipeProvider getItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipeProvider getRecipeName (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipeProvider convertBetween (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipeProvider getSmeltingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/server/RecipeProvider getBlastingItemPath (Lnet/minecraft/item/ItemConvertible;)Ljava/lang/String;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createStoneState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/TextureMap;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createDeepslateState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/TextureMap;Ljava/util/function/BiConsumer;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator excludeFromSimpleItemModelGeneration (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerParentedItemModel (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerParentedItemModel (Lnet/minecraft/item/Item;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerItemModel (Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerItemModel (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerItemModel (Lnet/minecraft/block/Block;Ljava/lang/String;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createNorthDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createSouthDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createEastDefaultHorizontalRotationStates ()Lnet/minecraft/data/client/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createNorthDefaultRotationStates ()Lnet/minecraft/data/client/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createBlockStateWithRandomHorizontalRotations (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createModelVariantWithRandomHorizontalRotations (Lnet/minecraft/util/Identifier;)[Lnet/minecraft/data/client/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createBlockStateWithTwoModelAndRandomInversion (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createBooleanModelMap (Lnet/minecraft/state/property/BooleanProperty;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerMirrorable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerRotatable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createButtonBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator fillDoorVariantMap (Lnet/minecraft/data/client/BlockStateVariantMap$QuadrupleProperty;Lnet/minecraft/block/enums/DoubleBlockHalf;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateVariantMap$QuadrupleProperty;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createDoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createFenceBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createWallBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createFenceGateBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createStairsBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createOrientableTrapdoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createTrapdoorBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createSingletonBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/VariantsBlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createAxisRotatedVariantMap ()Lnet/minecraft/data/client/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createAxisRotatedBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerNorthDefaultHorizontalRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createAxisRotatedBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerAxisRotated (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;Lnet/minecraft/data/client/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createSubModel (Lnet/minecraft/block/Block;Ljava/lang/String;Lnet/minecraft/data/client/Model;Ljava/util/function/Function;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createPressurePlateBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createSlabBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateSupplier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerSimpleCubeAll (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerSingleton (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerSingleton (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TextureMap;Lnet/minecraft/data/client/Model;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCubeAllModelTexturePool (Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/BlockStateModelGenerator$BlockTexturePool;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerDoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerOrientableTrapdoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerTrapdoor (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerLog (Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/BlockStateModelGenerator$LogTexturePool;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerSimpleState (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerStateWithModelReference (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerTintableCross (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerTintableCross (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/BlockStateModelGenerator$TintType;Lnet/minecraft/data/client/model/TextureMap;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerTintableCrossBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerTintableCrossBlockState (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/BlockStateModelGenerator$TintType;Lnet/minecraft/data/client/model/TextureMap;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerFlowerPotPlant (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/data/client/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCoralFan (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerGourd (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCoral (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerDoubleBlock (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerDoubleBlock (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerTurnableRail (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerStraightRail (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerBuiltin (Lnet/minecraft/util/Identifier;Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/BlockStateModelGenerator$BuiltinModelPool;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerBuiltin (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)Lnet/minecraft/data/client/BlockStateModelGenerator$BuiltinModelPool;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerBuiltinWithParticle (Lnet/minecraft/block/Block;Lnet/minecraft/item/Item;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerBuiltinWithParticle (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerWoolAndCarpet (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerRandomHorizontalRotations (Lnet/minecraft/data/client/TexturedModel$Factory;[Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerSouthDefaultHorizontalFacing (Lnet/minecraft/data/client/TexturedModel$Factory;[Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerGlassPane (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCommandBlock (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerAnvil (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getBambooBlockStateVariants (I)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createUpDefaultFacingVariantMap ()Lnet/minecraft/data/client/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator createValueFencedModelMap (Lnet/minecraft/state/property/Property;Ljava/lang/Comparable;Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/data/client/BlockStateVariantMap;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerBeehive (Lnet/minecraft/block/Block;Ljava/util/function/Function;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCrop (Lnet/minecraft/block/Block;Lnet/minecraft/state/property/Property;[I)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCooker (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/TexturedModel$Factory;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCampfire ([Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerAzalea (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerPottedAzaleaBush (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerMushroomBlock (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCubeWithCustomTextures (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Ljava/util/function/BiFunction;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerNorthDefaultHorizontalRotatable (Lnet/minecraft/block/Block;Lnet/minecraft/data/client/model/TextureMap;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerDispenserLikeOrientable (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerAmethyst (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getDripstoneVariant (Lnet/minecraft/util/math/Direction;Lnet/minecraft/block/enums/Thickness;)Lnet/minecraft/data/client/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerNetherrackBottomCustomTop (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerRod (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getFireFloorModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getFireSideModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getFireUpModels (Lnet/minecraft/block/Block;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator buildBlockStateVariants (Ljava/util/List;Ljava/util/function/UnaryOperator;)Ljava/util/List;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerLantern (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerTopSoil (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/BlockStateVariant;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerPressurePlate (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerInfested (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerNorthDefaultHorizontalRotation (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerPiston (Lnet/minecraft/block/Block;Lnet/minecraft/util/Identifier;Lnet/minecraft/data/client/model/TextureMap;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerTorch (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getTurtleEggModel (ILjava/lang/String;Lnet/minecraft/data/client/model/TextureMap;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator getTurtleEggModel (Ljava/lang/Integer;Ljava/lang/Integer;)Lnet/minecraft/util/Identifier;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerWallPlant (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerShulkerBox (Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerPlantPart (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;Lnet/minecraft/data/client/BlockStateModelGenerator$TintType;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerBed (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerRoots (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator addJigsawOrientationToVariant (Lnet/minecraft/block/enums/JigsawOrientation;Lnet/minecraft/data/client/BlockStateVariant;)Lnet/minecraft/data/client/BlockStateVariant;
transitive-accessible method net/minecraft/data/client/BlockStateModelGenerator registerCandle (Lnet/minecraft/block/Block;Lnet/minecraft/block/Block;)V
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator applyExplosionDecay (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/function/LootFunctionConsumingBuilder;)Ljava/lang/Object;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator addSurvivesExplosionCondition (Lnet/minecraft/item/ItemConvertible;Lnet/minecraft/loot/condition/LootConditionConsumingBuilder;)Ljava/lang/Object;
transitive-accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder;

View file

@ -26,10 +26,11 @@ import java.util.function.Consumer;
import net.minecraft.advancement.Advancement;
import net.minecraft.advancement.AdvancementFrame;
import net.minecraft.advancement.criterion.OnKilledCriterion;
import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
import net.minecraft.tag.TagKey;
import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.client.model.BlockStateModelGenerator;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.data.server.recipe.ShapelessRecipeJsonFactory;
import net.minecraft.item.Items;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTable;
@ -45,7 +46,6 @@ import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.BuiltinBiomes;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
@ -57,7 +57,6 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.SimpleFabricLootTableProvider;
import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider;
import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions;
import net.fabricmc.fabric.api.tag.TagFactory;
public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
private static final ConditionJsonProvider NEVER_LOADED = DefaultResourceConditions.allModsLoaded("a");
@ -117,8 +116,8 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
@Override
protected void generateRecipes(Consumer<RecipeJsonProvider> exporter) {
ShapelessRecipeJsonFactory.create(Items.GOLD_INGOT).input(Items.DIRT).criterion("has_dirt", conditionsFromItem(Items.DIRT)).offerTo(withConditions(exporter, NEVER_LOADED));
ShapelessRecipeJsonFactory.create(Items.DIAMOND).input(Items.STICK).criterion("has_stick", conditionsFromItem(Items.STICK)).offerTo(withConditions(exporter, ALWAYS_LOADED));
ShapelessRecipeJsonBuilder.create(Items.GOLD_INGOT).input(Items.DIRT).criterion("has_dirt", conditionsFromItem(Items.DIRT)).offerTo(withConditions(exporter, NEVER_LOADED));
ShapelessRecipeJsonBuilder.create(Items.DIAMOND).input(Items.STICK).criterion("has_stick", conditionsFromItem(Items.STICK)).offerTo(withConditions(exporter, ALWAYS_LOADED));
}
}
@ -170,12 +169,12 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
@Override
protected void generateTags() {
FabricTagBuilder<Biome> builder = getOrCreateTagBuilder(TagFactory.BIOME.create(new Identifier(MOD_ID, "biome_tag_test")))
FabricTagBuilder<Biome> builder = getOrCreateTagBuilder(TagKey.intern(Registry.BIOME_KEY, new Identifier(MOD_ID, "biome_tag_test")))
.add(BiomeKeys.BADLANDS, BiomeKeys.BAMBOO_JUNGLE)
.add(BiomeKeys.BASALT_DELTAS);
try {
builder.add(BuiltinBiomes.PLAINS);
builder.add(BuiltinRegistries.BIOME.get(BiomeKeys.PLAINS));
throw new AssertionError("Adding built-in entry to dynamic registry tag builder didn't throw an exception!");
} catch (UnsupportedOperationException e) {
// no-op
@ -190,7 +189,7 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
@Override
public void generateAdvancement(Consumer<Advancement> consumer) {
Advancement root = Advancement.Task.create()
Advancement root = Advancement.Builder.create()
.display(
SIMPLE_BLOCK,
new TranslatableText("advancements.test.root.title"),
@ -200,7 +199,7 @@ public class DataGeneratorTestEntrypoint implements DataGeneratorEntrypoint {
false, false, false)
.criterion("killed_something", OnKilledCriterion.Conditions.createPlayerKilledEntity())
.build(consumer, MOD_ID + ":test/root");
Advancement rootNotLoaded = Advancement.Task.create()
Advancement rootNotLoaded = Advancement.Builder.create()
.display(
SIMPLE_BLOCK,
new TranslatableText("advancements.test.root_not_loaded.title"),

View file

@ -1,6 +1,6 @@
accessWidener v2 named
accessible field net/minecraft/data/server/RecipesProvider root Lnet/minecraft/data/DataGenerator;
accessible field net/minecraft/data/server/RecipeProvider root Lnet/minecraft/data/DataGenerator;
extendable method net/minecraft/data/server/AbstractTagProvider$ObjectBuilder <init> (Lnet/minecraft/tag/Tag$Builder;Lnet/minecraft/util/registry/Registry;Ljava/lang/String;)V
extendable method net/minecraft/data/server/AbstractTagProvider$ObjectBuilder add ([Ljava/lang/Object;)Lnet/minecraft/data/server/AbstractTagProvider$ObjectBuilder;
@ -14,12 +14,12 @@ accessible field net/minecraft/data/server/BlockLootTableGenerator lootTabl
transitive-accessible method net/minecraft/data/family/BlockFamilies register (Lnet/minecraft/block/Block;)Lnet/minecraft/data/family/BlockFamily$Builder;
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Ljava/lang/String;Lnet/minecraft/data/client/model/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/data/client/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Lnet/minecraft/item/Item;Lnet/minecraft/data/client/Model;)V
transitive-accessible method net/minecraft/data/client/ItemModelGenerator register (Lnet/minecraft/item/Item;Ljava/lang/String;Lnet/minecraft/data/client/Model;)V
transitive-accessible field net/minecraft/data/client/model/BlockStateModelGenerator blockStateCollector Ljava/util/function/Consumer;
transitive-accessible field net/minecraft/data/client/model/BlockStateModelGenerator modelCollector Ljava/util/function/BiConsumer;
transitive-accessible field net/minecraft/data/client/BlockStateModelGenerator blockStateCollector Ljava/util/function/Consumer;
transitive-accessible field net/minecraft/data/client/BlockStateModelGenerator modelCollector Ljava/util/function/BiConsumer;
transitive-accessible method net/minecraft/data/client/model/TextureKey of (Ljava/lang/String;)Lnet/minecraft/data/client/model/TextureKey;
transitive-accessible method net/minecraft/data/client/model/TextureKey of (Ljava/lang/String;Lnet/minecraft/data/client/model/TextureKey;)Lnet/minecraft/data/client/model/TextureKey;
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;

View file

@ -16,22 +16,9 @@
package net.fabricmc.fabric.mixin.dimension;
import com.mojang.serialization.Lifecycle;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.nbt.NbtElement;
import net.minecraft.resource.DataPackSettings;
import net.minecraft.server.Main;
import net.minecraft.util.dynamic.RegistryOps;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.world.gen.GeneratorOptions;
import net.minecraft.world.level.LevelInfo;
import net.minecraft.world.level.LevelProperties;
import net.minecraft.world.level.storage.LevelStorage;
/**
* This Mixin aims to solve a Minecraft Vanilla bug where datapacks are ignored during creation of the
@ -52,41 +39,5 @@ import net.minecraft.world.level.storage.LevelStorage;
*/
@Mixin(value = Main.class)
public class ServerBugfixMixin {
@Unique
private static LevelStorage.Session fabric_session;
@Unique
private static DynamicRegistryManager.Impl fabric_dynamicRegistry;
@Unique
private static RegistryOps<NbtElement> fabric_registryOps;
@ModifyVariable(at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/registry/DynamicRegistryManager;create()Lnet/minecraft/util/registry/DynamicRegistryManager$Impl;"), method = "main", allow = 1)
private static DynamicRegistryManager.Impl captureDynamicRegistry(DynamicRegistryManager.Impl value) {
fabric_dynamicRegistry = value;
return value;
}
@ModifyVariable(at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/level/storage/LevelStorage;createSession(Ljava/lang/String;)Lnet/minecraft/world/level/storage/LevelStorage$Session;"), method = "main", allow = 1)
private static LevelStorage.Session captureSession(LevelStorage.Session value) {
fabric_session = value;
return value;
}
@ModifyVariable(at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/dynamic/RegistryOps;ofLoaded(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/registry/DynamicRegistryManager;)Lnet/minecraft/util/dynamic/RegistryOps;"), method = "main", allow = 1)
private static RegistryOps<NbtElement> captureRegistryOps(RegistryOps<NbtElement> value) {
fabric_registryOps = value;
return value;
}
@Redirect(method = "main", at = @At(value = "NEW", target = "net/minecraft/world/level/LevelProperties"), allow = 1)
private static LevelProperties onCreateNewLevelProperties(LevelInfo levelInfo, GeneratorOptions generatorOptions, Lifecycle lifecycle) {
DataPackSettings dataPackSettings = levelInfo.getDataPackSettings();
// Save the level.dat file
fabric_session.backupLevelDataFile(fabric_dynamicRegistry, new LevelProperties(levelInfo, generatorOptions, lifecycle));
// And reload it again, and replace the actual level properties with it
return (LevelProperties) fabric_session.readLevelProperties(fabric_registryOps, dataPackSettings);
}
// TODO fix me 22w06a
}

View file

@ -15,7 +15,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.4.0",
"fabricloader": ">=0.12.0",
"minecraft": ">=1.16-rc.3",
"fabric-api-base": "*"
},

View file

@ -74,6 +74,11 @@ public class FabricDimensionTest implements ModInitializer {
}
ServerLifecycleEvents.SERVER_STARTED.register(server -> {
if (true) {
// TODO 22w06a ServerBugfixMixin
return;
}
ServerWorld overworld = server.getWorld(World.OVERWORLD);
ServerWorld world = server.getWorld(WORLD_KEY);

View file

@ -23,7 +23,6 @@ import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.block.BlockState;
import net.minecraft.world.gen.chunk.Blender;
import net.minecraft.world.ChunkRegion;
import net.minecraft.world.HeightLimitView;
import net.minecraft.world.Heightmap;
@ -33,9 +32,10 @@ import net.minecraft.world.biome.source.util.MultiNoiseUtil;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.chunk.Blender;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.chunk.VerticalBlockSample;
import net.minecraft.world.gen.chunk.placement.StructuresConfig;
public class VoidChunkGenerator extends ChunkGenerator {
// Just an example of adding a custom boolean

View file

@ -5,7 +5,7 @@
"ambient_light": 0.1,
"has_skylight": true,
"has_ceiling": false,
"infiniburn": "minecraft:infiniburn_overworld",
"infiniburn": "#minecraft:infiniburn_overworld",
"logical_height" : 256,
"has_raids" : false,
"respawn_anchor_works": false,

View file

@ -25,11 +25,10 @@ import java.util.function.Consumer;
import javax.xml.parsers.ParserConfigurationException;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.resource.ResourcePackManager;
import net.minecraft.resource.ServerResourceManager;
import net.minecraft.server.MinecraftServer;
import net.minecraft.test.GameTestBatch;
import net.minecraft.test.TestContext;
@ -40,7 +39,6 @@ import net.minecraft.test.TestServer;
import net.minecraft.test.TestUtil;
import net.minecraft.test.XmlReportingTestCompletionListener;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.world.level.storage.LevelStorage;
import net.fabricmc.fabric.api.gametest.v1.FabricGameTest;
@ -53,7 +51,7 @@ public final class FabricGameTestHelper {
private FabricGameTestHelper() {
}
public static void runHeadlessServer(LevelStorage.Session session, ResourcePackManager resourcePackManager, ServerResourceManager serverResourceManager, DynamicRegistryManager.Impl registryManager) {
public static void runHeadlessServer(LevelStorage.Session session, ResourcePackManager resourcePackManager) {
String reportPath = System.getProperty("fabric-api.gametest.report-file");
if (reportPath != null) {
@ -66,8 +64,7 @@ public final class FabricGameTestHelper {
LOGGER.info("Starting test server");
MinecraftServer server = TestServer.startServer(thread -> {
TestServer testServer = new TestServer(thread, session, resourcePackManager, serverResourceManager, getBatches(), BlockPos.ORIGIN, registryManager);
return testServer;
return TestServer.create(thread, session, resourcePackManager, getBatches(), BlockPos.ORIGIN);
});
}

View file

@ -18,7 +18,6 @@ package net.fabricmc.fabric.mixin.gametest.server;
import java.io.File;
import java.nio.file.Path;
import java.util.concurrent.CompletableFuture;
import com.mojang.authlib.GameProfileRepository;
import com.mojang.authlib.minecraft.MinecraftSessionService;
@ -33,15 +32,14 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.resource.DataPackSettings;
import net.minecraft.class_6904;
import net.minecraft.resource.ResourcePackManager;
import net.minecraft.resource.ServerResourceManager;
import net.minecraft.server.Main;
import net.minecraft.server.dedicated.EulaReader;
import net.minecraft.server.dedicated.ServerPropertiesLoader;
import net.minecraft.util.UserCache;
import net.minecraft.util.dynamic.RegistryOps;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.world.SaveProperties;
import net.minecraft.world.level.storage.LevelStorage;
import net.minecraft.world.level.storage.LevelSummary;
@ -54,10 +52,10 @@ public class MainMixin {
return FabricGameTestHelper.ENABLED || reader.isEulaAgreedTo();
}
@Inject(method = "main", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/storage/LevelStorage$Session;readLevelProperties(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/resource/DataPackSettings;)Lnet/minecraft/world/SaveProperties;"))
private static void main(String[] args, CallbackInfo info, OptionParser optionParser, OptionSpec o1, OptionSpec o2, OptionSpec o3, OptionSpec o4, OptionSpec o5, OptionSpec o6, OptionSpec o7, OptionSpec o8, OptionSpec o9, OptionSpec o10, OptionSpec o11, OptionSpec o12, OptionSpec o13, OptionSpec o14, OptionSpec o15, OptionSet optionSet, DynamicRegistryManager.Impl impl, Path path, ServerPropertiesLoader serverPropertiesLoader, Path path2, EulaReader eulaReader, File file, YggdrasilAuthenticationService yggdrasilAuthenticationService, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, String string, LevelStorage levelStorage, LevelStorage.Session session, LevelSummary levelSummary, DataPackSettings dataPackSettings, boolean bl, ResourcePackManager resourcePackManager, DataPackSettings dataPackSettings2, CompletableFuture completableFuture, ServerResourceManager serverResourceManager, RegistryOps registryOps) {
@Inject(method = "main", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;startServer(Ljava/util/function/Function;)Lnet/minecraft/server/MinecraftServer;"))
private static void main(String[] args, CallbackInfo info, OptionParser optionParser, OptionSpec optionSpec, OptionSpec optionSpec2, OptionSpec optionSpec3, OptionSpec optionSpec4, OptionSpec optionSpec5, OptionSpec optionSpec6, OptionSpec optionSpec7, OptionSpec optionSpec8, OptionSpec optionSpec9, OptionSpec optionSpec10, OptionSpec optionSpec11, OptionSpec optionSpec12, OptionSpec optionSpec13, OptionSpec optionSpec14, OptionSpec optionSpec15, OptionSet optionSet, Path path, ServerPropertiesLoader serverPropertiesLoader, Path path2, EulaReader eulaReader, File file, YggdrasilAuthenticationService yggdrasilAuthenticationService, MinecraftSessionService minecraftSessionService, GameProfileRepository gameProfileRepository, UserCache userCache, String string, LevelStorage levelStorage, LevelStorage.Session session, LevelSummary levelSummary, boolean bl, ResourcePackManager resourcePackManager, class_6904 lv2, DynamicRegistryManager.class_6890 lv3, SaveProperties saveProperties) {
if (FabricGameTestHelper.ENABLED) {
FabricGameTestHelper.runHeadlessServer(session, resourcePackManager, serverResourceManager, impl);
FabricGameTestHelper.runHeadlessServer(session, resourcePackManager);
info.cancel(); // Do not progress in starting the normal dedicated server
}
}

View file

@ -1,6 +1,10 @@
archivesBaseName = "fabric-lifecycle-events-v1"
version = getSubprojectVersion(project)
loom {
accessWidenerPath = file("src/main/resources/fabric-lifecycle-events-v1.accesswidener")
}
moduleDependencies(project, [
'fabric-api-base'
])

View file

@ -42,7 +42,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
@Mixin(MinecraftServer.class)
public abstract class MinecraftServerMixin {
@Shadow
private ServerResourceManager serverResourceManager;
private MinecraftServer.class_6897 serverResourceManager;
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;setupServer()Z"), method = "runServer")
private void beforeSetupServer(CallbackInfo info) {
@ -91,14 +91,14 @@ public abstract class MinecraftServerMixin {
@Inject(method = "reloadResources", at = @At("HEAD"))
private void startResourceReload(Collection<String> collection, CallbackInfoReturnable<CompletableFuture<Void>> cir) {
ServerLifecycleEvents.START_DATA_PACK_RELOAD.invoker().startDataPackReload((MinecraftServer) (Object) this, this.serverResourceManager);
ServerLifecycleEvents.START_DATA_PACK_RELOAD.invoker().startDataPackReload((MinecraftServer) (Object) this, (ServerResourceManager) this.serverResourceManager.resourceManager());
}
@Inject(method = "reloadResources", at = @At("TAIL"))
private void endResourceReload(Collection<String> collection, CallbackInfoReturnable<CompletableFuture<Void>> cir) {
cir.getReturnValue().handleAsync((value, throwable) -> {
// Hook into fail
ServerLifecycleEvents.END_DATA_PACK_RELOAD.invoker().endDataPackReload((MinecraftServer) (Object) this, this.serverResourceManager, throwable == null);
ServerLifecycleEvents.END_DATA_PACK_RELOAD.invoker().endDataPackReload((MinecraftServer) (Object) this, (ServerResourceManager) this.serverResourceManager.resourceManager(), throwable == null);
return value;
}, (MinecraftServer) (Object) this);
}

View file

@ -0,0 +1,3 @@
accessWidener v2 named
accessible class net/minecraft/server/MinecraftServer$class_6897

View file

@ -33,5 +33,6 @@
"description": "Events for the game's lifecycle.",
"custom": {
"fabric-api:module-lifecycle": "stable"
}
},
"accessWidener": "fabric-lifecycle-events-v1.accesswidener"
}

View file

@ -3,8 +3,7 @@ version = getSubprojectVersion(project)
moduleDependencies(project, [
'fabric-api-base',
'fabric-resource-loader-v0',
'fabric-tag-extensions-v0'
'fabric-resource-loader-v0'
])
dependencies {

View file

@ -17,10 +17,9 @@
package net.fabricmc.fabric.api.mininglevel.v1;
import net.minecraft.block.Block;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.tag.TagFactory;
import net.minecraft.util.registry.Registry;
/**
* Defines additional {@code mineable} tags for vanilla tools not covered by vanilla.
@ -36,17 +35,17 @@ public final class FabricMineableTags {
* <p>As swords have materials and mining levels, the mining level tags described in
* {@link MiningLevelManager} also apply.
*/
public static final Tag.Identified<Block> SWORD_MINEABLE = register("mineable/sword");
public static final TagKey<Block> SWORD_MINEABLE = register("mineable/sword");
/**
* Blocks in this tag ({@code #fabric:mineable/shears}) can be effectively mined with shears.
*/
public static final Tag.Identified<Block> SHEARS_MINEABLE = register("mineable/shears");
public static final TagKey<Block> SHEARS_MINEABLE = register("mineable/shears");
private FabricMineableTags() {
}
private static Tag.Identified<Block> register(String id) {
return TagFactory.BLOCK.create(new Identifier("fabric", id));
private static TagKey<Block> register(String id) {
return TagKey.intern(Registry.BLOCK_KEY, new Identifier("fabric", id));
}
}

View file

@ -21,14 +21,13 @@ import java.util.regex.Pattern;
import it.unimi.dsi.fastutil.objects.Reference2IntMap;
import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.tag.TagKey;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.TagGroup;
import net.minecraft.util.Identifier;
import net.fabricmc.yarn.constants.MiningLevels;
@ -44,16 +43,15 @@ public final class MiningLevelManagerImpl {
public static int getRequiredMiningLevel(BlockState state) {
return CACHE.get().computeIntIfAbsent(state, s -> {
TagGroup<Block> blockTags = BlockTags.getTagGroup();
int miningLevel = MiningLevels.HAND;
// Handle #fabric:needs_tool_level_N
for (Identifier tagId : blockTags.getTagsFor(state.getBlock())) {
if (!tagId.getNamespace().equals(TOOL_TAG_NAMESPACE)) {
for (TagKey<Block> tagId : state.method_40144().toList()) {
if (!tagId.id().getNamespace().equals(TOOL_TAG_NAMESPACE)) {
continue;
}
Matcher matcher = TOOL_TAG_PATTERN.matcher(tagId.getPath());
Matcher matcher = TOOL_TAG_PATTERN.matcher(tagId.id().getPath());
if (matcher.matches()) {
try {

View file

@ -23,8 +23,7 @@
"depends": {
"fabricloader": ">=0.4.0",
"fabric-api-base": "*",
"fabric-resource-loader-v0": "*",
"fabric-tag-extensions-v0": "*"
"fabric-resource-loader-v0": "*"
},
"description": "Adds support for custom mining levels.",
"mixins": [

View file

@ -1,8 +0,0 @@
archivesBaseName = "fabric-mining-levels-v0"
version = getSubprojectVersion(project)
moduleDependencies(project, [
'fabric-api-base',
'fabric-tag-extensions-v0',
'fabric-tool-attribute-api-v1'
])

View file

@ -1,43 +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.api.tag;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
/**
* Item tags provided by Fabric.
*
* @deprecated Use dedicated classes, such as {@link FabricToolTags}
*/
@Deprecated
public class FabricItemTags {
public static final Tag<Item> AXES = FabricToolTags.AXES;
public static final Tag<Item> HOES = FabricToolTags.HOES;
public static final Tag<Item> PICKAXES = FabricToolTags.PICKAXES;
public static final Tag<Item> SHOVELS = FabricToolTags.SHOVELS;
public static final Tag<Item> SWORDS = FabricToolTags.SWORDS;
private FabricItemTags() { }
private static Tag<Item> register(String id) {
return TagRegistry.item(new Identifier("fabric", id));
}
}

View file

@ -1,36 +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.api.tools;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag;
/**
* Tool item tags provided by Fabric.
*
* @deprecated Use the moved {@link net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags} class instead
*/
@Deprecated
public class FabricToolTags {
public static final Tag<Item> AXES = net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags.AXES;
public static final Tag<Item> HOES = net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags.HOES;
public static final Tag<Item> PICKAXES = net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags.PICKAXES;
public static final Tag<Item> SHOVELS = net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags.SHOVELS;
public static final Tag<Item> SWORDS = net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags.SWORDS;
private FabricToolTags() { }
}

View file

@ -1,28 +0,0 @@
{
"schemaVersion": 1,
"id": "fabric-mining-levels-v0",
"name": "Fabric Mining Levels (v0)",
"version": "${version}",
"environment": "*",
"license": "Apache-2.0",
"icon": "assets/fabric-mining-levels-v0/icon.png",
"contact": {
"homepage": "https://fabricmc.net",
"irc": "irc://irc.esper.net:6667/fabric",
"issues": "https://github.com/FabricMC/fabric/issues",
"sources": "https://github.com/FabricMC/fabric"
},
"authors": [
"FabricMC"
],
"depends": {
"fabricloader": ">=0.4.0",
"fabric-api-base": "*",
"fabric-tag-extensions-v0": "*",
"fabric-tool-attribute-api-v1": "*"
},
"description": "Block mining level tags for tools. Deprecated and replaced by fabric-tool-attribute-v1.",
"custom": {
"fabric-api:module-lifecycle": "deprecated"
}
}

View file

@ -46,7 +46,7 @@ final class ChannelScreen extends Screen {
this.c2sButton = this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, 5, 50, 20, new LiteralText("C2S"), this::toC2S, (button, matrices, mouseX, mouseY) -> {
this.renderTooltip(matrices, new LiteralText("Packets the server can receive"), mouseX, mouseY);
}));
this.closeButton = this.addDrawableChild(new ButtonWidget(this.width / 2 - 60, this.height - 25, 120, 20, new LiteralText("Close"), button -> this.onClose()));
this.closeButton = this.addDrawableChild(new ButtonWidget(this.width / 2 - 60, this.height - 25, 120, 20, new LiteralText("Close"), button -> this.close()));
this.channelList = this.addDrawable(new ChannelList(this.client, this.width, this.height - 60, 30, this.height - 30, this.textRenderer.fontHeight + 2));
}

View file

@ -7,9 +7,7 @@ dependencies {
moduleDependencies(project, [
'fabric-api-base',
'fabric-resource-loader-v0',
'fabric-tag-extensions-v0',
'fabric-tool-attribute-api-v1'
'fabric-resource-loader-v0'
])
loom {

View file

@ -24,14 +24,10 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.MapColor;
import net.minecraft.block.Material;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.tag.Tag;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.impl.object.builder.BlockSettingsInternals;
import net.fabricmc.fabric.impl.object.builder.FabricBlockInternals;
import net.fabricmc.fabric.mixin.object.builder.AbstractBlockAccessor;
import net.fabricmc.fabric.mixin.object.builder.AbstractBlockSettingsAccessor;
@ -68,14 +64,6 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
thisAccessor.setOpaque(otherAccessor.getOpaque());
thisAccessor.setIsAir(otherAccessor.getIsAir());
thisAccessor.setToolRequired(otherAccessor.isToolRequired());
// Now attempt to copy fabric specific data
BlockSettingsInternals otherInternals = (BlockSettingsInternals) settings;
FabricBlockInternals.ExtraData extraData = otherInternals.getExtraData();
if (extraData != null) { // If present, populate the extra data on our new settings
((BlockSettingsInternals) this).setExtraData(extraData);
}
}
public static FabricBlockSettings of(Material material) {
@ -301,37 +289,4 @@ public class FabricBlockSettings extends AbstractBlock.Settings {
((AbstractBlockSettingsAccessor) this).setCollidable(collidable);
return this;
}
/* FABRIC HELPERS */
/**
* Makes the block breakable by any tool if {@code breakByHand} is set to true.
*/
public FabricBlockSettings breakByHand(boolean breakByHand) {
FabricBlockInternals.computeExtraData(this).breakByHand(breakByHand);
return this;
}
/**
* Please make the block require a tool if you plan to disable drops and slow the breaking down using the
* incorrect tool by using {@link FabricBlockSettings#requiresTool()}.
*
* @deprecated Replaced by {@code mineable} tags. See fabric-mining-level-api-v1 for further details.
*/
@Deprecated(forRemoval = true)
public FabricBlockSettings breakByTool(Tag<Item> tag, int miningLevel) {
FabricBlockInternals.computeExtraData(this).addMiningLevel(tag, miningLevel);
return this;
}
/**
* Please make the block require a tool if you plan to disable drops and slow the breaking down using the
* incorrect tool by using {@link FabricBlockSettings#requiresTool()}.
*
* @deprecated Replaced by {@code mineable} tags. See fabric-mining-level-api-v1 for further details.S
*/
@Deprecated(forRemoval = true)
public FabricBlockSettings breakByTool(Tag<Item> tag) {
return this.breakByTool(tag, 0);
}
}

View file

@ -1,23 +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.impl.object.builder;
public interface BlockSettingsInternals {
FabricBlockInternals.ExtraData getExtraData();
void setExtraData(FabricBlockInternals.ExtraData extraData);
}

View file

@ -1,85 +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.impl.object.builder;
import java.util.ArrayList;
import java.util.List;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag;
import net.fabricmc.fabric.impl.tool.attribute.ToolManagerImpl;
public final class FabricBlockInternals {
private FabricBlockInternals() {
}
public static ExtraData computeExtraData(Block.Settings settings) {
BlockSettingsInternals internals = (BlockSettingsInternals) settings;
if (internals.getExtraData() == null) {
internals.setExtraData(new ExtraData(settings));
}
return internals.getExtraData();
}
public static void onBuild(Block.Settings settings, Block block) {
// TODO: Load only if fabric-tool-attribute-api present
ExtraData data = ((BlockSettingsInternals) settings).getExtraData();
if (data != null) {
if (data.breakByHand != null) {
ToolManagerImpl.entry(block).setBreakByHand(data.breakByHand);
}
for (MiningLevel tml : data.miningLevels) {
ToolManagerImpl.entry(block).putBreakByTool(tml.tag, tml.level);
}
}
}
public static final class ExtraData {
private final List<MiningLevel> miningLevels = new ArrayList<>();
@Nullable
private Boolean breakByHand;
public ExtraData(Block.Settings settings) {
}
public void breakByHand(boolean breakByHand) {
this.breakByHand = breakByHand;
}
public void addMiningLevel(Tag<Item> tag, int level) {
miningLevels.add(new MiningLevel(tag, level));
}
}
public static final class MiningLevel {
private final Tag<Item> tag;
private final int level;
MiningLevel(Tag<Item> tag, int level) {
this.tag = tag;
this.level = level;
}
}
}

View file

@ -1,41 +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.mixin.object.builder;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import net.minecraft.block.AbstractBlock;
import net.fabricmc.fabric.impl.object.builder.BlockSettingsInternals;
import net.fabricmc.fabric.impl.object.builder.FabricBlockInternals;
@Mixin(AbstractBlock.Settings.class)
public abstract class AbstractBlockSettingsMixin implements BlockSettingsInternals {
@Unique
private FabricBlockInternals.ExtraData fabricExtraData;
@Override
public FabricBlockInternals.ExtraData getExtraData() {
return this.fabricExtraData;
}
@Override
public void setExtraData(FabricBlockInternals.ExtraData extraData) {
this.fabricExtraData = extraData;
}
}

View file

@ -1,35 +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.mixin.object.builder;
import org.spongepowered.asm.mixin.Mixin;
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.block.Block;
import net.minecraft.block.AbstractBlock;
import net.fabricmc.fabric.impl.object.builder.FabricBlockInternals;
@Mixin(Block.class)
public abstract class MixinBlock {
@Inject(method = "<init>(Lnet/minecraft/block/AbstractBlock$Settings;)V", at = @At("RETURN"))
public void fabric_init(AbstractBlock.Settings builder, CallbackInfo info) {
FabricBlockInternals.onBuild(builder, (Block) (Object) this);
}
}

View file

@ -5,13 +5,11 @@
"mixins": [
"AbstractBlockAccessor",
"AbstractBlockSettingsAccessor",
"AbstractBlockSettingsMixin",
"CriteriaAccessor",
"DefaultAttributeRegistryAccessor",
"DefaultAttributeRegistryMixin",
"DetectorRailBlockMixin",
"MaterialBuilderAccessor",
"MixinBlock",
"PointOfInterestTypeAccessor",
"SpawnRestrictionAccessor",
"TypeAwareTradeMixin",

View file

@ -17,8 +17,7 @@
],
"depends": {
"fabricloader": ">=0.8.2",
"fabric-api-base": "*",
"fabric-tool-attribute-api-v1": "*"
"fabric-api-base": "*"
},
"description": "Builders for objects vanilla has locked down.",
"mixins": [

View file

@ -1,7 +0,0 @@
archivesBaseName = "fabric-object-builders"
version = getSubprojectVersion(project)
moduleDependencies(project, [
'fabric-api-base',
'fabric-object-builder-api-v1'
])

View file

@ -1,93 +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.api.block;
import net.minecraft.block.AbstractBlock.Settings;
import net.minecraft.block.MapColor;
import net.minecraft.item.Item;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier;
import net.fabricmc.fabric.impl.object.builder.FabricBlockInternals;
import net.fabricmc.fabric.mixin.object.builder.AbstractBlockSettingsAccessor;
/**
* @deprecated Please migrate to v1. Please use methods in {@link net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings} instead.
*/
@Deprecated
public final class BlockSettingsExtensions {
private BlockSettingsExtensions() {
}
public static void breakByHand(Settings settings, boolean breakByHand) {
FabricBlockInternals.computeExtraData(settings).breakByHand(breakByHand);
}
public static void breakByTool(Settings settings, Tag<Item> tag, int miningLevel) {
FabricBlockInternals.computeExtraData(settings).addMiningLevel(tag, miningLevel);
}
public static void hardness(Settings settings, float hardness) {
((AbstractBlockSettingsAccessor) settings).setHardness(hardness);
}
public static void resistance(Settings settings, float resistance) {
((AbstractBlockSettingsAccessor) settings).setResistance(Math.max(0.0F, resistance));
}
public static void collidable(Settings settings, boolean collidable) {
((AbstractBlockSettingsAccessor) settings).setCollidable(collidable);
}
public static void materialColor(Settings settings, MapColor color) {
((AbstractBlockSettingsAccessor) settings).setMapColorProvider(ignored -> color);
}
public static void drops(Settings settings, Identifier dropTableId) {
((AbstractBlockSettingsAccessor) settings).setLootTableId(dropTableId);
}
public static void sounds(Settings settings, BlockSoundGroup soundGroup) {
((AbstractBlockSettingsAccessor) settings).invokeSounds(soundGroup);
}
public static void lightLevel(Settings settings, int lightLevel) {
((AbstractBlockSettingsAccessor) settings).setLuminanceFunction(ignored -> lightLevel);
}
public static void breakInstantly(Settings settings) {
((AbstractBlockSettingsAccessor) settings).invokeBreakInstantly();
}
public static void strength(Settings settings, float strength) {
((AbstractBlockSettingsAccessor) settings).invokeStrength(strength);
}
public static void ticksRandomly(Settings settings) {
((AbstractBlockSettingsAccessor) settings).invokeTicksRandomly();
}
public static void dynamicBounds(Settings settings) {
// Thanks Mixin
((AbstractBlockSettingsAccessor) settings).setDynamicBounds(true);
}
public static void dropsNothing(Settings settings) {
((AbstractBlockSettingsAccessor) settings).invokeDropsNothing();
}
}

View file

@ -1,199 +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.api.block;
import java.util.function.Function;
import net.minecraft.block.Block;
import net.minecraft.block.MapColor;
import net.minecraft.block.Material;
import net.minecraft.item.Item;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.tag.Tag;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
/**
* @deprecated Please migrate to v1. Please use {@link net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings} instead
*/
@Deprecated
public class FabricBlockSettings {
protected final net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings delegate;
protected FabricBlockSettings(Material material, MapColor color) {
this(Block.Settings.of(material, color));
}
protected FabricBlockSettings(Block base) {
this(Block.Settings.copy(base));
}
protected FabricBlockSettings(final Block.Settings delegate) {
this.delegate = net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings.copyOf(delegate);
}
public static FabricBlockSettings of(Material material) {
return of(material, material.getColor());
}
public static FabricBlockSettings of(Material material, MapColor color) {
return new FabricBlockSettings(material, color);
}
public static FabricBlockSettings of(Material material, DyeColor color) {
return new FabricBlockSettings(material, color.getMapColor());
}
public static FabricBlockSettings copy(Block base) {
return new FabricBlockSettings(base);
}
public static FabricBlockSettings copyOf(Block.Settings settings) {
return new FabricBlockSettings(settings);
}
/* FABRIC HELPERS */
/**
* Makes the block breakable by any tool if {@code breakByHand} is set to true.
*/
public FabricBlockSettings breakByHand(boolean breakByHand) {
this.delegate.breakByHand(breakByHand);
return this;
}
/**
* Please make the block require a tool if you plan to disable drops and slow the breaking down using the
* incorrect tool by using {@link net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings#requiresTool()}.
*/
public FabricBlockSettings breakByTool(Tag<Item> tag, int miningLevel) {
this.delegate.breakByTool(tag, miningLevel);
return this;
}
/**
* Please make the block require a tool if you plan to disable drops and slow the breaking down using the
* incorrect tool by using {@link net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings#requiresTool()}.
*/
public FabricBlockSettings breakByTool(Tag<Item> tag) {
this.delegate.breakByTool(tag);
return this;
}
/* DELEGATE WRAPPERS */
public FabricBlockSettings materialColor(MapColor color) {
this.delegate.materialColor(color);
return this;
}
public FabricBlockSettings materialColor(DyeColor color) {
this.delegate.materialColor(color.getMapColor());
return this;
}
public FabricBlockSettings collidable(boolean collidable) {
this.delegate.collidable(collidable);
return this;
}
public FabricBlockSettings noCollision() {
this.delegate.noCollision();
return this;
}
public FabricBlockSettings nonOpaque() {
this.delegate.nonOpaque();
return this;
}
public FabricBlockSettings sounds(BlockSoundGroup group) {
this.delegate.sounds(group);
return this;
}
public FabricBlockSettings ticksRandomly() {
this.delegate.ticksRandomly();
return this;
}
public FabricBlockSettings lightLevel(int lightLevel) {
this.delegate.lightLevel(lightLevel);
return this;
}
public FabricBlockSettings hardness(float hardness) {
this.delegate.hardness(hardness);
return this;
}
public FabricBlockSettings resistance(float resistance) {
this.delegate.resistance(resistance);
return this;
}
public FabricBlockSettings strength(float hardness, float resistance) {
this.delegate.strength(hardness, resistance);
return this;
}
public FabricBlockSettings breakInstantly() {
this.delegate.breakInstantly();
return this;
}
public FabricBlockSettings dropsNothing() {
this.delegate.dropsNothing();
return this;
}
public FabricBlockSettings dropsLike(Block block) {
this.delegate.dropsLike(block);
return this;
}
public FabricBlockSettings drops(Identifier dropTableId) {
this.delegate.drops(dropTableId);
return this;
}
@Deprecated
public FabricBlockSettings friction(float friction) {
this.delegate.slipperiness(friction);
return this;
}
public FabricBlockSettings slipperiness(float value) {
this.delegate.slipperiness(value);
return this;
}
public FabricBlockSettings dynamicBounds() {
this.delegate.dynamicBounds();
return this;
}
/* BUILDING LOGIC */
public Block.Settings build() {
return this.delegate;
}
public <T> T build(Function<Block.Settings, T> function) {
return function.apply(this.delegate);
}
}

View file

@ -1,96 +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.api.block;
import net.minecraft.block.MapColor;
import net.minecraft.block.Material;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.util.DyeColor;
/**
* @deprecated Please migrate to v1. Please use {@link net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder} instead.
*/
@Deprecated
public class FabricMaterialBuilder extends Material.Builder {
private net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder delegate;
public FabricMaterialBuilder(MapColor color) {
super(color);
this.delegate = new net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder(color);
}
public FabricMaterialBuilder(DyeColor color) {
this(color.getMapColor());
}
@Override
public FabricMaterialBuilder burnable() {
this.delegate.burnable();
return this;
}
public FabricMaterialBuilder pistonBehavior(PistonBehavior behavior) {
this.delegate.pistonBehavior(behavior);
return this;
}
public FabricMaterialBuilder lightPassesThrough() {
this.delegate.lightPassesThrough();
return this;
}
@Override
public FabricMaterialBuilder destroyedByPiston() {
this.delegate.destroyedByPiston();
return this;
}
@Override
public FabricMaterialBuilder blocksPistons() {
this.delegate.blocksPistons();
return this;
}
@Override
public FabricMaterialBuilder allowsMovement() {
this.delegate.allowsMovement();
return this;
}
@Override
public FabricMaterialBuilder liquid() {
this.delegate.liquid();
return this;
}
@Override
public FabricMaterialBuilder notSolid() {
this.delegate.notSolid();
return this;
}
@Override
public FabricMaterialBuilder replaceable() {
this.delegate.replaceable();
return this;
}
@Override
public Material build() {
return this.delegate.build();
}
}

View file

@ -1,84 +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.api.entity;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import net.minecraft.entity.EntityType;
import net.minecraft.util.registry.Registry;
/**
* Registry for server-&gt;client entity tracking values.
*
* @deprecated Use FabricEntityTypeBuilder methods
*/
@SuppressWarnings("deprecation")
@Deprecated
public class EntityTrackingRegistry {
private static final Logger LOGGER = LoggerFactory.getLogger(EntityTrackingRegistry.class);
@Deprecated
public static class Entry {
private final int trackingDistance;
private final int updateIntervalTicks;
private final boolean alwaysUpdateVelocity;
public Entry(int trackingDistance, int updateIntervalTicks, boolean alwaysUpdateVelocity) {
this.trackingDistance = trackingDistance;
this.updateIntervalTicks = updateIntervalTicks;
this.alwaysUpdateVelocity = alwaysUpdateVelocity;
}
public int getTrackingDistance() {
return trackingDistance;
}
public int getUpdateIntervalTicks() {
return updateIntervalTicks;
}
public boolean alwaysUpdateVelocity() {
return alwaysUpdateVelocity;
}
}
@Deprecated
public static final EntityTrackingRegistry INSTANCE = new EntityTrackingRegistry();
private final Map<EntityType, Entry> entries = new HashMap<>();
private EntityTrackingRegistry() { }
@Deprecated
public Entry get(EntityType type) {
return entries.get(type);
}
@Deprecated
public void register(EntityType type, int trackingDistance, int updateIntervalTicks) {
register(type, trackingDistance, updateIntervalTicks, true);
}
@Deprecated
public void register(EntityType type, int trackingDistance, int updateIntervalTicks, boolean alwaysUpdateVelocity) {
LOGGER.warn("Deprecation warning: As of February 2019, registering tracking via EntityTrackingRegistry is no longer effective. Use FabricEntityTypeBuilder. (Entity: " + Registry.ENTITY_TYPE.getId(type) + ")");
entries.put(type, new Entry(trackingDistance, updateIntervalTicks, alwaysUpdateVelocity));
}
}

View file

@ -1,35 +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.api.entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
/**
* @deprecated Please use {@link net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry} instead.
*/
@Deprecated
public final class FabricDefaultAttributeRegistry {
/**
* @deprecated Please {@link net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry#register(EntityType, DefaultAttributeContainer.Builder)} instead.
*/
@Deprecated
public static void register(EntityType<? extends LivingEntity> type, DefaultAttributeContainer.Builder builder) {
net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry.register(type, builder);
}
}

View file

@ -1,96 +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.api.entity;
import java.util.function.Function;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.world.World;
/**
* @deprecated Please migrate to v1. Please use {@link net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder} instead.
*/
@Deprecated
public class FabricEntityTypeBuilder<T extends Entity> {
private final net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder<T> delegate;
protected FabricEntityTypeBuilder(SpawnGroup spawnGroup, EntityType.EntityFactory<T> function) {
this.delegate = net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder.create(spawnGroup, function);
}
public static <T extends Entity> FabricEntityTypeBuilder<T> create(SpawnGroup spawnGroup) {
return new FabricEntityTypeBuilder<>(spawnGroup, (t, w) -> null);
}
/**
* @deprecated Use {@link FabricEntityTypeBuilder#create(SpawnGroup, EntityType.EntityFactory)}
*/
@Deprecated
public static <T extends Entity> FabricEntityTypeBuilder<T> create(SpawnGroup spawnGroup, Function<? super World, ? extends T> function) {
return create(spawnGroup, (t, w) -> function.apply(w));
}
public static <T extends Entity> FabricEntityTypeBuilder<T> create(SpawnGroup spawnGroup, EntityType.EntityFactory<T> function) {
return new FabricEntityTypeBuilder<>(spawnGroup, function);
}
public FabricEntityTypeBuilder<T> disableSummon() {
this.delegate.disableSummon();
return this;
}
public FabricEntityTypeBuilder<T> disableSaving() {
this.delegate.disableSaving();
return this;
}
public FabricEntityTypeBuilder<T> setImmuneToFire() {
this.delegate.fireImmune();
return this;
}
/**
* @deprecated Use {@link FabricEntityTypeBuilder#size(EntityDimensions)}
*/
@Deprecated
public FabricEntityTypeBuilder<T> size(float width, float height) {
this.delegate.dimensions(EntityDimensions.changing(width, height));
return this;
}
public FabricEntityTypeBuilder<T> size(EntityDimensions size) {
this.delegate.dimensions(size);
return this;
}
public FabricEntityTypeBuilder<T> trackable(int trackingDistanceBlocks, int updateIntervalTicks) {
this.delegate.trackRangeBlocks(trackingDistanceBlocks).trackedUpdateRate(updateIntervalTicks).forceTrackedVelocityUpdates(true);
return this;
}
public FabricEntityTypeBuilder<T> trackable(int trackingDistanceBlocks, int updateIntervalTicks, boolean alwaysUpdateVelocity) {
this.delegate.trackRangeBlocks(trackingDistanceBlocks).trackedUpdateRate(updateIntervalTicks).forceTrackedVelocityUpdates(alwaysUpdateVelocity);
return this;
}
public EntityType<T> build() {
return this.delegate.build();
}
}

View file

@ -1,38 +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.api.event.registry;
import net.minecraft.block.Block;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
/**
* @deprecated Please migrate to v1. Please use registry events instead.
*/
@Deprecated
public interface BlockConstructedCallback {
Event<BlockConstructedCallback> EVENT = EventFactory.createArrayBacked(BlockConstructedCallback.class,
(listeners) -> (settings, builtBlock) -> {
for (BlockConstructedCallback callback : listeners) {
callback.building(settings, builtBlock);
}
}
);
void building(Block.Settings settings, Block builtBlock);
}

View file

@ -1,38 +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.api.event.registry;
import net.minecraft.item.Item;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
/**
* @deprecated Please migrate to v1. Please use Please use registry events instead.
*/
@Deprecated
public interface ItemConstructedCallback {
Event<ItemConstructedCallback> EVENT = EventFactory.createArrayBacked(ItemConstructedCallback.class,
(listeners) -> (settings, builtItem) -> {
for (ItemConstructedCallback callback : listeners) {
callback.building(settings, builtItem);
}
}
);
void building(Item.Settings settings, Item builtItem);
}

View file

@ -1,35 +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.mixin.object.builder;
import org.spongepowered.asm.mixin.Mixin;
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.item.Item;
import net.fabricmc.fabric.api.event.registry.ItemConstructedCallback;
@Mixin(Item.class)
@Deprecated
public class OldMixinItem {
@Inject(method = "<init>(Lnet/minecraft/item/Item$Settings;)V", at = @At("RETURN"))
public void init(Item.Settings builder, CallbackInfo info) {
ItemConstructedCallback.EVENT.invoker().building(builder, (Item) (Object) this);
}
}

View file

@ -1,12 +0,0 @@
{
"required": true,
"package": "net.fabricmc.fabric.mixin.object.builder",
"compatibilityLevel": "JAVA_16",
"mixins": [
"OldMixinBlock",
"OldMixinItem"
],
"injectors": {
"defaultRequire": 1
}
}

View file

@ -1,30 +0,0 @@
{
"schemaVersion": 1,
"id": "fabric-object-builders-v0",
"name": "Fabric Object Builders (v0)",
"version": "${version}",
"environment": "*",
"license": "Apache-2.0",
"icon": "assets/fabric-object-builders-v0/icon.png",
"contact": {
"homepage": "https://fabricmc.net",
"irc": "irc://irc.esper.net:6667/fabric",
"issues": "https://github.com/FabricMC/fabric/issues",
"sources": "https://github.com/FabricMC/fabric"
},
"authors": [
"FabricMC"
],
"depends": {
"fabricloader": ">=0.8.2",
"fabric-api-base": "*",
"fabric-object-builder-api-v1": "*"
},
"description": "Legacy builders for objects vanilla has locked down, superseded by fabric-object-builder-api-v1.",
"mixins": [
"fabric-object-builders-v0.mixins.json"
],
"custom": {
"fabric-api:module-lifecycle": "deprecated"
}
}

View file

@ -64,7 +64,7 @@ public final class FabricRegistryBuilder<T, R extends MutableRegistry<T>> {
* @return An instance of FabricRegistryBuilder
*/
public static <T> FabricRegistryBuilder<T, SimpleRegistry<T>> createSimple(Class<T> type, Identifier registryId) {
return from(new SimpleRegistry<T>(RegistryKey.ofRegistry(registryId), Lifecycle.stable()));
return from(new SimpleRegistry<T>(RegistryKey.ofRegistry(registryId), Lifecycle.stable(), null));
}
/**
@ -76,7 +76,7 @@ public final class FabricRegistryBuilder<T, R extends MutableRegistry<T>> {
* @return An instance of FabricRegistryBuilder
*/
public static <T> FabricRegistryBuilder<T, DefaultedRegistry<T>> createDefaulted(Class<T> type, Identifier registryId, Identifier defaultId) {
return from(new DefaultedRegistry<T>(defaultId.toString(), RegistryKey.ofRegistry(registryId), Lifecycle.stable()));
return from(new DefaultedRegistry<T>(defaultId.toString(), RegistryKey.ofRegistry(registryId), Lifecycle.stable(), null));
}
private final R registry;

View file

@ -41,7 +41,7 @@ public class DynamicRegistrySync {
* should be the <em>built-in</em> manager. It is never destroyed. We don't ever have to unregister
* the registry events.
*/
public static void setupSync(DynamicRegistryManager.Impl template) {
public static void setupSync(DynamicRegistryManager template) {
LOGGER.debug("Setting up synchronisation of new BuiltinRegistries entries to the built-in DynamicRegistryManager");
BuiltinRegistries.REGISTRIES.stream().forEach(source -> setupSync(source, template));
}
@ -50,7 +50,7 @@ public class DynamicRegistrySync {
* Sets up an event registration for the source registy that will ensure all entries added from now on
* are also added to the template for dynamic registry managers.
*/
private static <T> void setupSync(Registry<T> source, DynamicRegistryManager.Impl template) {
private static <T> void setupSync(Registry<T> source, DynamicRegistryManager template) {
@SuppressWarnings("unchecked") AccessorRegistry<T> sourceAccessor = (AccessorRegistry<T>) source;
RegistryKey<? extends Registry<T>> sourceKey = source.getKey();
MutableRegistry<T> target = (MutableRegistry<T>) template.get(sourceKey);

View file

@ -19,6 +19,7 @@ package net.fabricmc.fabric.mixin.registry.sync;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.Bootstrap;
@ -60,4 +61,9 @@ public class MixinBootstrap {
RegistrySyncManager.bootstrapRegistries();
}
@Redirect(method = "initialize", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/registry/Registry;method_40292()V"))
private static void skipFreeze() {
// Don't freeze
}
}

View file

@ -17,29 +17,29 @@
package net.fabricmc.fabric.mixin.registry.sync;
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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.fabricmc.fabric.api.event.registry.DynamicRegistrySetupCallback;
import net.fabricmc.fabric.impl.registry.sync.DynamicRegistrySync;
@Mixin(DynamicRegistryManager.class)
public class MixinDynamicRegistryManager {
// This is the "template" for all subsequent built-in dynamic registry managers,
// but it still contains the same objects as BuiltinRegistries, while the subsequent
// managers built from this template will contain copies.
@Shadow
private static DynamicRegistryManager.Impl BUILTIN;
public interface MixinDynamicRegistryManager {
@Inject(method = "method_40314", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/dynamic/EntryLoader$Impl;<init>()V"), locals = LocalCapture.CAPTURE_FAILHARD)
private static void onCreateImpl(CallbackInfoReturnable<DynamicRegistryManager.class_6893> cir, DynamicRegistryManager.class_6893 registryManager) {
DynamicRegistrySetupCallback.EVENT.invoker().onRegistrySetup(registryManager);
}
/**
* Ensures that any registrations made into {@link net.minecraft.util.registry.BuiltinRegistries} after
* {@link DynamicRegistryManager} has been class-loaded are still propagated.
*/
@Inject(method = "<clinit>", at = @At(value = "TAIL"))
private static void setupBuiltInSync(CallbackInfo ci) {
DynamicRegistrySync.setupSync(BUILTIN);
@Inject(method = "method_40327()Lnet/minecraft/util/registry/DynamicRegistryManager$class_6890;", at = @At(value = "RETURN"))
private static void setupBuiltInSync(CallbackInfoReturnable<DynamicRegistryManager.class_6890> cir) {
DynamicRegistrySync.setupSync(cir.getReturnValue());
}
}

View file

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
@ -31,8 +32,9 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectList;
import org.slf4j.LoggerFactory;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -41,6 +43,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
@ -60,18 +63,25 @@ import net.fabricmc.fabric.impl.registry.sync.RemappableRegistry;
public abstract class MixinIdRegistry<T> extends Registry<T> implements RemappableRegistry, ListenableRegistry<T> {
@Shadow
@Final
private ObjectList<T> rawIdToEntry;
private ObjectList<RegistryEntry.Reference<T>> rawIdToEntry;
@Shadow
@Final
private Object2IntMap<T> entryToRawId;
@Shadow
@Final
private BiMap<Identifier, T> idToEntry;
private Map<Identifier, RegistryEntry.Reference<T>> idToEntry;
@Shadow
@Final
private BiMap<RegistryKey<T>, T> keyToEntry;
private Map<RegistryKey<T>, RegistryEntry.Reference<T>> keyToEntry;
@Shadow
private int nextId;
@Shadow
public abstract Optional<RegistryKey<T>> getKey(T entry);
@Shadow
public abstract @Nullable T get(@Nullable Identifier id);
@Unique
private static Logger FABRIC_LOGGER = LoggerFactory.getLogger(MixinIdRegistry.class);
@ -109,7 +119,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
@Unique
private Object2IntMap<Identifier> fabric_prevIndexedEntries;
@Unique
private BiMap<Identifier, T> fabric_prevEntries;
private BiMap<Identifier, RegistryEntry.Reference<T>> fabric_prevEntries;
@Override
public Event<RegistryEntryAddedCallback<T>> fabric_getAddObjectEvent() {
@ -130,7 +140,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
@Unique
private boolean fabric_isObjectNew = false;
@Inject(method = "set(ILnet/minecraft/util/registry/RegistryKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Ljava/lang/Object;", at = @At("HEAD"))
@Inject(method = "set(ILnet/minecraft/util/registry/RegistryKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Lnet/minecraft/util/registry/RegistryEntry;", at = @At("HEAD"))
public void setPre(int id, RegistryKey<T> registryId, T object, Lifecycle lifecycle, boolean checkDuplicateKeys, CallbackInfoReturnable<T> info) {
int indexedEntriesId = entryToRawId.getInt(object);
@ -141,7 +151,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
if (!idToEntry.containsKey(registryId.getValue())) {
fabric_isObjectNew = true;
} else {
T oldObject = idToEntry.get(registryId.getValue());
RegistryEntry.Reference<T> oldObject = idToEntry.get(registryId.getValue());
if (oldObject != null && oldObject != object) {
int oldId = entryToRawId.getInt(oldObject);
@ -150,7 +160,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
throw new RuntimeException("Attempted to register ID " + registryId + " at different raw IDs (" + oldId + ", " + id + ")! If you're trying to override an item, use .set(), not .register()!");
}
fabric_removeObjectEvent.invoker().onEntryRemoved(oldId, registryId.getValue(), oldObject);
fabric_removeObjectEvent.invoker().onEntryRemoved(oldId, registryId.getValue(), oldObject.value());
fabric_isObjectNew = true;
} else {
fabric_isObjectNew = false;
@ -158,7 +168,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
}
}
@Inject(method = "set(ILnet/minecraft/util/registry/RegistryKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Ljava/lang/Object;", at = @At("RETURN"))
@Inject(method = "set(ILnet/minecraft/util/registry/RegistryKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;Z)Lnet/minecraft/util/registry/RegistryEntry;", at = @At("RETURN"))
public void setPost(int id, RegistryKey<T> registryId, T object, Lifecycle lifecycle, boolean checkDuplicateKeys, CallbackInfoReturnable<T> info) {
if (fabric_isObjectNew) {
fabric_addObjectEvent.invoker().onEntryAdded(id, registryId.getValue(), object);
@ -300,9 +310,9 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
Int2IntMap idMap = new Int2IntOpenHashMap();
for (T o : rawIdToEntry) {
Identifier id = getId(o);
int rid = getRawId(o);
for (RegistryEntry.Reference<T> o : rawIdToEntry) {
Identifier id = getId(o.value());
int rid = getRawId(o.value());
// see above note
if (remoteIndexedEntries.containsKey(id)) {
@ -320,7 +330,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
for (Identifier identifier : orderedRemoteEntries) {
int id = remoteIndexedEntries.getInt(identifier);
T object = idToEntry.get(identifier);
RegistryEntry.Reference<T> object = idToEntry.get(identifier);
// Warn if an object is missing from the local registry.
// This should only happen in AUTHORITATIVE mode, and as such we
@ -338,7 +348,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
// Add the new object, increment nextId to match.
rawIdToEntry.size(Math.max(this.rawIdToEntry.size(), id + 1));
rawIdToEntry.set(id, object);
entryToRawId.put(object, id);
entryToRawId.put(object.value(), id);
if (nextId <= id) {
nextId = id + 1;
@ -366,7 +376,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
idToEntry.putAll(fabric_prevEntries);
for (Map.Entry<Identifier, T> entry : fabric_prevEntries.entrySet()) {
for (Map.Entry<Identifier, RegistryEntry.Reference<T>> entry : fabric_prevEntries.entrySet()) {
RegistryKey<T> entryKey = RegistryKey.of(getKey(), entry.getKey());
keyToEntry.put(entryKey, entry.getValue());
}
@ -374,7 +384,7 @@ public abstract class MixinIdRegistry<T> extends Registry<T> implements Remappab
remap(name, fabric_prevIndexedEntries, RemapMode.AUTHORITATIVE);
for (Identifier id : addedIds) {
fabric_getAddObjectEvent().invoker().onEntryAdded(entryToRawId.getInt(idToEntry.get(id)), id, idToEntry.get(id));
fabric_getAddObjectEvent().invoker().onEntryAdded(entryToRawId.getInt(idToEntry.get(id)), id, get(id));
}
fabric_prevIndexedEntries = null;

View file

@ -16,20 +16,31 @@
package net.fabricmc.fabric.mixin.registry.sync;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.util.registry.DynamicRegistryManager;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.api.event.registry.DynamicRegistrySetupCallback;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
@Mixin(DynamicRegistryManager.class)
public class DynamicRegistryManagerMixin {
@Inject(method = "create", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/dynamic/EntryLoader$Impl;<init>()V"), locals = LocalCapture.CAPTURE_FAILHARD)
private static void onCreateImpl(CallbackInfoReturnable<DynamicRegistryManager.Impl> cir, DynamicRegistryManager.Impl registryManager) {
DynamicRegistrySetupCallback.EVENT.invoker().onRegistrySetup(registryManager);
@Mixin(MinecraftServer.class)
public class MixinMinecraftServer {
@Unique
private static Logger FABRIC_LOGGER = LoggerFactory.getLogger(MixinMinecraftServer.class);
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;setupServer()Z"), method = "runServer")
private void beforeSetupServer(CallbackInfo info) {
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER) {
// Freeze the registries on the server
FABRIC_LOGGER.debug("Freezing registries");
Registry.method_40292();
}
}
}

View file

@ -16,8 +16,8 @@
package net.fabricmc.fabric.mixin.registry.sync.client;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@ -26,6 +26,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager;
import net.fabricmc.fabric.impl.registry.sync.RemapException;
@ -44,4 +45,11 @@ public class MixinMinecraftClient {
FABRIC_LOGGER.warn("Failed to unmap Fabric registries!", e);
}
}
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;thread:Ljava/lang/Thread;", shift = At.Shift.AFTER, ordinal = 0), method = "run")
private void onStart(CallbackInfo ci) {
// Freeze the registries on the client
FABRIC_LOGGER.debug("Freezing registries");
Registry.method_40292();
}
}

View file

@ -11,8 +11,8 @@
"MixinIdRegistry",
"MixinLevelStorageSession",
"MixinRegistry",
"MixinSimpleRegistry",
"DynamicRegistryManagerMixin"
"MixinMinecraftServer",
"MixinSimpleRegistry"
],
"client": [
"client.MixinBlockColorMap",

View file

@ -16,7 +16,7 @@
"FabricMC"
],
"depends": {
"fabricloader": ">=0.9.2",
"fabricloader": ">=0.13.2",
"fabric-api-base": "*",
"fabric-networking-api-v1": "*"
},

View file

@ -136,19 +136,19 @@ public class RegistrySyncTest implements ModInitializer {
System.out.println("Checking built-in registry sync...");
// Register a configured feature before force-loading the dynamic registry manager
ConfiguredFeature<DefaultFeatureConfig, ?> cf1 = Feature.BASALT_PILLAR.configure(DefaultFeatureConfig.INSTANCE);
ConfiguredFeature<DefaultFeatureConfig, ?> cf1 = new ConfiguredFeature<>(Feature.BASALT_PILLAR, DefaultFeatureConfig.INSTANCE);
Identifier f1Id = new Identifier("registry_sync", "f1");
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, f1Id, cf1);
// Force-Initialize the dynamic registry manager, doing this in a Mod initializer would cause
// further registrations into BuiltInRegistries to _NOT_ propagate into DynamicRegistryManager.BUILTIN
checkFeature(DynamicRegistryManager.create(), f1Id);
checkFeature(DynamicRegistryManager.method_40314(), f1Id);
ConfiguredFeature<DefaultFeatureConfig, ?> cf2 = Feature.DESERT_WELL.configure(DefaultFeatureConfig.INSTANCE);
ConfiguredFeature<DefaultFeatureConfig, ?> cf2 = new ConfiguredFeature<>(Feature.DESERT_WELL, DefaultFeatureConfig.INSTANCE);
Identifier f2Id = new Identifier("registry_sync", "f2");
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, f2Id, cf2);
DynamicRegistryManager.Impl impl2 = DynamicRegistryManager.create();
DynamicRegistryManager impl2 = DynamicRegistryManager.method_40314();
checkFeature(impl2, f1Id);
checkFeature(impl2, f2Id);
}
@ -172,7 +172,7 @@ public class RegistrySyncTest implements ModInitializer {
throw new IllegalStateException("Expected that the built-in entry and dynamic entry don't have object identity because the dynamic entry is created by serializing the built-in entry to JSON and back.");
}
if (builtInEntry.feature != entry.feature) {
if (builtInEntry.feature() != entry.feature()) {
throw new IllegalStateException("Expected both entries to reference the same feature since it's only in Registry and is never copied");
}
}

View file

@ -12,6 +12,4 @@ dependencies {
testmodImplementation project(path: ':fabric-renderer-indigo', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-rendering-data-attachment-v1', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-resource-loader-v0', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-tag-extensions-v0', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-tool-attribute-api-v1', configuration: 'namedElements')
}

View file

@ -20,9 +20,9 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import net.minecraft.block.Block;
import net.minecraft.tag.TagKey;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
import net.minecraft.tag.Tag;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry;
@ -90,21 +90,21 @@ public final class DefaultResourceConditions {
/**
* Create a condition that returns true if each of the passed block tags exists and has at least one element.
*/
public static ConditionJsonProvider blockTagsPopulated(Tag.Identified<Block>... tags) {
public static ConditionJsonProvider blockTagsPopulated(TagKey<Block>... tags) {
return ResourceConditionsImpl.tagsPopulated(BLOCK_TAGS_POPULATED, tags);
}
/**
* Create a condition that returns true if each of the passed fluid tags exists and has at least one element.
*/
public static ConditionJsonProvider fluidTagsPopulated(Tag.Identified<Fluid>... tags) {
public static ConditionJsonProvider fluidTagsPopulated(TagKey<Fluid>... tags) {
return ResourceConditionsImpl.tagsPopulated(FLUID_TAGS_POPULATED, tags);
}
/**
* Create a condition that returns true if each of the passed item tags exists and has at least one element.
*/
public static ConditionJsonProvider itemTagsPopulated(Tag.Identified<Item>... tags) {
public static ConditionJsonProvider itemTagsPopulated(TagKey<Item>... tags) {
return ResourceConditionsImpl.tagsPopulated(ITEM_TAGS_POPULATED, tags);
}

View file

@ -21,12 +21,11 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.jetbrains.annotations.ApiStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.minecraft.tag.ServerTagManagerHolder;
import net.minecraft.tag.Tag;
import net.minecraft.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.registry.Registry;
@ -85,7 +84,7 @@ public class ResourceConditionsImpl {
};
}
public static <T> ConditionJsonProvider tagsPopulated(Identifier id, Tag.Identified<T>... tags) {
public static <T> ConditionJsonProvider tagsPopulated(Identifier id, TagKey<T>... tags) {
Preconditions.checkArgument(tags.length > 0, "Must register at least one tag.");
return new ConditionJsonProvider() {
@ -98,8 +97,8 @@ public class ResourceConditionsImpl {
public void writeParameters(JsonObject object) {
JsonArray array = new JsonArray();
for (Tag.Identified<T> tag : tags) {
array.add(tag.getId().toString());
for (TagKey<T> tag : tags) {
array.add(tag.id().toString());
}
object.add("values", array);
@ -131,9 +130,11 @@ public class ResourceConditionsImpl {
for (JsonElement element : array) {
if (element.isJsonPrimitive()) {
Identifier id = new Identifier(element.getAsString());
Tag<T> tag = ServerTagManagerHolder.getTagManager().getOrCreateTagGroup(registryKey).getTagOrEmpty(id);
// TODO 22w06a check me later
TagKey<T> tag = TagKey.intern(registryKey, id);
Registry<T> registry = (Registry<T>) Registry.REGISTRIES.get(registryKey.getValue());
if (tag.values().isEmpty()) {
if (!registry.containsTag(tag)) {
return false;
}
} else {

View file

@ -14,8 +14,10 @@
* limitations under the License.
*/
package net.fabricmc.fabric.impl.tag.extension;
package net.fabricmc.fabric.impl.resource.loader;
public interface FabricTagHooks {
void fabric_setExtraData(int clearCount);
import net.minecraft.resource.ResourceType;
public interface FabricLifecycledResourceManager {
ResourceType fabric_getResourceType();
}

View file

@ -18,6 +18,8 @@ package net.fabricmc.fabric.impl.resource.loader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -113,12 +115,20 @@ public class ResourceManagerHelperImpl implements ResourceManagerHelper {
}
}
public static void sort(ResourceType type, List<ResourceReloader> listeners) {
public static List<ResourceReloader> sort(ResourceType type, List<ResourceReloader> listeners) {
if (type == null) {
return listeners;
}
ResourceManagerHelperImpl instance = get(type);
if (instance != null) {
instance.sort(listeners);
List<ResourceReloader> mutable = new ArrayList<>(listeners);
instance.sort(mutable);
return Collections.unmodifiableList(mutable);
}
return listeners;
}
protected void sort(List<ResourceReloader> listeners) {

View file

@ -14,23 +14,34 @@
* limitations under the License.
*/
package net.fabricmc.fabric.mixin.object.builder;
package net.fabricmc.fabric.mixin.resource.loader;
import java.util.List;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
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.block.Block;
import net.minecraft.block.AbstractBlock;
import net.minecraft.class_6861;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceType;
import net.fabricmc.fabric.api.event.registry.BlockConstructedCallback;
import net.fabricmc.fabric.impl.resource.loader.FabricLifecycledResourceManager;
@Mixin(Block.class)
@Deprecated
public class OldMixinBlock {
@Inject(method = "<init>(Lnet/minecraft/block/AbstractBlock$Settings;)V", at = @At("RETURN"))
public void init(AbstractBlock.Settings builder, CallbackInfo info) {
BlockConstructedCallback.EVENT.invoker().building(builder, (Block) (Object) this);
@Mixin(class_6861.class)
public class LifecycledResourceManagerImplMixin implements FabricLifecycledResourceManager {
@Unique
private ResourceType fabric_ResourceType;
@Inject(method = "<init>", at = @At("TAIL"))
private void init(ResourceType resourceType, List<ResourcePack> list, CallbackInfo ci) {
this.fabric_ResourceType = resourceType;
}
@Override
public ResourceType fabric_getResourceType() {
return fabric_ResourceType;
}
}

View file

@ -17,42 +17,20 @@
package net.fabricmc.fabric.mixin.resource.loader;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.stream.Collectors;
import org.spongepowered.asm.mixin.Final;
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.CallbackInfoReturnable;
import net.minecraft.resource.ReloadableResourceManagerImpl;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceReloader;
import net.minecraft.resource.ResourceType;
import net.minecraft.resource.ResourceReload;
import net.minecraft.util.Unit;
import net.fabricmc.fabric.impl.resource.loader.GroupResourcePack;
import net.fabricmc.fabric.impl.resource.loader.ResourceManagerHelperImpl;
@Mixin(ReloadableResourceManagerImpl.class)
public class ReloadableResourceManagerImplMixin {
@Final
@Shadow
private ResourceType type;
@Shadow
@Final
private List<ResourceReloader> reloaders;
@Inject(at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;isDebugEnabled()Z", remap = false), method = "reload")
private void reload(Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage, List<ResourcePack> packs, CallbackInfoReturnable<ResourceReload> info) {
ResourceManagerHelperImpl.sort(type, this.reloaders);
}
// private static synthetic method_29491(Ljava/util/List;)Ljava/lang/Object;
// Supplier lambda in beginMonitoredReload method.
@Inject(method = "method_29491", at = @At("HEAD"), cancellable = true)

View file

@ -0,0 +1,67 @@
/*
* 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.mixin.resource.loader;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.resource.ProfiledResourceReload;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceReload;
import net.minecraft.resource.ResourceReloader;
import net.minecraft.resource.ResourceType;
import net.minecraft.resource.SimpleResourceReload;
import net.minecraft.util.Unit;
import net.fabricmc.fabric.impl.resource.loader.FabricLifecycledResourceManager;
import net.fabricmc.fabric.impl.resource.loader.ResourceManagerHelperImpl;
@Mixin(SimpleResourceReload.class)
public class SimpleResourceReloadMixin {
@Unique
private static final ThreadLocal<ResourceType> fabric_resourceType = new ThreadLocal<>();
@Inject(method = "method_40087", at = @At("HEAD"))
private static void method_40087(ResourceManager resourceManager, List<ResourceReloader> list, Executor executor, Executor executor2, CompletableFuture<Unit> completableFuture, boolean bl, CallbackInfoReturnable<ResourceReload> cir) {
if (resourceManager instanceof FabricLifecycledResourceManager flrm) {
fabric_resourceType.set(flrm.fabric_getResourceType());
}
}
@ModifyArg(method = "method_40087", index = 1, at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/SimpleResourceReload;create(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/resource/SimpleResourceReload;"))
private static List<ResourceReloader> sortSimple(List<ResourceReloader> reloaders) {
List<ResourceReloader> sorted = ResourceManagerHelperImpl.sort(fabric_resourceType.get(), reloaders);
fabric_resourceType.set(null);
return sorted;
}
@Redirect(method = "method_40087", at = @At(value = "NEW", target = "Lnet/minecraft/resource/ProfiledResourceReload;<init>"))
private static ProfiledResourceReload sortProfiled(ResourceManager manager, List<ResourceReloader> reloaders, Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage) {
List<ResourceReloader> sorted = ResourceManagerHelperImpl.sort(fabric_resourceType.get(), reloaders);
fabric_resourceType.set(null);
return new ProfiledResourceReload(manager, sorted, prepareExecutor, applyExecutor, initialStage);
}
}

View file

@ -6,13 +6,15 @@
"FileResourcePackProviderAccessor",
"DefaultResourcePackMixin",
"KeyedResourceReloadListenerMixin",
"LifecycledResourceManagerImplMixin",
"MinecraftServerMixin",
"NamespaceResourceManagerAccessor",
"NamespaceResourceManagerMixin",
"ReloadableResourceManagerImplMixin",
"ResourcePackManagerMixin",
"ResourcePackManagerAccessor",
"ResourcePackProfileAccessor"
"ResourcePackProfileAccessor",
"SimpleResourceReloadMixin"
],
"client": [
"client.ClientBuiltinResourcePackProviderMixin",

View file

@ -67,7 +67,7 @@ abstract class MinecraftClientMixin {
// The LevelLoadingScreen is the odd screen that isn't ticked by the main tick loop, so we fire events for this screen.
// We Coerce the package-private inner class representing the world load action so we don't need an access widener.
@Inject(method = "startIntegratedServer(Ljava/lang/String;Lnet/minecraft/util/registry/DynamicRegistryManager$Impl;Ljava/util/function/Function;Lcom/mojang/datafixers/util/Function4;ZLnet/minecraft/client/MinecraftClient$WorldLoadAction;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/LevelLoadingScreen;tick()V"))
@Inject(method = "startIntegratedServer(Ljava/lang/String;Ljava/util/function/Function;Ljava/util/function/Function;ZLnet/minecraft/client/MinecraftClient$WorldLoadAction;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/LevelLoadingScreen;tick()V"))
private void beforeLoadingScreenTick(CallbackInfo ci) {
// Store the screen in a variable in case someone tries to change the screen during this before tick event.
// If someone changes the screen, the after tick event will likely have class cast exceptions or throw a NPE.
@ -75,7 +75,7 @@ abstract class MinecraftClientMixin {
ScreenEvents.beforeTick(this.tickingScreen).invoker().beforeTick(this.tickingScreen);
}
@Inject(method = "startIntegratedServer(Ljava/lang/String;Lnet/minecraft/util/registry/DynamicRegistryManager$Impl;Ljava/util/function/Function;Lcom/mojang/datafixers/util/Function4;ZLnet/minecraft/client/MinecraftClient$WorldLoadAction;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;render(Z)V"))
@Inject(method = "startIntegratedServer(Ljava/lang/String;Ljava/util/function/Function;Ljava/util/function/Function;ZLnet/minecraft/client/MinecraftClient$WorldLoadAction;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;render(Z)V"))
private void afterLoadingScreenTick(CallbackInfo ci) {
ScreenEvents.afterTick(this.tickingScreen).invoker().afterTick(this.tickingScreen);
// Finally set the currently ticking screen to null

View file

@ -18,8 +18,7 @@ package net.fabricmc.fabric.test.screen;
import java.util.Random;
import org.jetbrains.annotations.Nullable;
import net.minecraft.util.registry.RegistryEntry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.widget.PressableWidget;
@ -28,7 +27,6 @@ import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.SimpleRegistry;
class SoundButton extends PressableWidget {
private static final Random RANDOM = new Random();
@ -39,11 +37,8 @@ class SoundButton extends PressableWidget {
@Override
public void onPress() {
// Upcast on registry is fine
@Nullable
final SoundEvent event = ((SimpleRegistry<SoundEvent>) Registry.SOUND_EVENT).getRandom(RANDOM);
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(event != null ? event : SoundEvents.ENTITY_GENERIC_EXPLODE, 1.0F, 1.0F));
final SoundEvent event = Registry.SOUND_EVENT.getRandom(RANDOM).map(RegistryEntry::value).orElse(SoundEvents.ENTITY_GENERIC_EXPLODE);
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(event, 1.0F, 1.0F));
}
@Override

View file

@ -20,10 +20,12 @@ import java.util.Objects;
import com.google.common.collect.ImmutableList;
import net.minecraft.world.gen.chunk.placement.RandomSpreadStructurePlacement;
import net.minecraft.world.gen.chunk.placement.SpreadType;
import net.minecraft.world.gen.chunk.placement.StructurePlacement;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.chunk.StructureConfig;
import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.chunk.placement.StructuresConfig;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.StructureFeature;
@ -52,7 +54,7 @@ public final class FabricStructureBuilder<FC extends FeatureConfig, S extends St
private final Identifier id;
private final S structure;
private GenerationStep.Feature step;
private StructureConfig defaultConfig;
private StructurePlacement defaultConfig;
private boolean generateInSuperflat = false;
private boolean adjustsSurface = false;
@ -90,19 +92,19 @@ public final class FabricStructureBuilder<FC extends FeatureConfig, S extends St
}
/**
* Sets the default {@linkplain StructureConfig} for this structure. See the alternative
* Sets the default {@linkplain StructurePlacement} for this structure. See the alternative
* {@linkplain #defaultConfig(int, int, int)} for details.
*
* <p>This is a required option.</p>
*/
public FabricStructureBuilder<FC, S> defaultConfig(StructureConfig config) {
public FabricStructureBuilder<FC, S> defaultConfig(StructurePlacement config) {
Objects.requireNonNull(config, "config must not be null");
this.defaultConfig = config;
return this;
}
/**
* Sets the default {@linkplain StructureConfig} for this structure. This sets the default configuration of where in
* Sets the default {@linkplain StructurePlacement} for this structure. This sets the default configuration of where in
* the world to place structures.
*
* <p>Note: the {@code spacing} and {@code separation} options are subject to other checks for whether the structure
@ -115,10 +117,10 @@ public final class FabricStructureBuilder<FC extends FeatureConfig, S extends St
* @param separation The minimum distance between 2 structures of this type.
* @param salt The random salt of the structure. This does not affect how common the structure is, but every
* structure must have an unique {@code salt} in order to spawn in different places.
* @see #defaultConfig(StructureConfig)
* @see #defaultConfig(StructurePlacement)
*/
public FabricStructureBuilder<FC, S> defaultConfig(int spacing, int separation, int salt) {
return defaultConfig(new StructureConfig(spacing, separation, salt));
return defaultConfig(new RandomSpreadStructurePlacement(spacing, separation, SpreadType.LINEAR, salt));
}
/**
@ -147,7 +149,7 @@ public final class FabricStructureBuilder<FC extends FeatureConfig, S extends St
Objects.requireNonNull(defaultConfig, "Structure \"" + id + "\" is missing a default config");
// Ensure StructuresConfig class is initialized, so the assertion in its static {} block doesn't fail
StructuresConfig.DEFAULT_STRUCTURES.size();
StructuresConfig.DEFAULT_PLACEMENTS.size();
StructureFeatureAccessor.callRegister(id.toString(), structure, step);

View file

@ -21,7 +21,7 @@ import java.util.Map;
import com.google.common.collect.ImmutableMap;
import net.minecraft.world.gen.chunk.StructureConfig;
import net.minecraft.world.gen.chunk.placement.StructurePlacement;
import net.minecraft.world.gen.feature.StructureFeature;
import net.fabricmc.api.ModInitializer;
@ -30,22 +30,22 @@ import net.fabricmc.fabric.mixin.structure.StructuresConfigAccessor;
public class FabricStructureImpl implements ModInitializer {
//Keeps a map of structures to structure configs for purposes of initializing the flat chunk generator
public static final Map<StructureFeature<?>, StructureConfig> FLAT_STRUCTURE_TO_CONFIG_MAP = new HashMap<>();
public static final Map<StructureFeature<?>, StructurePlacement> FLAT_STRUCTURE_TO_CONFIG_MAP = new HashMap<>();
//Keeps a map of structures to structure configs.
public static final Map<StructureFeature<?>, StructureConfig> STRUCTURE_TO_CONFIG_MAP = new HashMap<>();
public static final Map<StructureFeature<?>, StructurePlacement> STRUCTURE_TO_CONFIG_MAP = new HashMap<>();
@Override
public void onInitialize() {
ServerWorldEvents.LOAD.register((server, world) -> {
// Need temp map as some mods use custom chunk generators with immutable maps in themselves.
Map<StructureFeature<?>, StructureConfig> tempMap = new HashMap<>(world.getChunkManager().getChunkGenerator().getStructuresConfig().getStructures());
Map<StructureFeature<?>, StructurePlacement> tempMap = new HashMap<>(world.getChunkManager().getChunkGenerator().getStructuresConfig().getStructures());
tempMap.putAll(STRUCTURE_TO_CONFIG_MAP);
//Make it immutable again
ImmutableMap<StructureFeature<?>, StructureConfig> immutableMap = ImmutableMap.copyOf(tempMap);
((StructuresConfigAccessor) world.getChunkManager().getChunkGenerator().getStructuresConfig()).setStructures(immutableMap);
ImmutableMap<StructureFeature<?>, StructurePlacement> immutableMap = ImmutableMap.copyOf(tempMap);
((StructuresConfigAccessor) world.getChunkManager().getChunkGenerator().getStructuresConfig()).setPlacements(immutableMap);
});
}
}

View file

@ -62,7 +62,7 @@ abstract class ChunkSerializerMixin {
if (ChunkSerializerMixin.CHUNK_NEEDS_SAVING.get()) {
ChunkSerializerMixin.CHUNK_NEEDS_SAVING.set(false);
// Make the chunk save as soon as possible
chunk.setShouldSave(true);
chunk.setNeedsSaving(true);
}
// Replicate vanilla logic

Some files were not shown because too many files have changed in this diff Show more