本文整理了Java中net.minecraft.util.ResourceLocation.getPath
方法的一些代码示例,展示了ResourceLocation.getPath
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceLocation.getPath
方法的具体详情如下:
包路径:net.minecraft.util.ResourceLocation
类名称:ResourceLocation
方法名:getPath
暂无
代码示例来源:origin: Vazkii/Botania
@Override
public boolean accepts(ResourceLocation modelLocation) {
return modelLocation.getNamespace().equals("botania_special") && (
modelLocation.getPath().equals("specialflower") ||
modelLocation.getPath().equals("models/block/specialflower") ||
modelLocation.getPath().equals("models/item/specialflower"));
}
代码示例来源:origin: Vazkii/Botania
public static void registerItemAllMeta(Item item, int range) {
registerItemMetas(item, range, i -> item.getRegistryName().getPath());
}
代码示例来源:origin: raoulvdberge/refinedstorage
@Nullable
private CoverType getType(ResourceLocation modelLocation) {
switch (modelLocation.getPath()) {
case "cover":
return CoverType.NORMAL;
case "hollow_cover":
return CoverType.HOLLOW;
default:
return null;
}
}
代码示例来源:origin: DimensionalDevelopment/VanillaFix
private ResourceLocation getActualLocation(ResourceLocation location) {
if (location instanceof ModelResourceLocation) {
return location;
}
if (location.getPath().startsWith("builtin/") ||
location.getPath().startsWith("block/builtin/") ||
location.getPath().startsWith("item/builtin/")) { // TODO: why is this necessary
return location;
}
return new ResourceLocation(location.getNamespace(), "models/" + location.getPath());
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
@Override
public String toString()
{
return getRegistryName().getPath();
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
public Rock(@Nonnull ResourceLocation name, @Nonnull RockCategory rockCategory)
{
//noinspection ConstantConditions
if (rockCategory == null)
throw new IllegalArgumentException("Rock category is not allowed to be null (on rock " + name + ")");
setRegistryName(name);
this.rockCategory = rockCategory;
this.textureLocation = new ResourceLocation(MOD_ID, "textures/blocks/stonetypes/raw/" + name.getPath() + ".png");
}
代码示例来源:origin: mezz/JustEnoughItems
@Override
public String getResourceId(EnchantmentData ingredient) {
ResourceLocation registryName = ingredient.enchantment.getRegistryName();
if (registryName == null) {
String stackInfo = getErrorInfo(ingredient);
throw new IllegalStateException("enchantment.getRegistryName() returned null for: " + stackInfo);
}
return registryName.getPath();
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public ModelResourceLocation getModelLocation(Item item) {
ResourceLocation resourceLocation = ItemStackUtil.getItemNameFromRegistry(item);
Preconditions.checkNotNull(resourceLocation);
String itemName = resourceLocation.getPath();
return getModelLocation(itemName);
}
代码示例来源:origin: TeamWizardry/Wizardry
@SubscribeEvent
public static void remapFluids(RegistryEvent.MissingMappings<Block> event) {
event.getMappings().stream()
.filter(mapping -> mapping.key.getPath().equals("mana"))
.forEach(mapping -> mapping.remap(ModFluids.MANA.getActualBlock()));
event.getMappings().stream()
.filter(mapping -> mapping.key.getPath().equals("nacre"))
.forEach(mapping -> mapping.remap(ModFluids.NACRE.getActualBlock()));
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public void registerModel(Item item, IModelManager manager) {
ResourceLocation itemNameFromRegistry = ItemStackUtil.getItemNameFromRegistry(item);
Preconditions.checkNotNull(itemNameFromRegistry, "No registry name for item");
String identifier = itemNameFromRegistry.getPath();
manager.registerItemModel(item, 0, identifier);
manager.registerItemModel(item, 1, identifier);
}
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
@SideOnly(Side.CLIENT)
public void registerModel(Item item, IModelManager manager) {
ResourceLocation itemNameFromRegistry = ItemStackUtil.getItemNameFromRegistry(item);
Preconditions.checkNotNull(itemNameFromRegistry, "No registry name for item");
String identifier = itemNameFromRegistry.getPath();
manager.registerItemModel(item, 0, identifier);
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
public ItemLumberTFC(Tree wood)
{
this.wood = wood;
if (MAP.put(wood, this) != null) throw new IllegalStateException("There can only be one.");
setMaxDamage(0);
OreDictionaryHelper.register(this, "lumber");
OreDictionaryHelper.register(this, "lumber", wood.getRegistryName().getPath());
}
代码示例来源:origin: mezz/JustEnoughItems
private ResourceLocation getResourceLocation(TextureAtlasSprite p_184396_1_) {
ResourceLocation resourcelocation = new ResourceLocation(p_184396_1_.getIconName());
return new ResourceLocation(resourcelocation.getNamespace(), String.format("%s/%s%s", this.basePath, resourcelocation.getPath(), ".png"));
}
}
代码示例来源:origin: gegy1000/Terrarium
public OverpassSource(CoordinateState latLngCoordinate, double tileSize, String cacheRoot, ResourceLocation queryLocation, int queryVersion) {
super(new ResourceLocation(TerrariumEarth.MODID, "overpass"), new File(GLOBAL_CACHE_ROOT, cacheRoot), new Coordinate(latLngCoordinate, tileSize, tileSize));
this.queryVersion = queryVersion;
this.shouldSample = Math.abs(this.tileSize.getBlockX()) > 512 || Math.abs(this.tileSize.getBlockZ()) > 512;
this.loadQuery("/data/" + queryLocation.getNamespace() + "/" + queryLocation.getPath());
}
代码示例来源:origin: ForestryMC/ForestryMC
private ResourceLocation getResourceLocation(TextureAtlasSprite p_184396_1_) {
ResourceLocation resourcelocation = new ResourceLocation(p_184396_1_.getIconName());
return new ResourceLocation(resourcelocation.getNamespace(), String.format("%s/%s%s", this.basePath, resourcelocation.getPath(), ".png"));
}
}
代码示例来源:origin: mezz/JustEnoughItems
@Override
public String getResourceId(FluidStack ingredient) {
String defaultFluidName = FluidRegistry.getDefaultFluidName(ingredient.getFluid());
if (defaultFluidName == null) {
return "";
}
ResourceLocation fluidResourceName = new ResourceLocation(defaultFluidName);
return fluidResourceName.getPath();
}
代码示例来源:origin: ForestryMC/ForestryMC
private static Reader getReaderForResource(ResourceLocation location) throws IOException {
ResourceLocation file = new ResourceLocation(location.getNamespace(),
location.getPath() + ".json");
IResource iresource = Minecraft.getMinecraft().getResourceManager().getResource(file);
return new BufferedReader(new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8));
}
代码示例来源:origin: raoulvdberge/refinedstorage
@SubscribeEvent
public void fixItemMappings(RegistryEvent.MissingMappings<Item> e) {
OneSixMigrationHelper.removalHook();
for (RegistryEvent.MissingMappings.Mapping<Item> missing : e.getMappings()) {
if (missing.key.getNamespace().equals(RS.ID) && missing.key.getPath().equals("solderer")) {
missing.ignore();
}
}
}
代码示例来源:origin: mezz/JustEnoughItems
@Override
public String getResourceId(ItemStack ingredient) {
ErrorUtil.checkNotEmpty(ingredient);
Item item = ingredient.getItem();
ResourceLocation itemName = item.getRegistryName();
if (itemName == null) {
String stackInfo = getErrorInfo(ingredient);
throw new IllegalStateException("item.getRegistryName() returned null for: " + stackInfo);
}
return itemName.getPath();
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
public BlockSaplingTFC(Tree wood)
{
super();
if (MAP.put(wood, this) != null) throw new IllegalStateException("There can only be one.");
this.wood = wood;
setDefaultState(blockState.getBaseState().withProperty(STAGE, 0));
setSoundType(SoundType.PLANT);
setHardness(0.0F);
OreDictionaryHelper.register(this, "tree", "sapling");
OreDictionaryHelper.register(this, "tree", "sapling", wood.getRegistryName().getPath());
Blocks.FIRE.setFireInfo(this, 5, 20);
}
内容来源于网络,如有侵权,请联系作者删除!