本文整理汇总了Java中net.minecraft.world.WorldServer.addScheduledTask方法的典型用法代码示例。如果您正苦于以下问题:Java WorldServer.addScheduledTask方法的具体用法?Java WorldServer.addScheduledTask怎么用?Java WorldServer.addScheduledTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.WorldServer
的用法示例。
在下文中一共展示了WorldServer.addScheduledTask方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleData
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
@Override
public void handleData(NBTTagCompound data)
{
Biome b = Biome.getBiome(data.getInteger("biomeID"));
DimBlockPos dbp = SerializationUtils.deserialize(data.getByteArray("blockPosData"));
if (MC.getSide() == Side.CLIENT)
{
VoidApi.proxy.getClientListener().addScheduledTask(() -> {
if (VoidApi.proxy.getClientWorld().isBlockLoaded(dbp.pos))
ChunkUtils.setBiomeAt(b, dbp.pos, VoidApi.proxy.getClientWorld());}
);
}
else
{
WorldServer ws = DimensionManager.getWorld(dbp.dim);
ws.addScheduledTask(() -> {
if (ws.isBlockLoaded(dbp.pos))
ChunkUtils.setBiomeAt(b, dbp.pos, ws);}
);
}
}
示例2: onMessage
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageWorldCraft message, final MessageContext ctx)
{
if(ctx.side != Side.SERVER)
{
System.err.println("MessageWorldCraft received on wrong side:" + ctx.side);
return null;
}
final EntityPlayerMP sendingPlayer = ctx.getServerHandler().player;
if(sendingPlayer == null)
{
System.err.println("MessageWorldCraft received with null player.");
return null;
}
final WorldServer playerWorldServer = sendingPlayer.getServerWorld();
playerWorldServer.addScheduledTask(() -> processMessage(message, ctx, playerWorldServer));
return null;
}
示例3: onMessage
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final EntityFlagMessage message, MessageContext context)
{
final WorldServer world = (WorldServer)context.getServerHandler().player.world;
world.addScheduledTask(new Runnable()
{
@Override
public void run()
{
EntityUtils.setFlag(world.getEntityByID(message.entityId), message.flag, message.value);
}
});
return null;
}
示例4: onMessage
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final SwapItems message, MessageContext ctx)
{
final EntityPlayerMP player = ctx.getServerHandler().player;
final WorldServer world = (WorldServer) player.world;
world.addScheduledTask(() -> swapItem(message.swapWith, player));
return null; // no response in this case
}
示例5: handleData
import net.minecraft.world.WorldServer; //导入方法依赖的package包/类
@Override
public void handleData(NBTTagCompound data)
{
DimBlockPos dbp = new DimBlockPos();
dbp.deserializeNBT(data.getCompoundTag("blockPosData"));
NBTTagCompound tileData = data.getCompoundTag("tileData");
if (MC.getSide() == Side.CLIENT)
{
VoidApi.proxy.getClientListener().addScheduledTask(() -> {
if (VoidApi.proxy.getClientWorld().isBlockLoaded(dbp.pos) && VoidApi.proxy.getClientWorld().getTileEntity(dbp.pos) != null)
{
Optional.ofNullable(VoidApi.proxy.getClientWorld().getTileEntity(dbp.pos)).ifPresent(t -> t.deserializeNBT(tileData));
}
VoidApi.proxy.getClientWorld().markBlockRangeForRenderUpdate(dbp.pos.down().north().west(), dbp.pos.up().west().south());
});
}
else
{
// Server deserializing a tile from client data?..
WorldServer ws = DimensionManager.getWorld(dbp.dim);
ws.addScheduledTask(() -> {
if (ws.isBlockLoaded(dbp.pos) && ws.getTileEntity(dbp.pos) != null)
{
Optional.ofNullable(ws.getTileEntity(dbp.pos)).ifPresent(t -> t.deserializeNBT(tileData));
}
});
}
}