net.minecraft.block.Block.getRegistryName()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(191)

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

Block.getRegistryName介绍

暂无

代码示例

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

public boolean isWhiteListed( final Block block, final int metadata )
  {
    final Integer entry = this.whiteList.get( block.getRegistryName() );

    if( entry != null )
    {
      return entry == metadata || entry == 16;
    }

    return false;
  }
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

@SuppressWarnings("unchecked")
protected static <T extends Block> T registerItemBlock(IForgeRegistry<Item> registry, ItemBlock itemBlock) {
 itemBlock.setUnlocalizedName(itemBlock.getBlock().getUnlocalizedName());
 register(registry, itemBlock, itemBlock.getBlock().getRegistryName());
 return (T) itemBlock.getBlock();
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

protected void imc(Block block) {
  if(block != null) {
   FMLInterModComms.sendMessage(modid, "ignoreblocklogic", block.getRegistryName());
  }
 }
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

/** Registers an itemblockmeta model for the blocks inventory variant. */
public static void registerItemBlockMeta(Block block) {
 if(block != null) {
  Item item = Item.getItemFromBlock(block);
  if(item instanceof ItemBlockMeta) {
   ((ItemBlockMeta) item).registerItemModels();
  }
  else {
   TConstruct.log.error("Trying to register an ItemBlockMeta model for a non itemblockmeta block: " + block.getRegistryName());
  }
 }
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

@SuppressWarnings("unchecked")
protected static <T extends Block> T registerItemBlockProp(IForgeRegistry<Item> registry, ItemBlock itemBlock, IProperty<?> property) {
 itemBlock.setUnlocalizedName(itemBlock.getBlock().getUnlocalizedName());
 register(registry, itemBlock, itemBlock.getBlock().getRegistryName());
 ItemBlockMeta.setMappingProperty(itemBlock.getBlock(), property);
 return (T) itemBlock.getBlock();
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

protected static <T extends Block> T registerItemBlock(IForgeRegistry<Item> registry, T block) {
 ItemBlock itemBlock = new ItemBlockMeta(block);
 itemBlock.setUnlocalizedName(block.getUnlocalizedName());
 register(registry, itemBlock, block.getRegistryName());
 return block;
}

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

public static void registerInventoryVariant(Block b) {
  ModelLoader.setCustomModelResourceLocation(
      Item.getItemFromBlock(b), 0,
      new ModelResourceLocation(b.getRegistryName(), "inventory"));
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

protected void addChiselVariation(Block block, int meta, String groupName) {
  if(block != null) {
   NBTTagCompound nbt = new NBTTagCompound();
   nbt.setString("group", groupName);
   nbt.setTag("stack", new ItemStack(block, 1, meta).writeToNBT(new NBTTagCompound()));
   nbt.setString("block", block.getRegistryName().toString());
   nbt.setInteger("meta", meta);
   FMLInterModComms.sendMessage(modid, "add_variation", nbt);
  }
 }
}

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

@SubscribeEvent
public static void registerItemBlocks(RegistryEvent.Register<Item> evt) {
  IForgeRegistry<Item> r = evt.getRegistry();
  r.register(new ItemBlockMod(livingwoodStairs).setRegistryName(livingwoodStairs.getRegistryName()));
  r.register(new ItemBlockModSlab(livingwoodSlab).setRegistryName(livingwoodSlab.getRegistryName()));
  r.register(new ItemBlockMod(livingwoodWall).setRegistryName(livingwoodWall.getRegistryName()));
  r.register(new ItemBlockMod(livingwoodPlankStairs).setRegistryName(livingwoodPlankStairs.getRegistryName()));
  r.register(new ItemBlockModSlab(livingwoodPlankSlab).setRegistryName(livingwoodPlankSlab.getRegistryName()));
  r.register(new ItemBlockMod(livingrockStairs).setRegistryName(livingrockStairs.getRegistryName()));
  r.register(new ItemBlockModSlab(livingrockSlab).setRegistryName(livingrockSlab.getRegistryName()));
  r.register(new ItemBlockMod(livingrockWall).setRegistryName(livingrockWall.getRegistryName()));
  r.register(new ItemBlockMod(livingrockBrickStairs).setRegistryName(livingrockBrickStairs.getRegistryName()));
  r.register(new ItemBlockModSlab(livingrockBrickSlab).setRegistryName(livingrockBrickSlab.getRegistryName()));
  r.register(new ItemBlockMod(dreamwoodStairs).setRegistryName(dreamwoodStairs.getRegistryName()));
  r.register(new ItemBlockModSlab(dreamwoodSlab).setRegistryName(dreamwoodSlab.getRegistryName()));
  r.register(new ItemBlockMod(dreamwoodWall).setRegistryName(dreamwoodWall.getRegistryName()));
  r.register(new ItemBlockMod(dreamwoodPlankStairs).setRegistryName(dreamwoodPlankStairs.getRegistryName()));
  r.register(new ItemBlockModSlab(dreamwoodPlankSlab).setRegistryName(dreamwoodPlankSlab.getRegistryName()));
    r.register(new ItemBlockSpecialQuartz(darkQuartz).setRegistryName(darkQuartz.getRegistryName()));
    r.register(new ItemBlockModSlab(darkQuartzSlab).setRegistryName(darkQuartzSlab.getRegistryName()));
    r.register(new ItemBlockMod(darkQuartzStairs).setRegistryName(darkQuartzStairs.getRegistryName()));
  r.register(new ItemBlockSpecialQuartz(manaQuartz).setRegistryName(manaQuartz.getRegistryName()));
  r.register(new ItemBlockModSlab(manaQuartzSlab).setRegistryName(manaQuartzSlab.getRegistryName()));

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

private boolean setBlock(ItemStack stack, Block block, int meta) {
  if(Item.getItemFromBlock(block) != Items.AIR && (getBlock(stack) == null || getBlockCount(stack) == 0)) {
    ItemNBTHelper.setString(stack, TAG_BLOCK_NAME, block.getRegistryName().toString());
    ItemNBTHelper.setInt(stack, TAG_BLOCK_META, meta);
    return true;
  }
  return false;
}

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

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

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

@SubscribeEvent
public static void registerItemBlocks(RegistryEvent.Register<Item> evt) {
  IForgeRegistry<Item> r = evt.getRegistry();
  r.register(new ItemBlockWithMetadataAndName(flower).setRegistryName(flower.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(altar).setRegistryName(altar.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(livingrock).setRegistryName(livingrock.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(livingwood).setRegistryName(livingwood.getRegistryName()));
  r.register(new ItemBlockSpecialFlower(specialFlower).setRegistryName(specialFlower.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(spreader).setRegistryName(spreader.getRegistryName()));
  r.register(new ItemBlockPool(pool).setRegistryName(pool.getRegistryName()));
  r.register(new ItemBlockMod(runeAltar).setRegistryName(runeAltar.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(pylon).setRegistryName(pylon.getRegistryName()));
  r.register(new ItemBlockMod(pistonRelay).setRegistryName(pistonRelay.getRegistryName()));
  r.register(new ItemBlockMod(distributor).setRegistryName(distributor.getRegistryName()));
  r.register(new ItemBlockMod(manaVoid).setRegistryName(manaVoid.getRegistryName()));
  r.register(new ItemBlockMod(manaDetector).setRegistryName(manaDetector.getRegistryName()));
  r.register(new ItemBlockMod(enchanter).setRegistryName(enchanter.getRegistryName()));
  r.register(new ItemBlockMod(turntable).setRegistryName(turntable.getRegistryName()));
  r.register(new ItemBlockMod(tinyPlanet).setRegistryName(tinyPlanet.getRegistryName()));
  r.register(new ItemBlockMod(alchemyCatalyst).setRegistryName(alchemyCatalyst.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(openCrate).setRegistryName(openCrate.getRegistryName()));
  r.register(new ItemBlockMod(forestEye).setRegistryName(forestEye.getRegistryName()));
  r.register(new ItemBlockStorage(storage).setRegistryName(storage.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(forestDrum).setRegistryName(forestDrum.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(shinyFlower).setRegistryName(shinyFlower.getRegistryName()));
  r.register(new ItemBlockWithMetadataAndName(platform).setRegistryName(platform.getRegistryName()));
  r.register(new ItemBlockMod(alfPortal).setRegistryName(alfPortal.getRegistryName()));
  r.register(new ItemBlockDreamwood(dreamwood).setRegistryName(dreamwood.getRegistryName()));
  r.register(new ItemBlockMod(conjurationCatalyst).setRegistryName(conjurationCatalyst.getRegistryName()));
  r.register(new ItemBlockMod(bifrost).setRegistryName(bifrost.getRegistryName()));

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

recipeFerilizerDye = path("fertilizer_dye");
recipesPetalsDouble = allOfGroup("petal_double");
recipesPetalBlocks = allOfGroup(ModBlocks.petalBlock.getRegistryName());
recipesReversePetalBlocks = allOfGroup("petal_block_deconstruct");
recipesTwigWand = allOfGroup(ModItems.twigWand.getRegistryName());
recipeLivingwoodTwig = path("manaresource_3");
recipeRuneAltar = ModBlocks.runeAltar.getRegistryName();
recipeTerraPlate = ModBlocks.terraPlate.getRegistryName();
recipeFlowerBag = ModItems.flowerBag.getRegistryName();
recipesSpreader = allOfGroup(ModBlocks.spreader.getRegistryName());
recipeRFGenerator = ModBlocks.rfGenerator.getRegistryName();
recipeDistributor = ModBlocks.distributor.getRegistryName();
recipeManaVoid = ModBlocks.manaVoid.getRegistryName();
recipeManaTablet = ModItems.manaTablet.getRegistryName();
recipeManaMirror = ModItems.manaMirror.getRegistryName();
recipeManaDetector = ModBlocks.manaDetector.getRegistryName();
recipeRedstoneSpreader = path("spreader_1");
recipeDreamwoodSpreader = path("spreader_2");
recipeUltraSpreader = path("spreader_3");
recipeHelmetOfRevealing = allOfGroup("helm_revealing");
recipePrism = ModBlocks.prism.getRegistryName();
recipePoolCart = ModItems.poolMinecart.getRegistryName();
recipePump = ModBlocks.pump.getRegistryName();
recipeSparkChanger = ModBlocks.sparkChanger.getRegistryName();
recipeBellows = ModBlocks.bellows.getRegistryName();

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

@Override
public IBlockState getTextureBlockState( ItemStack is )
{
  ItemStack baseItemStack = this.getTextureItem( is );
  if( baseItemStack.isEmpty() )
  {
    return Blocks.GLASS.getDefaultState();
  }
  Block block = Block.getBlockFromItem( baseItemStack.getItem() );
  if( block == Blocks.AIR )
  {
    return Blocks.GLASS.getDefaultState();
  }
  int metadata = baseItemStack.getItem().getMetadata( baseItemStack );
  try
  {
    return block.getStateFromMeta( metadata );
  }
  catch( Exception e )
  {
    AELog.warn( "Block %s has broken getStateFromMeta method for meta %d", block.getRegistryName().toString(), baseItemStack.getItemDamage() );
    return Blocks.GLASS.getDefaultState();
  }
}

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

public static void regRenderer(@Nonnull Block block, int meta, @Nonnull String name) {
 Item item = Item.getItemFromBlock(block);
 ResourceLocation resourceLocation = block.getRegistryName();
 if (resourceLocation == null) {
  throw new NullPointerException("Cannot register renderers for block " + block + ": Block is not registered with the block registry");
 }
 ModelResourceLocation modelResourceLocation = new ModelResourceLocation(resourceLocation, name);
 ModelLoader.setCustomModelResourceLocation(item, meta, modelResourceLocation);
}

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

@SuppressWarnings("unused")
private static void whitelist(Block block) {
 if (block != null) {
  FMLInterModComms.sendMessage("chiselsandbits", "ignoreblocklogic", block.getRegistryName());
  Log.info("Sending whitelist message to Chisel and Bits for block ", block);
 }
}

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

FMLInterModComms.sendMessage("chiselsandbits", "ignoreblocklogic", b.getRegistryName().toString());

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

private static void whitelist(@Nonnull ModObject modObject) {
 if (modObject.getBlock() != null) {
  FMLInterModComms.sendMessage("chiselsandbits", "ignoreblocklogic", modObject.getBlockNN().getRegistryName());
  Log.info("Sending whitelist message to Chisel and Bits for block ", modObject);
 }
}

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

@Override
  protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
    ResourceLocation loc = state.getBlock().getRegistryName();
    if(state.getValue(BlockCustomFlowerPot.CUSTOM))
      return new ModelResourceLocation(loc, "contents=custom");

    LinkedHashMap<IProperty<?>, Comparable<?>> map = Maps.newLinkedHashMap(state.getProperties());
    map.remove(BlockCustomFlowerPot.CUSTOM);
    map.remove(BlockCustomFlowerPot.LEGACY_DATA);

    return new ModelResourceLocation(loc, this.getPropertyString(map));
  }
}

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

AELog.debug( e, "Cannot create a facade for " + block.getRegistryName() );
return ItemStack.EMPTY;

相关文章

Block类方法