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