本文整理汇总了Java中net.minecraft.client.Minecraft.addScheduledTask方法的典型用法代码示例。如果您正苦于以下问题:Java Minecraft.addScheduledTask方法的具体用法?Java Minecraft.addScheduledTask怎么用?Java Minecraft.addScheduledTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.Minecraft
的用法示例。
在下文中一共展示了Minecraft.addScheduledTask方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public void execute(String[] args) throws CmdError
{
if(args.length != 1)
syntaxError();
Minecraft mc = Minecraft.getMinecraft();
mc.addScheduledTask(() -> {
mc.displayGuiScreen(new GuiConnecting(new GuiWurstMainMenu(), mc,
new ServerData("", args[0], false)));
System.out.println(
"Joined " + args[0] + " as " + mc.session.getUsername());
});
}
示例2: onMessage
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(MessageReceiveConfiguration message, MessageContext ctx) {
FirstAid.activeHealingConfig = message.healingCfg;
FirstAid.activeDamageConfig = message.damageCfg;
FirstAid.scaleMaxHealth = message.scaleMaxHealth;
AbstractPlayerDamageModel damageModel = PlayerDamageModel.create();
damageModel.deserializeNBT(message.playerDamageModel);
Minecraft mc = Minecraft.getMinecraft();
FirstAid.playerMaxHealth = FirstAid.activeDamageConfig.maxHealthHead + FirstAid.activeDamageConfig.maxHealthLeftArm
+ FirstAid.activeDamageConfig.maxHealthLeftLeg + FirstAid.activeDamageConfig.maxHealthLeftFoot
+ FirstAid.activeDamageConfig.maxHealthBody + FirstAid.activeDamageConfig.maxHealthRightArm
+ FirstAid.activeDamageConfig.maxHealthRightLeg + FirstAid.activeDamageConfig.maxHealthRightFoot;
FirstAid.logger.info("Received configuration");
mc.addScheduledTask(() -> {
PlayerDataManager.capList.put(mc.player, damageModel);
if (damageModel.hasTutorial)
PlayerDataManager.tutorialDone.add(mc.player.getName());
else
mc.player.sendMessage(new TextComponentString("[First Aid] " + I18n.format("firstaid.tutorial.hint", ClientProxy.showWounds.getDisplayName())));
});
return null;
}
示例3: onMessage
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final JumpkinRotationMessage message, MessageContext ctx)
{
Minecraft minecraft = Minecraft.getMinecraft();
final WorldClient world = minecraft.world;
minecraft.addScheduledTask(new Runnable()
{
@Override
public void run()
{
EntityJumpkin entity = (EntityJumpkin)world.getEntityByID(message.entityId);
entity.rotationYaw = message.rotationYaw;
entity.rotationPitch = message.rotationPitch;
}
});
return null;
}
示例4: onMessage
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageClientPlanetChange message, final MessageContext ctx)
{
if(ctx.side != Side.CLIENT)
{
System.err.println("MessageClientPlanetChange received on wrong side:" + ctx.side);
return null;
}
Minecraft minecraft = Minecraft.getMinecraft();
final WorldClient worldClient = minecraft.world;
minecraft.addScheduledTask(() -> processMessage(message, ctx, worldClient));
return null;
}
示例5: onMessage
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageBiomeChange message, final MessageContext ctx)
{
if(ctx.side != Side.CLIENT)
{
System.err.println("MessageBiomeChange received on wrong side:" + ctx.side);
return null;
}
Minecraft minecraft = Minecraft.getMinecraft();
final WorldClient worldClient = minecraft.world;
minecraft.addScheduledTask(() -> processMessage(message, ctx, worldClient));
return null;
}
示例6: onMessage
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final VillagerCareerMessage message, MessageContext ctx)
{
Minecraft minecraft = Minecraft.getMinecraft();
final WorldClient world = minecraft.world;
minecraft.addScheduledTask(new Runnable()
{
@Override
public void run()
{
// get the entity referenced by the specified id
Entity entity = world.getEntityByID(message.entityId);
// ensure that the entity is a villager
if (entity instanceof EntityVillager)
{
// cast the entity to type EntityVillager
EntityVillager villager = (EntityVillager)entity;
// read the villager's nbt data into a tag compound
NBTTagCompound compound = new NBTTagCompound();
villager.writeEntityToNBT(compound);
// set the career property of the tag compound and write it back to the villager
compound.setInteger("Career", message.careerId);
villager.readEntityFromNBT(compound);
// if there's currently an instance of the villager inventory screen open
GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
if (currentScreen != null && currentScreen instanceof GuiVillagerInventory)
{
// update the nbt data for the villager attached to the screen from the tag compound
((GuiVillagerInventory)currentScreen).readVillagerFromNBT(compound);
}
}
}
});
return null;
}
示例7: channelRead0
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, SPacketJoinGame msg) throws Exception {
if (ctx.channel().isOpen())
{
try
{
try {
NetHandlerPlayClient handler = (NetHandlerPlayClient) m_manager.getNetHandler();
Minecraft scheduler = InjectionHandler.readFieldOfType(handler, Minecraft.class);
if (!scheduler.isCallingFromMinecraftThread())
{
scheduler.addScheduledTask(new Runnable()
{
public void run()
{
invoke(msg);
}
});
throw ThreadQuickExitException.INSTANCE;
} else {
invoke(msg);
}
} catch (Exception e) {
if (e instanceof ThreadQuickExitException) throw e;
Util.logger.logException("Unable to get scheduler!", e);
// we died - let vanilla take over!
ctx.fireChannelRead(msg);
return;
}
}
catch (ThreadQuickExitException var4)
{
;
}
}
}
示例8: channelRead0
import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, SPacketRespawn msg) throws Exception {
if (ctx.channel().isOpen())
{
try
{
try {
NetHandlerPlayClient handler = (NetHandlerPlayClient) m_manager.getNetHandler();
Minecraft scheduler = InjectionHandler.readFieldOfType(handler, Minecraft.class);
if (!scheduler.isCallingFromMinecraftThread())
{
scheduler.addScheduledTask(new Runnable()
{
@Override
public void run()
{
invoke(msg);
}
});
throw ThreadQuickExitException.INSTANCE;
} else {
invoke(msg);
}
} catch (Exception e) {
if (e instanceof ThreadQuickExitException) throw e;
Util.logger.logException("Unable to get scheduler!", e);
// we died - let vanilla take over!
ctx.fireChannelRead(msg);
return;
}
}
catch (ThreadQuickExitException var4)
{
;
}
}
}