本文整理汇总了Java中net.minecraft.event.ClickEvent.Action方法的典型用法代码示例。如果您正苦于以下问题:Java ClickEvent.Action方法的具体用法?Java ClickEvent.Action怎么用?Java ClickEvent.Action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.event.ClickEvent
的用法示例。
在下文中一共展示了ClickEvent.Action方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NeptuneClickEventAction
import net.minecraft.event.ClickEvent; //导入方法依赖的package包/类
public NeptuneClickEventAction(ClickEvent.Action handle) {
super(handle);
}
示例2: deserialize
import net.minecraft.event.ClickEvent; //导入方法依赖的package包/类
public ChatStyle deserialize(JsonElement p_150204_1_, Type p_150204_2_, JsonDeserializationContext p_150204_3_)
{
if (p_150204_1_.isJsonObject())
{
ChatStyle var4 = new ChatStyle();
JsonObject var5 = p_150204_1_.getAsJsonObject();
if (var5.has("bold"))
{
var4.bold = Boolean.valueOf(var5.get("bold").getAsBoolean());
}
if (var5.has("italic"))
{
var4.italic = Boolean.valueOf(var5.get("italic").getAsBoolean());
}
if (var5.has("underlined"))
{
var4.underlined = Boolean.valueOf(var5.get("underlined").getAsBoolean());
}
if (var5.has("strikethrough"))
{
var4.strikethrough = Boolean.valueOf(var5.get("strikethrough").getAsBoolean());
}
if (var5.has("obfuscated"))
{
var4.obfuscated = Boolean.valueOf(var5.get("obfuscated").getAsBoolean());
}
if (var5.has("color"))
{
var4.color = (EnumChatFormatting)p_150204_3_.deserialize(var5.get("color"), EnumChatFormatting.class);
}
JsonObject var6;
if (var5.has("clickEvent"))
{
var6 = var5.getAsJsonObject("clickEvent");
ClickEvent.Action var7 = ClickEvent.Action.getValueByCanonicalName(var6.getAsJsonPrimitive("action").getAsString());
String var8 = var6.getAsJsonPrimitive("value").getAsString();
if (var7 != null && var8 != null && var7.shouldAllowInChat())
{
var4.chatClickEvent = new ClickEvent(var7, var8);
}
}
if (var5.has("hoverEvent"))
{
var6 = var5.getAsJsonObject("hoverEvent");
HoverEvent.Action var9 = HoverEvent.Action.getValueByCanonicalName(var6.getAsJsonPrimitive("action").getAsString());
IChatComponent var10 = (IChatComponent)p_150204_3_.deserialize(var6.get("value"), IChatComponent.class);
if (var9 != null && var10 != null && var9.shouldAllowInChat())
{
var4.chatHoverEvent = new HoverEvent(var9, var10);
}
}
return var4;
}
else
{
return null;
}
}