当前位置: 首页>>代码示例>>Java>>正文


Java ITextComponent.getStyle方法代码示例

本文整理汇总了Java中net.minecraft.util.text.ITextComponent.getStyle方法的典型用法代码示例。如果您正苦于以下问题:Java ITextComponent.getStyle方法的具体用法?Java ITextComponent.getStyle怎么用?Java ITextComponent.getStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.text.ITextComponent的用法示例。


在下文中一共展示了ITextComponent.getStyle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addHoverText

import net.minecraft.util.text.ITextComponent; //导入方法依赖的package包/类
public static ITextComponent addHoverText(ITextComponent component, ITextComponent hoverComponent)
{
	Style s = component.getStyle();
	s.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent));
	component.setStyle(s);
	return component;
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:8,代码来源:TextFormatter.java

示例2: addURLClick

import net.minecraft.util.text.ITextComponent; //导入方法依赖的package包/类
public static ITextComponent addURLClick(ITextComponent component, String url)
{
	Style s = component.getStyle();
	s.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
	component.setStyle(s);
	return component;
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:8,代码来源:TextFormatter.java

示例3: executeCommand

import net.minecraft.util.text.ITextComponent; //导入方法依赖的package包/类
public boolean executeCommand(final EntityPlayer playerIn)
{
    ICommandSender icommandsender = new ICommandSender()
    {
        public String getName()
        {
            return playerIn.getName();
        }
        public ITextComponent getDisplayName()
        {
            return playerIn.getDisplayName();
        }
        public void addChatMessage(ITextComponent component)
        {
        }
        public boolean canCommandSenderUseCommand(int permLevel, String commandName)
        {
            return permLevel <= 2;
        }
        public BlockPos getPosition()
        {
            return TileEntitySign.this.pos;
        }
        public Vec3d getPositionVector()
        {
            return new Vec3d((double)TileEntitySign.this.pos.getX() + 0.5D, (double)TileEntitySign.this.pos.getY() + 0.5D, (double)TileEntitySign.this.pos.getZ() + 0.5D);
        }
        public World getEntityWorld()
        {
            return playerIn.getEntityWorld();
        }
        public Entity getCommandSenderEntity()
        {
            return playerIn;
        }
        public boolean sendCommandFeedback()
        {
            return false;
        }
        public void setCommandStat(CommandResultStats.Type type, int amount)
        {
            if (TileEntitySign.this.world != null && !TileEntitySign.this.world.isRemote)
            {
                TileEntitySign.this.stats.setCommandStatForSender(TileEntitySign.this.world.getMinecraftServer(), this, type, amount);
            }
        }
        public MinecraftServer getServer()
        {
            return playerIn.getServer();
        }
    };

    for (ITextComponent itextcomponent : this.signText)
    {
        Style style = itextcomponent == null ? null : itextcomponent.getStyle();

        if (style != null && style.getClickEvent() != null)
        {
            ClickEvent clickevent = style.getClickEvent();

            if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND)
            {
                playerIn.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
            }
        }
    }

    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:70,代码来源:TileEntitySign.java


注:本文中的net.minecraft.util.text.ITextComponent.getStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。