Add BiomeDictionary#hasType(String) (#8157)

This commit is contained in:
Alex O'Neill authored and GitHub committed 2021-10-20 12:10:13 -07:00
1 parent e431bb1caa
commit 1dc421e6a4
2 files changed
+32

No files matched your search

@@ -156,6 +156,19 @@ public class BiomeDictionary
return t;
}
/**
* Checks if a type instance exists for a given name. Does not have any side effects if a type does not already exist.
* This can be used for checking if a user-defined type is valid, for example, in a codec which accepts biome dictionary names.
* @param name The name.
* @return {@code true} if a type exists with this name.
*
* @see #getType(String, Type...) #getType for type naming conventions.
*/
public static boolean hasType(String name)
{
return byName.containsKey(name.toUpperCase());
}
/**
* @return An unmodifiable collection of all current biome types.
*/
@@ -1,3 +1,22 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
*
* This library 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 version 2.1
* of the License.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.debug.block;
import net.minecraft.core.BlockPos;