Drop 1.18/1.18.1 Support, it now compiles

This commit is contained in:
shedaniel
2022-02-10 10:03:56 +08:00
parent d3d5b89d99
commit 6dff58485f
14 changed files with 21 additions and 329 deletions

View File

@@ -19,6 +19,8 @@
package dev.architectury.hooks.level.biome;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.entity.EntityType;
@@ -358,17 +360,17 @@ public final class BiomeHooks {
}
@Override
public List<Supplier<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving) {
public Iterable<Holder<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving) {
return settings.getCarvers(carving);
}
@Override
public List<Supplier<PlacedFeature>> getFeatures(GenerationStep.Decoration decoration) {
public Iterable<Holder<PlacedFeature>> getFeatures(GenerationStep.Decoration decoration) {
return settings.features().get(decoration.ordinal());
}
@Override
public List<List<Supplier<PlacedFeature>>> getFeatures() {
public List<HolderSet<PlacedFeature>> getFeatures() {
return settings.features();
}
}

View File

@@ -19,20 +19,21 @@
package dev.architectury.hooks.level.biome;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import org.jetbrains.annotations.ApiStatus;
import java.util.List;
import java.util.function.Supplier;
public interface GenerationProperties {
List<Supplier<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving);
Iterable<Holder<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving);
List<Supplier<PlacedFeature>> getFeatures(GenerationStep.Decoration decoration);
Iterable<Holder<PlacedFeature>> getFeatures(GenerationStep.Decoration decoration);
List<List<Supplier<PlacedFeature>>> getFeatures();
List<HolderSet<PlacedFeature>> getFeatures();
interface Mutable extends GenerationProperties {
@ApiStatus.Experimental

View File

@@ -1,57 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package dev.architectury.hooks.tags;
import dev.architectury.injectables.annotations.ExpectPlatform;
import dev.architectury.mixin.FluidTagsAccessor;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.*;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.Fluid;
import java.util.function.Supplier;
public final class TagHooks {
private TagHooks() {
}
@ExpectPlatform
public static <T> Tag.Named<T> optional(ResourceLocation id, Supplier<TagCollection<T>> collection) {
throw new AssertionError();
}
public static Tag.Named<Item> optionalItem(ResourceLocation id) {
return optional(id, ItemTags::getAllTags);
}
public static Tag.Named<Block> optionalBlock(ResourceLocation id) {
return optional(id, BlockTags::getAllTags);
}
public static Tag.Named<Fluid> optionalFluid(ResourceLocation id) {
return optional(id, FluidTagsAccessor.getHelper()::getAllTags);
}
public static Tag.Named<EntityType<?>> optionalEntityType(ResourceLocation id) {
return optional(id, EntityTypeTags::getAllTags);
}
}

View File

@@ -1,34 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package dev.architectury.mixin;
import net.minecraft.tags.FluidTags;
import net.minecraft.tags.StaticTagHelper;
import net.minecraft.world.level.material.Fluid;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(FluidTags.class)
public interface FluidTagsAccessor {
@Accessor("HELPER")
static StaticTagHelper<Fluid> getHelper() {
throw new AssertionError();
}
}