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

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

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

ResourceLocation.getResourcePath介绍

暂无

代码示例

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

@Override
public IModel loadModel( ResourceLocation modelLocation ) throws Exception
{
  return this.builtInModels.get( modelLocation.getResourcePath() );
}

代码示例来源: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

@Override
public String toString()
{
  String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
  return this.getClass().getSimpleName() + "[" + regName + "]";
}

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

@Override
public String toString()
{
  String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
  return this.getClass().getSimpleName() + "[" + regName + "]";
}

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

@Override
public String toString()
{
  String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
  return this.getClass().getSimpleName() + "[" + regName + "]";
}

代码示例来源: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

@Override
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
  rendering.builtInModel( MODEL_ID.getResourcePath(), new SpatialPylonModel() );
  rendering.stateMapper( this::mapState );
}

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

public UVLModelWrapper( ResourceLocation modelLocation )
  String modelPath = modelLocation.getResourcePath();
  if( modelLocation.getResourcePath().startsWith( "models/" ) )
      String s = modelLocation.getResourcePath();

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

factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );

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

@Nullable
public static ResolverResult getResolver( final int certus2 )
{
  return AEApi.instance()
      .definitions()
      .items()
      .crystalSeed()
      .maybeStack( 1 )
      .map( crystalSeedStack ->
      {
        crystalSeedStack.setItemDamage( certus2 );
        crystalSeedStack = newStyle( crystalSeedStack );
        String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath();
        return new ResolverResult( itemName, crystalSeedStack.getItemDamage(), crystalSeedStack.getTagCompound() );
      } )
      .orElse( null );
}

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

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

代码示例来源: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: ExtraCells/ExtraCells2

public ModelResourceLocation getModelLocation(Item item) {
  ResourceLocation resourceLocation = item.getRegistryName();
  Preconditions.checkNotNull(resourceLocation);
  String itemName = resourceLocation.getResourcePath();
  return getModelLocation(itemName);
}

代码示例来源:origin: Vazkii/Quark

private void loadTradeInfo(Biome biome, boolean enabled, int level, int minPrice, int maxPrice, int color, String overrideCategory, String overrideName) {
  String category = configCategory + ".";
  if(!overrideCategory.isEmpty())
    category += overrideCategory;
  else category += biome.getRegistryName().getResourcePath();
  
  TradeInfo info;
  if(overrideName.isEmpty())
    info = new TradeInfo(category, biome, enabled, level, minPrice, maxPrice, color);
  else info = new TradeInfo(category, biome, enabled, level, minPrice, maxPrice, color, overrideName);
  
  if(info.enabled)
    trades.put(info.level, info);
}

代码示例来源: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: 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: CyclopsMC/IntegratedDynamics

/**
 * Read the given model location to a {@link net.minecraft.client.renderer.block.model.ModelBlock}.
 * @param modelLocation A model location (without .json suffix)
 * @return The corresponding model.
 * @throws IOException If the model file was invalid.
 */
public static ModelBlock loadModelBlock(ResourceLocation modelLocation) throws IOException {
  IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(
      new ResourceLocation(modelLocation.getResourceDomain(), modelLocation.getResourcePath() + ".json"));
  Reader reader = new InputStreamReader(resource.getInputStream(), Charsets.UTF_8);
  return ModelBlock.deserialize(reader);
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
  @SideOnly(Side.CLIENT)
  public void registerClient() {
    ModelLoaderHelper.registerItem(this, (i, m) -> new ModelResourceLocation(new ResourceLocation(AncientWarfareCore.MOD_ID, "vehicle/armor"), "variant=" + getRegistryName().getResourcePath()));
  }
}

相关文章