net.minecraft.util.ResourceLocation.getResourceDomain()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(59)

本文整理了Java中net.minecraft.util.ResourceLocation.getResourceDomain方法的一些代码示例,展示了ResourceLocation.getResourceDomain的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceLocation.getResourceDomain方法的具体详情如下:
包路径:net.minecraft.util.ResourceLocation
类名称:ResourceLocation
方法名:getResourceDomain

ResourceLocation.getResourceDomain介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public boolean accepts( ResourceLocation modelLocation )
{
  if( !modelLocation.getResourceDomain().equals( AppEng.MOD_ID ) )
  {
    return false;
  }
  return this.builtInModels.containsKey( modelLocation.getResourcePath() );
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@SideOnly( Side.CLIENT )
public String getModID()
{
  if( this.uniqueID == null )
  {
    this.uniqueID = Item.REGISTRY.getNameForObject( this.getDefinition().getItem() );
  }
  if( this.uniqueID == null )
  {
    return "** Null";
  }
  return this.uniqueID.getResourceDomain() == null ? "** Null" : this.uniqueID.getResourceDomain();
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getResourceDomain().equals( entry.getKey() ) )

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public boolean accepts( ResourceLocation modelLocation )
{
  String modelPath = modelLocation.getResourcePath();
  if( modelLocation.getResourcePath().startsWith( "models/" ) )
  {
    modelPath = modelPath.substring( "models/".length() );
  }
  try( InputStreamReader io = new InputStreamReader( Minecraft.getMinecraft()
      .getResourceManager()
      .getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) )
      .getInputStream() ) )
  {
    return gson.fromJson( io, UVLMarker.class ).ae2_uvl_marker;
  }
  catch( Exception e )
  {
    // Catch-all in case of any JSON parser issues.
  }
  return false;
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

ResourceLocation armatureLocation = new ResourceLocation( modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json" );
ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation( UVLModelLoader.this.resourceManager, armatureLocation );
ModelBlock model;
        .getResourceManager()
        .getResource(
            new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) );
    reader = new InputStreamReader( iresource.getInputStream(), Charsets.UTF_8 );

代码示例来源:origin: TheGreyGhost/MinecraftByExample

@Override
public boolean accepts(ResourceLocation resourceLocation) {
 return resourceLocation.getResourceDomain().equals("minecraftbyexample")
     && resourceLocation.getResourcePath().startsWith(SMART_MODEL_RESOURCE_LOCATION);
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
  public JsonElement serialize(ResourceLocation src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject object = new JsonObject();
    object.addProperty("domain", src.getResourceDomain());
    object.addProperty("path", src.getResourcePath());
    return object;
  }
};

代码示例来源:origin: PenguinSquad/Harvest-Festival

public Utensil(ResourceLocation resource) {
  this.resource = resource;
  this.unlocalized = resource.getResourceDomain() + ".cookware." + resource.getResourcePath().replace("_", ".");
  this.burntName = resource.getResourceDomain() + ".meal.burnt." + resource.getResourcePath().replace("_", ".");
  REGISTRY.put(resource, this);
}

代码示例来源:origin: RS485/LogisticsPipes

