mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 04:09:51 +00:00
First pass of registry rewrite.
Tests do not run yet. Things of note: Removed the idea of substitutions, just register multiple items with the same name they will override each other like a normal map. Decoupled Forge registries from vanilla classes. They now use bouncer classes. MODDERS SHOULD NEVER USE THESE Introduced more stringent registry locking. As it sits things are only allowed to be registered during the RegistryEvent.Registry phases! This is to force modders to split up their registrations, and pave the way for calling these functions multiple times during a single MC lifecycle. ObjectHolder, Missing Mappings, etc... *should* now work for all registry types, nothing should be special cased to Blocks/Items anymore. Added optional generic dummy factory to registries, to allow registry creators the ability to dummy more then just Blocks. Re-worked the ItemStack transformer and applied it to ItemBlock and ItemBlockSpecial. Allowing us to cleanup reflective hacks in Block callbacks. Registry onAdd callback is now only fired on the ACTIVE registry, fixing any issues of temp registries overriding active objects.
This commit is contained in:
1 parent
423f9fc04b
commit
a26d89c876
110 files changed
+3275
-4110
No files matched your search
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016.
|
||||
*
|
||||
* 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.registries;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
||||
/**
|
||||
* A registry delegate for holding references to items or blocks
|
||||
* These should be safe to use in things like lists though aliased items and blocks will not
|
||||
* have object identity with respect to their delegate.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
* @param <T> the type of thing we're holding onto
|
||||
*/
|
||||
public interface IRegistryDelegate<T> {
|
||||
/**
|
||||
* Get the referent pointed at by this delegate. This will be the currently active item or block, and will change
|
||||
* as world saves come and go. Note that item.delegate.get() may NOT be the same object as item, due to item and
|
||||
* block substitution.
|
||||
*
|
||||
* @return The referred object
|
||||
*/
|
||||
T get();
|
||||
|
||||
/**
|
||||
* Get the unique resource location for this delegate. Completely static after registration has completed, and
|
||||
* will never change.
|
||||
* @return The name
|
||||
*/
|
||||
ResourceLocation name();
|
||||
|
||||
/**
|
||||
* Get the delegate type. It will be dependent on the registry this delegate is sourced from.
|
||||
* @return The type of delegate
|
||||
*/
|
||||
Class<T> type();
|
||||
}
|
||||
Reference in new issue
Block a user