Files
MinecraftForge/src/main/java/net/minecraftforge/registries/ObjectHolder.java
T

39 lines
1.2 KiB
Java
Raw Normal View History

2018-09-06 04:39:01 -07:00
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
2018-09-06 04:39:01 -07:00
*/
2018-09-21 02:17:20 -07:00
2018-09-06 04:39:01 -07:00
package net.minecraftforge.registries;
2022-06-07 15:31:26 -05:00
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.fml.common.Mod;
2018-09-06 04:39:01 -07:00
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* ObjectHolder can be used to automatically populate public static final fields with entries
* from the registry. These values can then be referred within mod code directly.
*/
@Retention(RetentionPolicy.RUNTIME)
2022-06-07 15:31:26 -05:00
@Target(ElementType.FIELD)
2018-09-06 04:39:01 -07:00
public @interface ObjectHolder
{
/**
2022-06-07 15:31:26 -05:00
* The name of the registry to load registry entries from.
* This string is parsed as a {@link ResourceLocation} and can contain a namespace.
*
* @return the registry name
*/
String registryName();
/**
* Represents a name in the form of a {@link ResourceLocation} which points to a registry object from the registry given by {@link #registryName()}.
* Must specify the modid if not inside a class annotated with {@link Mod}.
2018-09-06 04:39:01 -07:00
*
2022-06-07 15:31:26 -05:00
* @return a name in the form of a {@link ResourceLocation}
2018-09-06 04:39:01 -07:00
*/
String value();
}