@Override
public void registerModels() {
  ForgeRegistries.ITEMS.getValuesCollection().stream()
      .filter(item -> item.getRegistryName().getResourceDomain().equals(LPConstants.LP_MOD_ID))
      .filter(item -> item instanceof ILogisticsItem)
      .forEach(item -> registerModels((ILogisticsItem)item));
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Override
@SuppressWarnings("deprecation")
public void addTooltipForCalendarEntry(List<String> tooltip) {
  if (note != null) tooltip.add(note.getTitle());
  else tooltip.addAll(Arrays.asList(I18n.translateToLocal(resource.getResourceDomain() + ".festival." + resource.getResourcePath().replace("_", ".") + ".tooltip.").split("\n")));
}

代码示例来源:origin: SleepyTrousers/EnderIO

private CapacitorKey(@Nonnull IModObject owner, @Nonnull CapacitorKeyType valueType, @Nonnull String shortname) {
 this.owner = owner;
 this.valueType = valueType;
 this.registryName = new ResourceLocation(owner.getRegistryName().getResourceDomain(),
   owner.getRegistryName().getResourcePath() + "/" + shortname.toLowerCase(Locale.ENGLISH));
}

代码示例来源:origin: SleepyTrousers/EnderIO

private CapacitorKey(@Nonnull IModObject owner, @Nonnull CapacitorKeyType valueType, @Nonnull String shortname) {
 this.owner = owner;
 this.valueType = valueType;
 this.registryName = new ResourceLocation(owner.getRegistryName().getResourceDomain(),
   owner.getRegistryName().getResourcePath() + "/" + shortname.toLowerCase(Locale.ENGLISH));
}

代码示例来源:origin: SleepyTrousers/EnderIO

private CapacitorKey(@Nonnull IModObject owner, @Nonnull CapacitorKeyType valueType, @Nonnull String shortname) {
 this.owner = owner;
 this.valueType = valueType;
 this.registryName = new ResourceLocation(owner.getRegistryName().getResourceDomain(),
   owner.getRegistryName().getResourcePath() + "/" + shortname.toLowerCase(Locale.ENGLISH));
}

代码示例来源:origin: SleepyTrousers/EnderIO

private CapacitorKey(@Nonnull IModObject owner, @Nonnull CapacitorKeyType valueType, @Nonnull String shortname) {
 this.owner = owner;
 this.valueType = valueType;
 this.registryName = new ResourceLocation(owner.getRegistryName().getResourceDomain(),
   owner.getRegistryName().getResourcePath() + "/" + shortname.toLowerCase(Locale.ENGLISH));
}

代码示例来源:origin: SleepyTrousers/EnderIO

private void findModId() {
 Item item = getItem();
 if (item != null) {
  ResourceLocation resourceName = item.delegate.name();
  if (resourceName != null) {
   modId = resourceName.getResourceDomain();
  }
 }
 if (modId == null) {
  modId = "Unknown";
 }
}

代码示例来源:origin: RS485/LogisticsPipes

@Override
@Nonnull
public IModel loadModel(@Nonnull ResourceLocation modelLocation) {
  ResourceLocation baseTex = new ResourceLocation(modelLocation.getResourceDomain(), "solid_block/" + modelLocation.getResourcePath());
  return new LogisticsBlockModel(baseTex, Objects.requireNonNull(getType(modelLocation)));
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

private static void setupGifts(NPC npc) {
  npc.setGiftHandler(new IGiftHandler() {});
  if (npc.getResource().getResourceDomain().equals(MODID)) {
    try {
      IGiftHandler handler = (IGiftHandler) Class.forName(GIFTPATH + WordUtils.capitalize(npc.getResource().getResourcePath())).newInstance();
      if (handler != null) npc.setGiftHandler(handler);
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {/**/}
  }
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

/**
 * Gets the localized crop name for this crop
 *
 * @param isItem the item
 * @return crop name
 */
@SuppressWarnings("deprecation")
public String getLocalizedName(boolean isItem) {
  String suffix = alternativeName ? ((isItem) ? ".item" : ".block") : "";
  return I18n.translateToLocal((getResource().getResourceDomain() + ".crop." + StringUtils.replace(getResource().getResourcePath(), "_", ".") + suffix));
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
  tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.orb.desc"));
  BloodOrb orb = getOrb(stack);
  if (flag.isAdvanced() && orb != null)
    tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.orb.owner", orb.getRegistryName().getResourceDomain()));
  super.addInformation(stack, world, tooltip, flag);
}

代码示例来源:origin: CoFH/CoFHCore

public static void addShapelessRecipe(ItemStack output, Object... input) {
  ResourceLocation location = getNameForRecipe(output);
  ShapelessRecipes recipe = new ShapelessRecipes(location.getResourceDomain(), output, buildInput(input));
  recipe.setRegistryName(location);
  GameData.register_impl(recipe);
}

相关文章