net.minecraft.util.ResourceLocation#getResourceDomain ( )源码实例Demo

下面列出了net.minecraft.util.ResourceLocation#getResourceDomain ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: GregTech   文件: TemplateManager.java
public static Template getBuiltinTemplate(World world, ResourceLocation templateId) {
    if (templateMap.containsKey(templateId)) {
        return templateMap.get(templateId);
    }
    Template template = new Template();
    String resourcePath = "/assets/" + templateId.getResourceDomain() + "/structures/" + templateId.getResourcePath() + ".nbt";
    InputStream inputStream = TemplateManager.class.getResourceAsStream(resourcePath);
    if (inputStream != null) {
        try {
            NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(inputStream);
            if (!nbttagcompound.hasKey("DataVersion", 99)) {
                nbttagcompound.setInteger("DataVersion", 500);
            }
            DataFixer dataFixer = world.getMinecraftServer().getDataFixer();
            template.read(dataFixer.process(FixTypes.STRUCTURE, nbttagcompound));
        } catch (IOException exception) {
            GTLog.logger.error("Failed to load builtin template {}", templateId, exception);
        } finally {
            IOUtils.closeQuietly(inputStream);
        }
    } else {
        GTLog.logger.warn("Failed to find builtin structure with path {}", resourcePath);
    }
    templateMap.put(templateId, template);
    return template;
}
 
源代码2 项目: GregTech   文件: MachineItemBlock.java
@Nullable
@Override
public String getCreatorModId(ItemStack itemStack) {
    MetaTileEntity metaTileEntity = getMetaTileEntity(itemStack);
    if (metaTileEntity == null) {
        return GTValues.MODID;
    }
    ResourceLocation metaTileEntityId = metaTileEntity.metaTileEntityId;
    return metaTileEntityId.getResourceDomain();
}
 
源代码3 项目: GT-Classic   文件: GTItemElectromagnet.java
@SideOnly(Side.CLIENT)
public ModelResourceLocation createResourceLocationForStack(ItemStack stack) {
	int damage = stack.getItemDamage();
	ResourceLocation location = this.getRegistryName();
	String name = stack.getUnlocalizedName();
	this.model[damage] = new ModelResourceLocation(location.getResourceDomain()
			+ name.substring(name.indexOf(".") + 1) + damage, "inventory");
	return this.model[damage];
}
 
源代码4 项目: NotEnoughItems   文件: NEIInitialization.java
private static void loadModSubsets() {
    ProgressBar bar = ProgressManager.push("Mod Subsets", ForgeRegistries.ITEMS.getKeys().size());
    HashMap<String, ItemStackSet> modSubsets = new HashMap<>();

    for (Item item : ForgeRegistries.ITEMS) {
        try {
            ResourceLocation ident = item.getRegistryName();
            bar.step(ident.toString());
            if (ident == null) {
                LogHelper.error("Failed to find identifier for: " + item);
                continue;
            }
            String modId = ident.getResourceDomain();
            ItemInfo.itemOwners.put(item, modId);
            ItemStackSet itemset = modSubsets.computeIfAbsent(modId, k -> new ItemStackSet());
            itemset.with(item);
        } catch (Throwable t) {
            LogHelper.errorError("Failed to process mod subset item %s %s", t, String.valueOf(item), String.valueOf(item.getRegistryName()));
        }
    }
    ProgressManager.pop(bar);

    API.addSubset("Mod.Minecraft", modSubsets.remove("minecraft"));
    for (Entry<String, ItemStackSet> entry : modSubsets.entrySet()) {
        ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey());
        if (mc == null) {
            LogHelper.error("Missing container for " + entry.getKey());
        } else {
            API.addSubset("Mod." + mc.getName(), entry.getValue());
        }
    }
}
 
源代码5 项目: IGW-mod   文件: WikiUtils.java
public static String getOwningModId(ItemStack stack){
    String modid = "minecraft";
    if(stack.getItem() == null) {
        IGWLog.warning("Found an ItemStack with a null item! This isn't supposed to happen!");
    } else {
        ResourceLocation id = Item.REGISTRY.getNameForObject(stack.getItem());
        if(id != null && id.getResourceDomain() != null) modid = id.getResourceDomain().toLowerCase();
    }
    return modid;
}
 
源代码6 项目: Kettle   文件: CraftNamespacedKey.java
public static NamespacedKey fromMinecraft(ResourceLocation minecraft) {
    return new NamespacedKey(minecraft.getResourceDomain(), minecraft.getResourcePath());
}
 
源代码7 项目: NOVA-Core   文件: AssetConverter.java
@Override
public Asset toNova(ResourceLocation resource) {
	return new Asset(resource.getResourceDomain(), resource.getResourcePath()) {};
}
 
源代码8 项目: NOVA-Core   文件: AssetConverter.java
public Texture toNovaTexture(ResourceLocation resource) {
	return new Texture(resource.getResourceDomain(), resource.getResourcePath());
}
 
源代码9 项目: NOVA-Core   文件: AssetConverter.java
@Override
public Asset toNova(ResourceLocation resource) {
	return new Asset(resource.getResourceDomain(), resource.getResourcePath());
}
 
源代码10 项目: NOVA-Core   文件: AssetConverter.java
public Texture toNovaTexture(ResourceLocation resource) {
	return new Texture(resource.getResourceDomain(), resource.getResourcePath());
}
 
源代码11 项目: NOVA-Core   文件: AssetConverter.java
@Override
public Asset toNova(ResourceLocation resource) {
	return new Asset(resource.getResourceDomain(), resource.getResourcePath());
}
 
源代码12 项目: NOVA-Core   文件: AssetConverter.java
public Asset toNovaTexture(ResourceLocation resource) {
	return new Texture(resource.getResourceDomain(), resource.getResourcePath());
}
 
源代码13 项目: OpenModsLib   文件: ModIdentifier.java
private static ModContainer findModContainer(ResourceLocation id) {
	if (id == null) return null;

	String modId = id.getResourceDomain();
	return Loader.instance().getIndexedModList().get(modId);
}
 
源代码14 项目: OpenModsLib   文件: HitboxManager.java
public Holder(ResourceLocation location) {
	this.location = new ResourceLocation(location.getResourceDomain(), "hitboxes/" + location.getResourcePath() + ".json");
}