本文整理了Java中net.minecraft.util.ResourceLocation.getNamespace
方法的一些代码示例,展示了ResourceLocation.getNamespace
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceLocation.getNamespace
方法的具体详情如下:
包路径:net.minecraft.util.ResourceLocation
类名称:ResourceLocation
方法名:getNamespace
暂无
代码示例来源: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 IWikiProvider getWikiFor(Block block) {
ResourceLocation mod = Block.REGISTRY.getNameForObject(block);
return getWikiFor(mod == null ? "" : mod.getNamespace().toLowerCase());
}
代码示例来源:origin: Vazkii/Botania
@SubscribeEvent
public static void onDeath(LivingDeathEvent evt) {
if(!evt.getEntityLiving().world.isRemote
&& evt.getEntityLiving() instanceof EntityPlayer
&& !evt.getEntityLiving().world.getGameRules().getBoolean("keepInventory")
&& !((EntityPlayer) evt.getEntityLiving()).isSpectator()) {
IItemHandler inv = BaublesApi.getBaublesHandler((EntityPlayer) evt.getEntityLiving());
for(int i = 0; i < inv.getSlots(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (!stack.isEmpty() && stack.getItem().getRegistryName().getNamespace().equals(LibMisc.MOD_ID)) {
((ItemBauble) stack.getItem()).onUnequipped(stack, evt.getEntityLiving());
}
}
}
}
代码示例来源:origin: gegy1000/Terrarium
public TerrariumPreset(String name, ResourceLocation worldType, ResourceLocation icon, GenerationSettings properties) {
this.name = name;
this.worldType = worldType;
this.icon = new ResourceLocation(icon.getNamespace(), "textures/preset/" + icon.getNamespace() + ".png");
this.properties = properties;
}
代码示例来源:origin: FTBTeam/FTB-Utilities
public static String getLeaderboardNode(Leaderboard leaderboard)
{
return LEADERBOARD_PREFIX + leaderboard.id.getNamespace() + "." + leaderboard.id.getPath();
}
}
代码示例来源:origin: mezz/JustEnoughItems
@Override
public String getModId(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.getNamespace();
}
代码示例来源:origin: ForestryMC/ForestryMC
private static ResourceLocation getBlockstateLocation(ResourceLocation location) {
return new ResourceLocation(location.getNamespace(),
"blockstates/" + location.getPath() + ".json");
}
代码示例来源: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: 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: 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: 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: 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 getModId(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.getNamespace();
}
代码示例来源: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: mezz/JustEnoughItems
@Override
public String getModId(FluidStack ingredient) {
String defaultFluidName = FluidRegistry.getDefaultFluidName(ingredient.getFluid());
if (defaultFluidName == null) {
return "";
}
ResourceLocation fluidResourceName = new ResourceLocation(defaultFluidName);
return fluidResourceName.getNamespace();
}
代码示例来源:origin: raoulvdberge/refinedstorage
@SubscribeEvent
public void fixBlockMappings(RegistryEvent.MissingMappings<Block> e) {
OneSixMigrationHelper.removalHook();
for (RegistryEvent.MissingMappings.Mapping<Block> missing : e.getMappings()) {
if (missing.key.getNamespace().equals(RS.ID) && missing.key.getPath().equals("solderer")) {
missing.ignore();
}
}
}
代码示例来源:origin: DimensionalDevelopment/VanillaFix
private ModelBlockDefinition loadModelBlockDefinition(ResourceLocation location) {
ResourceLocation blockstateLocation = new ResourceLocation(location.getNamespace(), "blockstates/" + location.getPath() + ".json");
List<ModelBlockDefinition> list = Lists.newArrayList();
try {
for (IResource resource : Minecraft.getMinecraft().getResourceManager().getAllResources(blockstateLocation)) {
list.add(loadModelBlockDefinition(location, resource));
}
} catch (IOException e) {
throw new RuntimeException("Encountered an exception when loading model definition of model " + blockstateLocation, e);
}
return new ModelBlockDefinition(list);
}
代码示例来源:origin: PrinceOfAmber/Cyclic
public static String getStringForItem(Item item) {
if (item == null || item.getRegistryName() == null) {
return "";
}
return item.getRegistryName().getNamespace() + ":" + item.getRegistryName().getPath();
}
代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation
@Override
public void updateModel(EntityLivingBase entityLivingBase, ItemStack itemStack, EntityEquipmentSlot slot) {
ItemStack stack = ((Engineerable) itemStack.getItem()).getStackInSlot(itemStack, 0);
ExosuitPlate plate = UtilPlates.getPlate(stack);
if (plate != null) {
plateOverlay = new ResourceLocation(MODEL_TEXTURE.getNamespace(),
MODEL_TEXTURE.getPath().replace(".png", "_" + plate.getArmorMod() + ".png"));
return;
}
plateOverlay = null;
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
String resourceDomain = Block.REGISTRY.getNameForObject(state.getBlock()).getNamespace();
String resourceLocation = "apiculture/alveary_" + type;
String propertyString = getPropertyString(state.getProperties());
return new ModelResourceLocation(resourceDomain + ':' + resourceLocation, propertyString);
}
内容来源于网络,如有侵权,请联系作者删除!