mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 05:02:18 +00:00
Take control over Item.BLOCK_TO_ITEM map and register Block's to this map from GameRegistry.
This commit is contained in:
1 parent
f759f73801
commit
468d35e635
3 files changed
+13
-26
No files matched your search
@@ -1,14 +1,16 @@
|
||||
--- ../src-base/minecraft/net/minecraft/item/Item.java
|
||||
+++ ../src-work/minecraft/net/minecraft/item/Item.java
|
||||
@@ -47,7 +47,7 @@
|
||||
@@ -47,8 +47,8 @@
|
||||
|
||||
public class Item
|
||||
{
|
||||
- public static final RegistryNamespaced field_150901_e = new RegistryNamespaced();
|
||||
- private static final Map field_179220_a = Maps.newHashMap();
|
||||
+ public static final RegistryNamespaced field_150901_e = net.minecraftforge.fml.common.registry.GameData.getItemRegistry();
|
||||
private static final Map field_179220_a = Maps.newHashMap();
|
||||
+ private static final Map field_179220_a = net.minecraftforge.fml.common.registry.GameData.getBlockItemMap();
|
||||
protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
private CreativeTabs field_77701_a;
|
||||
protected static Random field_77697_d = new Random();
|
||||
@@ -61,6 +61,9 @@
|
||||
private String field_77774_bZ;
|
||||
private static final String __OBFID = "CL_00000041";
|
||||
|
||||
@@ -142,23 +142,9 @@ public class GameData {
|
||||
return snap;
|
||||
}
|
||||
|
||||
public static int[] getBlockedIds()
|
||||
{
|
||||
int[] ret = new int[getMain().blockedIds.size()];
|
||||
int index = 0;
|
||||
|
||||
for (int id : getMain().blockedIds)
|
||||
{
|
||||
ret[index] = id;
|
||||
index++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Item findItem(String modId, String name)
|
||||
{
|
||||
return (Item) getMain().iItemRegistry.getObject(modId + ":" + name);
|
||||
return (Item)getMain().iItemRegistry.getObject(modId + ":" + name);
|
||||
}
|
||||
|
||||
static Block findBlock(String modId, String name)
|
||||
@@ -940,4 +926,11 @@ public class GameData {
|
||||
throw new RuntimeException("WHAT?");
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<Block, Item> BLOCK_TO_ITEM = Maps.newHashMap();
|
||||
//Internal: DO NOT USE, will change without warning.
|
||||
public static Map getBlockItemMap()
|
||||
{
|
||||
return BLOCK_TO_ITEM;
|
||||
}
|
||||
}
|
||||
@@ -182,15 +182,6 @@ public class GameRegistry
|
||||
return registerBlock(block, itemclass, name, new Object[]{});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use the registerBlock version without the modId parameter instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name, String modId, Object... itemCtorArgs)
|
||||
{
|
||||
return registerBlock(block, itemclass, name, itemCtorArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a block with the world, with the specified item class, block name and owning modId
|
||||
* @param block The block to register
|
||||
@@ -224,6 +215,7 @@ public class GameRegistry
|
||||
if (i != null)
|
||||
{
|
||||
GameData.getMain().registerItem(i, name);
|
||||
GameData.getBlockItemMap().put(block, i);
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user