Last active
August 29, 2015 13:56
-
-
Save aksource/8844739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ID指定だけ。被ってたら被らなくなるまで増加方向にずれる。 | |
private void registerItemToId(Item item, String name, String modId, int Id) | |
{ | |
//これに悩んでたってわけ。 | |
Map<UniqueIdentifier, ModContainer> customOwners = ObfuscationReflectionHelper.getPrivateValue(GameData.class, null, 3); | |
ModContainer mc = Loader.instance().activeModContainer(); | |
if (modId != null) | |
{ | |
//地味にここも悩んだ。 | |
customOwners.put(new UniqueIdentifier(modId + ":" +name), mc); | |
} | |
if (item instanceof ItemBlock) | |
{ | |
throw new RuntimeException("Cannot register an itemblock separately from it's block"); | |
} | |
int itemId = GameData.itemRegistry.add(Id, name, item); | |
GameData.blockRegistry.useSlot(itemId); | |
} | |
//Itemと殆ど同じ。 | |
private void registerBlockToId(Block block, String name, String modId, int Id) | |
{ | |
Map<UniqueIdentifier, ModContainer> customOwners = ObfuscationReflectionHelper.getPrivateValue(GameData.class, null, 3); | |
ModContainer mc = Loader.instance().activeModContainer(); | |
if (modId != null) | |
{ | |
customOwners.put(new UniqueIdentifier(modId + ":" + name), mc); | |
} | |
int blockId = GameData.blockRegistry.add(Id, name, block); | |
GameData.itemRegistry.useSlot(blockId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment