本文整理汇总了Java中net.minecraft.block.Block.getRegistryName方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getRegistryName方法的具体用法?Java Block.getRegistryName怎么用?Java Block.getRegistryName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.getRegistryName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerItemModel
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
public void registerItemModel(Item item) {
if(item instanceof IItemColored)
COLOR_ITEMS.add((IItemColored) item);
if(item instanceof ItemBlock)
{
ItemBlock itemBlock = (ItemBlock) item;
Block block = itemBlock.getBlock();
ResourceLocation resloc = block.getRegistryName();
if(block instanceof IBlockVariants) {
for (IBlockState state : ((IBlockVariants) block).getValidStates()) {
ModelLoader.setCustomModelResourceLocation(item, block.getMetaFromState(state), new ModelResourceLocation(resloc, ((IBlockVariants) block).getBlockStateName(state)));
}
}
else
ModelLoader.setCustomModelResourceLocation(item,0,new ModelResourceLocation(resloc, "inventory"));
}
else
ModelLoader.setCustomModelResourceLocation(item,0,new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
示例2: registerBlock
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Registers the given block.
* Also adds the respective TileEntity if the block has one.
*
* @param registerItemBlock - {@code true} to also register the block as item.
*/
private static void registerBlock(Block block, boolean registerItemBlock) {//TODO REGISTRY - Register block names with "oft." -prefix to avoid name clash between mods.
/* Determine block's unlocalised name. */
String name = block.getClass().getSimpleName().toLowerCase().substring(5);
/* Register block (and its TileEntity, if existent). */
if (block.getRegistryName() == null) {
GameRegistry.register(block.setRegistryName(name).setUnlocalizedName(name));
if(block instanceof ITileEntityProvider){
Class<? extends TileEntity> tileEntityClass = ((ITileEntityProvider) block).createNewTileEntity(null, 0).getClass();
GameRegistry.registerTileEntity(tileEntityClass, tileEntityClass.getSimpleName());
}
}
/* Register block's item if required. */
if (registerItemBlock && Item.getItemFromBlock(block) == null) {
GameRegistry.register(new ItemBlock(block).setRegistryName(name));
}
}
示例3: applyModifiers
import net.minecraft.block.Block; //导入方法依赖的package包/类
private static boolean applyModifiers(BlockEvent.CreateFluidSourceEvent event)
{
Block block = event.getState().getBlock();
for (FluidModifier modifier : FluidModifier.getModifiers())
{
if (block.getRegistryName() != null && block.getRegistryName().equals(modifier.block))
{
if (modifier.canCreateSource != null)
{
event.setResult(modifier.canCreateSource ? Event.Result.ALLOW : Event.Result.DENY);
return true;
}
}
}
return false;
}
示例4: testIfLegit
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
protected boolean testIfLegit(Block componant) {
boolean legit = componant.getRegistryName() != null;
if(!legit)
new NullPointerException("Tried to config a Item with no registry name. Item: " + componant.getClass());
return super.testIfLegit(componant);
}
示例5: registerBlock
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Use {@link #register(IForgeRegistryEntry)} instead
*/
@Deprecated
public static Block registerBlock(Block block, String name)
{
if (block.getRegistryName() == null && Strings.isNullOrEmpty(name))
throw new IllegalArgumentException("Attempted to register a Block with no name: " + block);
if (block.getRegistryName() != null && !block.getRegistryName().toString().equals(name))
throw new IllegalArgumentException("Attempted to register a Block with conflicting names. Old: " + block.getRegistryName() + " New: " + name);
return registerBlock(block.getRegistryName() != null ? block : block.setRegistryName(name));
}
示例6: registerBlockColorHandler
import net.minecraft.block.Block; //导入方法依赖的package包/类
public void registerBlockColorHandler(IBlockColor blockColor, Block... blocksIn)
{
for (Block block : blocksIn)
{
if (block == null) throw new IllegalArgumentException("Block registered to block color handler cannot be null!");
if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
this.blockColorMap.put(block.delegate, blockColor);
}
}
示例7: registerItemColorHandler
import net.minecraft.block.Block; //导入方法依赖的package包/类
public void registerItemColorHandler(IItemColor itemColor, Block... blocksIn)
{
for (Block block : blocksIn)
{
if (block == null) throw new IllegalArgumentException("Block registered to item color handler cannot be null!");
if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
this.itemColorMap.put(Item.getItemFromBlock(block).delegate, itemColor);
}
}
示例8: registerRender
import net.minecraft.block.Block; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static void registerRender(Block block, int meta, String name) {
ModelResourceLocation model = new ModelResourceLocation(block.getRegistryName(), "inventory");
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, model);
}
示例9: registerRender
import net.minecraft.block.Block; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static void registerRender(Block block) {
ModelResourceLocation model = new ModelResourceLocation(block.getRegistryName(), "inventory");
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, model);
}