本文整理汇总了Java中net.minecraft.util.RegistryNamespaced类的典型用法代码示例。如果您正苦于以下问题:Java RegistryNamespaced类的具体用法?Java RegistryNamespaced怎么用?Java RegistryNamespaced使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RegistryNamespaced类属于net.minecraft.util包,在下文中一共展示了RegistryNamespaced类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItemName
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
public static String getItemName(String s)
{
// If this name is a number we parse the number then check the item registry for an item with that ID.
// If the ID is valid we'll get the name, if not we'll get a null.
// If the name isn't a number just return the name again.
try
{
RegistryNamespaced rn = GameData.getItemRegistry();
int id = Integer.parseInt(s);
if(rn.containsId(id))
return rn.getNameForObject(rn.getObjectById(id));
else
return null;
}
catch (NumberFormatException e) {}
return s;
}
示例2: overwrite_do
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void overwrite_do(RegistryNamespaced registry,
String name, Object object, Object oldThing) {
int id = registry.getIDForObject(oldThing);
BiMap map = (BiMap) ReflectionHelper.getField(registry,
"registryObjects");
ObjectIntIdentityMap underlyingIntegerMap = (ObjectIntIdentityMap) ReflectionHelper
.getField(registry, "underlyingIntegerMap");
underlyingIntegerMap.func_148746_a(object, id);
map.remove(name);
map.forcePut(name, object);
}
示例3: overwriteEntry
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void overwriteEntry(RegistryNamespaced registry, String name,
Object object) {
Object oldThing = registry.getObject(name);
Repl.overwrite_do(registry, name, object, oldThing);
Multimap<String, Object> reg = Repl.replacements.get(registry);
if (reg == null) {
Repl.replacements.put(registry, reg = ArrayListMultimap.create());
}
if (!reg.containsKey(name)) {
reg.put(name, oldThing);
}
reg.put(name, object);
Repl.alterDelegateChain(registry, name, object);
}
示例4: dump
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
@Override
public Iterable<String[]> dump(int mode) {
LinkedList<String[]> list = new LinkedList<String[]>();
RegistryNamespaced registry = registry();
for(T obj : (Iterable<T>)registry)
list.add(dump(obj, registry.getIDForObject(obj), registry.getNameForObject(obj)));
return list;
}
示例5: dump
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
@Override
public Iterable<String[]> dump(int mode) {
LinkedList<String[]> list = new LinkedList<String[]>();
RegistryNamespaced registry = registry();
for(T obj : (Iterable<T>)registry)
list.add(dump(obj, registry.getIDForObject(obj), (String)registry.getNameForObject(obj)));
return list;
}
示例6: alterDelegateChain
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
private static void alterDelegateChain(RegistryNamespaced registry,
String id, Object object) {
Multimap<String, Object> map = replacements.get(registry);
List<Object> c = (List<Object>) map.get(id);
int i = 0, e = c.size() - 1;
Object end = c.get(e);
for (; i <= e; ++i) {
Object t = c.get(i);
Repl.alterDelegate(t, end);
}
}
示例7: _
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void _(WorldEvent.Load event) {
if (Repl.replacements.size() < 1) {
return;
}
for (Map.Entry<RegistryNamespaced, Multimap<String, Object>> entry : Repl.replacements
.entrySet()) {
RegistryNamespaced reg = entry.getKey();
Multimap<String, Object> map = entry.getValue();
Iterator<String> v = map.keySet().iterator();
while (v.hasNext()) {
String id = v.next();
List<Object> c = (List<Object>) map.get(id);
int i = 0, e = c.size() - 1;
Object end = c.get(e);
if (reg.getIDForObject(c.get(0)) != reg.getIDForObject(end)) {
for (; i <= e; ++i) {
Object t = c.get(i);
Object oldThing = reg.getObject(id);
Repl.overwrite_do(reg, id, t, oldThing);
Repl.alterDelegate(oldThing, end);
}
}
}
}
}
示例8: processCommand
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
@Override
public void processCommand(ICommandSender cs, String[] args)
{
RegistryNamespaced rn = GameData.getItemRegistry();
if(cs instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) cs;
try
{
Item i = null;
ItemStack iStack = null;
switch(args.length)
{
case 0:
i = (player.getHeldItem() != null) ? player.getHeldItem().getItem() : null; break;
case 1:
i = (Item) rn.getObjectById(Integer.parseInt(args[0])); break;
case 2:
i = (Item) rn.getObjectById(Integer.parseInt(args[0])); break;
}
if(i == null)
{
Helper.toChatErr(cs, "No held item, or no such item.");
return;
}
iStack = new ItemStack(i);
int dmg = 0;
switch(args.length)
{
case 0:
iStack.setItemDamage(player.getHeldItem().getItemDamage());
dmg = iStack.getItemDamage();
break;
case 1:
iStack.setItemDamage(dmg);
break;
case 2:
dmg = Integer.parseInt(args[1]);
iStack.setItemDamage(dmg);
break;
}
if(iStack != null)
{
Helper.toChat(cs, EnumChatFormatting.GRAY + "--");
Helper.toChat(cs, EnumChatFormatting.AQUA + "NNAME: "+ rn.getIDForObject(i) + ":" + dmg);
Helper.toChat(cs, EnumChatFormatting.AQUA + "UNAME: "+ rn.getNameForObject(i));
int [] oIDs = OreDictionary.getOreIDs(iStack);
for(int j = 0; j < oIDs.length; j++)
{
Helper.toChat(cs, EnumChatFormatting.AQUA + "ONAME: "+OreDictionary.getOreName(oIDs[j]));
}
}
}
catch(NumberFormatException e)
{
Helper.toChatErr(cs, "Non-number in numeric field.");
}
}
}
示例9: registry
import net.minecraft.util.RegistryNamespaced; //导入依赖的package包/类
public abstract RegistryNamespaced registry();