本文整理匯總了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)
{
;
}
}
}