Skip to content

Commit

Permalink
Refactor convention tags (#3310)
Browse files Browse the repository at this point in the history
  • Loading branch information
TelepathicGrunt authored Apr 16, 2024
1 parent 18de49c commit 7f945d5
Show file tree
Hide file tree
Showing 412 changed files with 5,170 additions and 1,590 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Fabric API is organized in different modules. Each module is located in a specif
- Module names should be named after the exposed functionality.
- Consider future developments when naming a module: they might later be expanded.
- Module names should usually be suffixed by `-api`.
- Modules whose primary purpose is not interaction with their API do not need this suffix. For example, `fabric-transitive-access-wideners-v1` or `fabric-convention-tags-v1`.
- Modules whose primary purpose is not interaction with their API do not need this suffix. For example, `fabric-transitive-access-wideners-v1` or `fabric-convention-tags-v2`.
- Event modules should have the `-events` suffix instead.
- Module names should always be suffixed by a major version (`-v1`, `-v2`, etc).
- The major version starts at `v1` for new functionality, unless they replace a module with equivalent functionality, in which case the version is incremented.
Expand Down
6 changes: 6 additions & 0 deletions deprecated/fabric-convention-tags-v1/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version = getSubprojectVersion(project)

moduleDependencies(project, [
'fabric-api-base',
'fabric-convention-tags-v2'
])
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
import net.fabricmc.fabric.impl.tag.convention.TagRegistration;

/**
* See {@link net.minecraft.registry.tag.BiomeTags} for vanilla tags.
* Note that addition to some vanilla tags implies having certain functionality,
* and as such certain biome tags exist to mirror vanilla tags, and should be preferred
* over vanilla unless its behavior is desired.
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalBiomeTags}
*/
@Deprecated
public final class ConventionalBiomeTags {
private ConventionalBiomeTags() {
}
Expand Down Expand Up @@ -136,6 +134,6 @@ private ConventionalBiomeTags() {
public static final TagKey<Biome> SHALLOW_OCEAN = register("shallow_ocean");

private static TagKey<Biome> register(String tagID) {
return TagRegistration.BIOME_TAG_REGISTRATION.registerCommon(tagID);
return TagRegistration.BIOME_TAG_REGISTRATION.registerC(tagID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import net.fabricmc.fabric.impl.tag.convention.TagRegistration;

/**
* See {@link net.minecraft.registry.tag.BlockTags} for vanilla tags.
* Note that addition to some vanilla tags implies having certain functionality.
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags}
*/
@Deprecated
public final class ConventionalBlockTags {
private ConventionalBlockTags() {
}
Expand Down Expand Up @@ -68,6 +68,6 @@ private ConventionalBlockTags() {
public static final TagKey<Block> MOVEMENT_RESTRICTED = register("movement_restricted");

private static TagKey<Block> register(String tagID) {
return TagRegistration.BLOCK_TAG_REGISTRATION.registerCommon(tagID);
return TagRegistration.BLOCK_TAG_REGISTRATION.registerC(tagID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

import net.fabricmc.fabric.impl.tag.convention.TagRegistration;

/**
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalEnchantmentTags}
*/
@Deprecated
public final class ConventionalEnchantmentTags {
private ConventionalEnchantmentTags() {
}
Expand Down Expand Up @@ -49,6 +53,6 @@ private ConventionalEnchantmentTags() {
public static final TagKey<Enchantment> ENTITY_DEFENSE_ENHANCEMENT = register("entity_defense_enhancement");

private static TagKey<Enchantment> register(String tagID) {
return TagRegistration.ENCHANTMENT_TAG_REGISTRATION.registerCommon(tagID);
return TagRegistration.ENCHANTMENT_TAG_REGISTRATION.registerC(tagID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import net.fabricmc.fabric.impl.tag.convention.TagRegistration;

/**
* See {@link net.minecraft.registry.tag.EntityTypeTags} for vanilla tags.
* Note that addition to some vanilla tags implies having certain functionality.
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalEntityTypeTags}
*/
@Deprecated
public final class ConventionalEntityTypeTags {
private ConventionalEntityTypeTags() {
}
Expand All @@ -37,6 +37,6 @@ private ConventionalEntityTypeTags() {
public static final TagKey<EntityType<?>> BOATS = register("boats");

private static TagKey<EntityType<?>> register(String tagID) {
return TagRegistration.ENTITY_TYPE_TAG_REGISTRATION.registerCommon(tagID);
return TagRegistration.ENTITY_TYPE_TAG_REGISTRATION.registerC(tagID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import net.fabricmc.fabric.impl.tag.convention.TagRegistration;

/**
* See {@link net.minecraft.registry.tag.FluidTags} for vanilla tags.
* Note that addition to some vanilla tags implies having certain functionality.
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalFluidTags}
*/
@Deprecated
public final class ConventionalFluidTags {
private ConventionalFluidTags() {
}
Expand All @@ -35,6 +35,6 @@ private ConventionalFluidTags() {
public static final TagKey<Fluid> HONEY = register("honey");

private static TagKey<Fluid> register(String tagID) {
return TagRegistration.FLUID_TAG_REGISTRATION.registerCommon(tagID);
return TagRegistration.FLUID_TAG_REGISTRATION.registerC(tagID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import net.fabricmc.fabric.impl.tag.convention.TagRegistration;

/**
* See {@link net.minecraft.registry.tag.ItemTags} for vanilla tags.
* Note that addition to some vanilla tags implies having certain functionality.
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.ConventionalItemTags}
*/
@Deprecated
public final class ConventionalItemTags {
private ConventionalItemTags() {
}
Expand Down Expand Up @@ -151,6 +151,6 @@ private ConventionalItemTags() {
public static final TagKey<Item> SWORDS = register("swords");

private static TagKey<Item> register(String tagID) {
return TagRegistration.ITEM_TAG_REGISTRATION.registerCommon(tagID);
return TagRegistration.ITEM_TAG_REGISTRATION.registerC(tagID);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* 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.convention.v1;

import org.jetbrains.annotations.Nullable;

import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.tag.TagKey;

/**
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.TagUtil}
*/
@Deprecated
public final class TagUtil {
private TagUtil() {
}

/**
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.TagUtil#isIn}
*/
@Deprecated
public static <T> boolean isIn(TagKey<T> tagKey, T entry) {
return net.fabricmc.fabric.api.tag.convention.v2.TagUtil.isIn(null, tagKey, entry);
}

/**
* @deprecated Please use {@link net.fabricmc.fabric.api.tag.convention.v2.TagUtil#isIn}
*/
@Deprecated
@SuppressWarnings("unchecked")
public static <T> boolean isIn(@Nullable DynamicRegistryManager registryManager, TagKey<T> tagKey, T entry) {
return net.fabricmc.fabric.api.tag.convention.v2.TagUtil.isIn(registryManager, tagKey, entry);
}
}
Loading

0 comments on commit 7f945d5

Please sign in to comment.