Smaller Changes to new API
This commit is contained in:
parent
70b01dc00e
commit
ecb0f6fb99
7 changed files with 44 additions and 20 deletions
|
@ -11,6 +11,7 @@ import org.betterx.worlds.together.util.ModUtil;
|
|||
import org.betterx.worlds.together.world.WorldConfig;
|
||||
import org.betterx.worlds.together.world.WorldGenUtil;
|
||||
import org.betterx.worlds.together.worldPreset.TogetherWorldPreset;
|
||||
import org.betterx.worlds.together.worldPreset.settings.WorldPresetSettings;
|
||||
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import net.minecraft.core.Holder;
|
||||
|
@ -280,4 +281,12 @@ public class LevelGenUtil {
|
|||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Replace by {@link WorldGenUtil#getWorldSettings()}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static WorldPresetSettings getWorldSettings() {
|
||||
return WorldGenUtil.getWorldSettings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import net.minecraft.world.level.levelgen.Heightmap.Types;
|
|||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public abstract class DefaultFeature extends Feature<NoneFeatureConfiguration> {
|
||||
protected static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
protected static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
|
|
@ -69,7 +69,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
|||
}
|
||||
|
||||
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
|
||||
super(makeLeaves(color).lightLevel(light));
|
||||
super(makeLeaves(color).luminance(light));
|
||||
this.sapling = sapling;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public class WoodenComplexMaterial extends ComplexMaterial {
|
|||
@Override
|
||||
protected FabricBlockSettings getBlockSettings() {
|
||||
return FabricBlockSettings.copyOf(Blocks.OAK_PLANKS)
|
||||
.materialColor(planksColor);
|
||||
.mapColor(planksColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.function.Function;
|
|||
/**
|
||||
* Please use the {@link org.betterx.bclib.api.v2.levelgen.structures.BCLStructure} and
|
||||
* {@link BCLStructureBuilder} instead.
|
||||
* @deprecated Use {@link org.betterx.bclib.api.v2.levelgen.structures.BCLStructure} instead
|
||||
*/
|
||||
public class BCLStructure<S extends Structure> extends org.betterx.bclib.api.v2.levelgen.structures.BCLStructure<S> {
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class TagManager {
|
|||
private static final Map<String, TagRegistry<?>> TYPES = Maps.newHashMap();
|
||||
|
||||
public static TagRegistry.RegistryBacked<Block> BLOCKS = registerType(Registry.BLOCK);
|
||||
public static TagRegistry.RegistryBacked<Item> ITEMS = registerType(Registry.ITEM);
|
||||
public static TagRegistry.RegistryBacked<Item> ITEMS = registerItem();
|
||||
public static TagRegistry.Biomes BIOMES = registerBiome();
|
||||
|
||||
public static <T> TagRegistry.RegistryBacked<T> registerType(DefaultedRegistry<T> registry) {
|
||||
|
@ -34,6 +34,11 @@ public class TagManager {
|
|||
return (TagRegistry.RegistryBacked<T>) TYPES.computeIfAbsent(type.directory, (dir) -> type);
|
||||
}
|
||||
|
||||
public static TagRegistry.Items registerItem() {
|
||||
TagRegistry.Items type = new TagRegistry.Items();
|
||||
return (TagRegistry.Items) TYPES.computeIfAbsent(type.directory, (dir) -> type);
|
||||
}
|
||||
|
||||
public static <T> TagRegistry.Simple<T> registerType(Registry<T> registry, String directory) {
|
||||
return registerType(registry.key(), directory, (o) -> registry.getKey(o));
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import net.minecraft.tags.TagEntry;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.tags.TagLoader;
|
||||
import net.minecraft.tags.TagManager;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -23,7 +25,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
public class TagRegistry<T> {
|
||||
boolean isFrozen = false;
|
||||
|
@ -66,29 +67,19 @@ public class TagRegistry<T> {
|
|||
super(registry, directory, locationProvider);
|
||||
}
|
||||
|
||||
public void add(TagKey<T> tagID, T... elements) {
|
||||
@SafeVarargs
|
||||
public final void add(TagKey<T> tagID, T... elements) {
|
||||
super.add(tagID, elements);
|
||||
}
|
||||
|
||||
public void add(T element, TagKey<T>... tagIDs) {
|
||||
super.add(element, tagIDs);
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public void add(ResourceLocation tagID, T... elements) {
|
||||
super.add(tagID, elements);
|
||||
}
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public void add(T element, ResourceLocation... tagIDs) {
|
||||
@SafeVarargs
|
||||
public final void add(T element, TagKey<T>... tagIDs) {
|
||||
super.add(element, tagIDs);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Biomes extends Simple<Biome> {
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Biomes(String directory, Function<Biome, ResourceLocation> locationProvider) {
|
||||
Biomes(String directory, Function<Biome, ResourceLocation> locationProvider) {
|
||||
super(Registry.BIOME_REGISTRY, directory, locationProvider);
|
||||
}
|
||||
|
||||
|
@ -102,6 +93,25 @@ public class TagRegistry<T> {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Items extends RegistryBacked<Item> {
|
||||
|
||||
Items() {
|
||||
super(Registry.ITEM);
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final void add(TagKey<Item> tagID, ItemLike... elements) {
|
||||
for (ItemLike element : elements) {
|
||||
add(tagID, element.asItem());
|
||||
}
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final void add(ItemLike element, TagKey<Item>... tagIDs) {
|
||||
super.add(element.asItem(), tagIDs);
|
||||
}
|
||||
}
|
||||
|
||||
public static class UnTyped<T> extends TagRegistry<T> {
|
||||
UnTyped(
|
||||
ResourceKey<? extends Registry<T>> registry,
|
||||
|
|
Loading…
Reference in a new issue