本文整理汇总了Java中net.minecraft.util.IThreadListener.addScheduledTask方法的典型用法代码示例。如果您正苦于以下问题:Java IThreadListener.addScheduledTask方法的具体用法?Java IThreadListener.addScheduledTask怎么用?Java IThreadListener.addScheduledTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.IThreadListener
的用法示例。
在下文中一共展示了IThreadListener.addScheduledTask方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PacketClassGui message, final MessageContext ctx)
{
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable()
{
@Override
public void run()
{
EntityPlayer player = Minecraft.getMinecraft().player;
PlayerInformation playerInfo = (PlayerInformation) player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
if (playerInfo != null && playerInfo.getPlayerClass() == 0)
{
player.openGui(LootSlashConquer.instance, GuiHandler.CLASS_SELECTION, player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ());
}
}
});
return null;
}
示例2: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PacketUpdateChunkLevel message, final MessageContext ctx)
{
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable()
{
@Override
public void run()
{
World world = Minecraft.getMinecraft().world;
ChunkPos chunkPos = new ChunkPos(message.chunkX, message.chunkZ);
IChunkLevelHolder chunkLevelHolder = CapabilityChunkLevel.getChunkLevelHolder(world);
if (chunkLevelHolder.getChunkLevel(chunkPos) != null) return;
IChunkLevel chunkLevel = new ChunkLevel(world, chunkPos, message.level);
chunkLevelHolder.setChunkLevel(chunkPos, chunkLevel);
}
});
return null;
}
示例3: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final ConfigSyncMessage message, MessageContext ctx)
{
IThreadListener threadListener = this.getThreadListener(ctx);
threadListener.addScheduledTask(new Runnable()
{
@Override
public void run()
{
ModConfiguration.enableInventoryGui = message.enableInventoryGui;
ModConfiguration.enableDeathDrops = message.enableDeathDrops;
ModConfiguration.requireEmptyHand = message.requireEmptyHand;
}
});
return null;
}
示例4: channelRead0
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, final OpenGui msg) throws Exception
{
IThreadListener thread = FMLCommonHandler.instance().getWorldThread(ctx.channel().attr(NetworkRegistry.NET_HANDLER).get());
if (thread.isCallingFromMinecraftThread())
{
process(msg);
}
else
{
thread.addScheduledTask(new Runnable()
{
public void run()
{
OpenGuiHandler.this.process(msg);
}
});
}
}
示例5: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PacketMaxMana message, MessageContext ctx)
{
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable()
{
@Override
public void run()
{
EntityPlayer entity = Minecraft.getMinecraft().player;
if (entity instanceof EntityPlayer)
{
final IMaxMana mana = CapabilityMaxMana.getMaxMana(entity);
mana.setMaxMana(message.mana);
}
}
});
return null;
}
示例6: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PacketMana message, MessageContext ctx)
{
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable()
{
@Override
public void run()
{
EntityPlayer entity = Minecraft.getMinecraft().player;
if (entity instanceof EntityPlayer)
{
final IMana mana = CapabilityMana.getMana(entity);
LostEclipse.LOGGER.info("Sending mana over to client: " + message.mana);
mana.setMana(message.mana);
}
}
});
return null;
}
示例7: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageLegalMovesResponse message, MessageContext ctx) {
if (message.legalPositions == null || message.controlBlockPos == null) {
return null;
}
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
CheckerBoardOverlay.INSTANCE.setValidMoves(message.legalPositions);
}
});
return null;
}
示例8: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageUpdateControlBlock message, MessageContext ctx) {
if (message.controlBlockPos == null) {
return null;
}
final IThreadListener mainThread = Minecraft.getMinecraft();
final EntityPlayerSP player = Minecraft.getMinecraft().player;
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
TileEntityChessControl control = ItemChessControlWand.getChessControlAt(player.world, message.controlBlockPos);
if (control == null) {
System.out.println("control block not found");
return;
}
control.readFromNBT(message.data);
}
});
return null;
}
示例9: reloadResources
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
public static void reloadResources(@Nonnull final Side side) {
// Reload can be called on either side so make sure we queue
// up a scheduled task appropriately.
if (managers.hasValue(side)) {
final IThreadListener tl = side == Side.SERVER ? FMLCommonHandler.instance().getMinecraftServerInstance()
: Minecraft.getMinecraft();
if (tl == null)
managers.clear(side);
else
tl.addScheduledTask(new Runnable() {
public void run() {
managers.get().reload();
}
});
}
}
示例10: processMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
/** IMPORTANT: Call this from the onMessage method in the subclass. */
public IMessage processMessage(ObservationRequestMessage message, MessageContext ctx)
{
IThreadListener mainThread = (WorldServer) ctx.getServerHandler().playerEntity.world;
final EntityPlayerMP player = ctx.getServerHandler().playerEntity;
final ObservationRequestMessage mess = message;
mainThread.addScheduledTask(new Runnable()
{
@Override
public void run()
{
JsonObject json = new JsonObject();
buildJson(json, player, mess);
// Send this message back again now we've filled in the json stats.
Map<String, String> returnData = new HashMap<String, String>();
returnData.put("json", json.toString());
mess.addReturnData(returnData);
MalmoMod.network.sendTo(new MalmoMod.MalmoMessage(MalmoMessageType.SERVER_OBSERVATIONSREADY, mess.id, returnData), player);
}
});
return null; // no response in this case
}
示例11: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final RecipeNavigationMessage message, MessageContext ctx)
{
final EntityPlayerMP player = ctx.getServerHandler().player;
IThreadListener threadListener = (WorldServer)player.world;
threadListener.addScheduledTask(new Runnable()
{
@Override
public void run()
{
Container container = player.openContainer;
if (container instanceof ContainerUncraftingTable)
{
ContainerUncraftingTable uncraftingContainer = (ContainerUncraftingTable)container;
uncraftingContainer.uncraftingResult.selectedCraftingGrid = message.recipeIndex;
uncraftingContainer.switchRecipe();
}
}
});
return null;
}
示例12: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final StructureTagMessage message, final MessageContext ctx)
{
// Or Minecraft.getMinecraft() on the client.
IThreadListener mainThread = (WorldServer) ctx.getServerHandler().player.world;
mainThread.addScheduledTask(new Runnable()
{
@Override
public void run()
{
// This is server side. Build the structure.
EnumStructureConfiguration structureConfig = message.getStructureConfig();
StructureConfiguration configuration = structureConfig.structureConfig.ReadFromNBTTagCompound(message.getMessageTag());
configuration.BuildStructure(ctx.getServerHandler().player, ctx.getServerHandler().player.world);
}
});
// no response in this case
return null;
}
示例13: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PlayerEntityTagMessage message, final MessageContext ctx)
{
// Or Minecraft.getMinecraft() on the client.
IThreadListener mainThread = Minecraft.getMinecraft();
mainThread.addScheduledTask(new Runnable()
{
@Override
public void run()
{
// This is client side.
NBTTagCompound newPlayerTag = Minecraft.getMinecraft().player.getEntityData();
newPlayerTag.setTag(EntityPlayerConfiguration.PLAYER_ENTITY_TAG, message.getMessageTag());
ClientEventHandler.playerConfig.loadFromNBTTagCompound(message.getMessageTag());
}
});
// no response in this case
return null;
}
示例14: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final EntityTileEntityUpdateMessage message, final MessageContext ctx)
{
IThreadListener mainThread = MoarCarts.proxy.getIThreadListener(ctx);
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
EntityMinecartTEBase minecartTEBase = message.getEntityMinecartTEBaseFromMessage(ctx);
if(minecartTEBase != null)
{
minecartTEBase.getTileEntity().readFromNBT(message.nbtTagCompound);
}
}
});
return null;
}
示例15: onMessage
import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final CAnvilStrikePacket message, MessageContext ctx) {
IThreadListener mainThread = net.minecraft.client.Minecraft.getMinecraft(); //(WorldServer) ctx.getServerHandler().playerentityIn.world; // or Minecraft.getMinecraft() on the client
mainThread.addScheduledTask(new Runnable()
{
@Override
public void run()
{
TileEntity te = net.minecraft.client.Minecraft.getMinecraft().world.getTileEntity(message.pos);
if(te != null)
{
TileAnvil anvil = (TileAnvil)te;
anvil.setStrikePoint(message.strikeIndex, message.strikePoint);
}
}
});
return null; // no response in this case
}