当前位置: 首页>>代码示例>>Java>>正文


Java WorldServer类代码示例

本文整理汇总了Java中net.minecraft.world.WorldServer的典型用法代码示例。如果您正苦于以下问题:Java WorldServer类的具体用法?Java WorldServer怎么用?Java WorldServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WorldServer类属于net.minecraft.world包,在下文中一共展示了WorldServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getThrower

import net.minecraft.world.WorldServer; //导入依赖的package包/类
public EntityLivingBase getThrower()
{
    if (this.thrower == null && this.throwerName != null && this.throwerName.length() > 0)
    {
        this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName);

        if (this.thrower == null && this.worldObj instanceof WorldServer)
        {
            try
            {
                Entity entity = ((WorldServer)this.worldObj).getEntityFromUuid(UUID.fromString(this.throwerName));

                if (entity instanceof EntityLivingBase)
                {
                    this.thrower = (EntityLivingBase)entity;
                }
            }
            catch (Throwable var2)
            {
                this.thrower = null;
            }
        }
    }

    return this.thrower;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:27,代码来源:EntityThrowable.java

示例2: dueProcess

import net.minecraft.world.WorldServer; //导入依赖的package包/类
private void dueProcess(PlayerInteractEvent event, BiFunction<RegionSelector<?, ?>, Vector3i, String> selector) {
    if (event.getWorld().isRemote) {
        // don't process on client
        // perhaps we can cancel on client if we do config sync
        return;
    }

    if (event.getItemStack().getItem() == HardVoxConfig.getSelectionWand()) {
        // cancel event, fire selection
        event.setCanceled(true);

        WorldServer ws = (WorldServer) event.getWorld();
        SessionManager.getInstance()
                .getSession(ws.getMinecraftServer(), event.getEntityPlayer())
                .performRegionCommand(sel -> selector.apply(sel, VecBridge.toFlow(event.getPos())));
        // send an update to the player so the block re-appears?
        ws.getPlayerChunkMap().markBlockForUpdate(event.getPos());
    }
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:20,代码来源:SelectionListener.java

示例3: getEntityFromUuid

import net.minecraft.world.WorldServer; //导入依赖的package包/类
public Entity getEntityFromUuid(UUID uuid)
{
    for (WorldServer worldserver : this.worldServers)
    {
        if (worldserver != null)
        {
            Entity entity = worldserver.getEntityFromUuid(uuid);

            if (entity != null)
            {
                return entity;
            }
        }
    }

    return null;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:MinecraftServer.java

示例4: showPlayer

import net.minecraft.world.WorldServer; //导入依赖的package包/类
public void showPlayer(Player player) {
    Validate.notNull(player, "shown player cannot be null");
    if (getHandle().playerNetServerHandler == null) return;
    if (equals(player)) return;
    if (!hiddenPlayers.contains(player.getUniqueId())) return;
    hiddenPlayers.remove(player.getUniqueId());

    EntityTracker tracker = ((WorldServer) entity.worldObj).theEntityTracker;
    EntityPlayerMP other = ((CraftPlayer) player).getHandle();
    EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntityIDs.lookup(other.getEntityId());
    if (entry != null) {
        entry.removePlayerFromTracker(getHandle());
    }

    getHandle().playerNetServerHandler.sendPacket(new S38PacketPlayerListItem(player.getPlayerListName(), false, 9999));
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:CraftPlayer.java

示例5: save

import net.minecraft.world.WorldServer; //导入依赖的package包/类
public boolean save(boolean p_189712_1_)
{
    if (this.mode == TileEntityStructure.Mode.SAVE && !this.world.isRemote && !StringUtils.isNullOrEmpty(this.name))
    {
        BlockPos blockpos = this.getPos().add(this.position);
        WorldServer worldserver = (WorldServer)this.world;
        MinecraftServer minecraftserver = this.world.getMinecraftServer();
        TemplateManager templatemanager = worldserver.getStructureTemplateManager();
        Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(this.name));
        template.takeBlocksFromWorld(this.world, blockpos, this.size, !this.ignoreEntities, Blocks.STRUCTURE_VOID);
        template.setAuthor(this.author);
        return !p_189712_1_ || templatemanager.writeTemplate(minecraftserver, new ResourceLocation(this.name));
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:TileEntityStructure.java

示例6: set

import net.minecraft.world.WorldServer; //导入依赖的package包/类
@Override
public void set(GlobalChunkPos pos, float value)
{
    if (loaded.containsKey(pos))
        if (loaded.get(pos).equals(value))
            return;
    loaded.put(pos, value);
    WorldServer wrld = DimensionManager.getWorld(pos.getDimension());
    wrld.getChunkFromChunkCoords(pos.getX(), pos.getZ()).markDirty();
    PlayerChunkMapEntry map = wrld.getPlayerChunkMap().getEntry(pos.getX(), pos.getZ());
    if (map != null)
    {
        for (EntityPlayerMP p : map.players)
        {
            NetworkManager.sendTo(new CPacketSyncSif(pos, value), p);
        }
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:19,代码来源:SifStorageServer.java

示例7: processMessage

import net.minecraft.world.WorldServer; //导入依赖的package包/类
/** IMPORTANT: Call this from the onMessage method in the subclass. */
public IMessage processMessage(final ObservationRequestMessage message, final MessageContext ctx)
{
	IThreadListener mainThread = (WorldServer)ctx.getServerHandler().playerEntity.worldObj;
	mainThread.addScheduledTask(new Runnable() {
		@Override
		public void run() {
			EntityPlayerMP player = ctx.getServerHandler().playerEntity;
			JsonObject json = new JsonObject();
			buildJson(json, player, message, ctx);
			// 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());
			message.addReturnData(returnData);
			MalmoMod.network.sendTo(new MalmoMod.MalmoMessage(MalmoMessageType.SERVER_OBSERVATIONSREADY, message.id, returnData), player);
		}
	});
	return null; // no response in this case
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:20,代码来源:ObservationFromServer.java

示例8: generate

import net.minecraft.world.WorldServer; //导入依赖的package包/类
@Override
public boolean generate(World worldIn, Random rand, BlockPos posIn) {
	
	if (!(worldIn instanceof WorldServer)) {
		return false;
	}

	WorldServer world = (WorldServer) worldIn;

	if (world.provider.getDimension() != -1) {
		return false;
	}

	if (world.rand.nextInt(rarity) == 0) {
		int y = findPosY(world, posIn);
		if (y > 0) {
			BlockPos pos = new BlockPos(posIn.getX(), findPosY(world, posIn), posIn.getZ());
			generateMonument(world, pos, rand);
		}
		return true;
	}

	return false;

}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:26,代码来源:InfernalMonumentGenerator.java

示例9: onCastTick

import net.minecraft.world.WorldServer; //导入依赖的package包/类
@Override
public void onCastTick(World world, EntityPlayer player, ItemStack stack) {
	if (!world.isRemote) {
		BlockPos centerPos = player.getPosition();
		AxisAlignedBB area = new AxisAlignedBB(centerPos).expandXyz(3F);
		for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(player, area)) {
			if (entity instanceof EntityLivingBase) {
				WorldServer worldServer = (WorldServer) world;
				if (player.getItemInUseCount() % 10 == 0 && consumePower(player)) {
					MessageSoulDrainFX message = new MessageSoulDrainFX(entity.posX,
							entity.posY + (entity.height / 2.0F), entity.posZ, player.posX,
							player.posY + (player.height / 2.0F), player.posZ);
					PacketHandler.INSTANCE.sendToAllAround(message, new NetworkRegistry.TargetPoint(
							player.dimension, player.posX, player.posY, player.posZ, 128));
					entity.attackEntityFrom(DamageSource.magic, 1);
					world.spawnEntity(new EntityXPOrb(world, entity.posX, entity.posY + 0.5, entity.posZ, 1));
				}
			}
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:22,代码来源:SpellSoulDrain.java

示例10: bulletHit

import net.minecraft.world.WorldServer; //导入依赖的package包/类
protected void bulletHit(RayTraceResult result)
{
    if (result.entityHit == null)
    {
        ((WorldServer)this.world).spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 2, 0.2D, 0.2D, 0.2D, 0.0D, new int[0]);
        this.playSound(SoundEvents.ENTITY_SHULKER_BULLET_HIT, 1.0F, 1.0F);
    }
    else
    {
        boolean flag = result.entityHit.attackEntityFrom(DamageSource.causeIndirectDamage(this, this.owner).setProjectile(), 4.0F);

        if (flag)
        {
            this.applyEnchantments(this.owner, result.entityHit);

            if (result.entityHit instanceof EntityLivingBase)
            {
                ((EntityLivingBase)result.entityHit).addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 200));
            }
        }
    }

    this.setDead();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:EntityShulkerBullet.java

示例11: setViewDistance

import net.minecraft.world.WorldServer; //导入依赖的package包/类
public void setViewDistance(int distance)
{
    this.viewDistance = distance;

    if (this.mcServer.worldServers != null)
    {
        for (WorldServer worldserver : this.mcServer.worldServers)
        {
            if (worldserver != null)
            {
                worldserver.getPlayerChunkMap().setPlayerViewRadius(distance);
                worldserver.getEntityTracker().setViewDistance(distance);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:PlayerList.java

示例12: 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;
}
 
开发者ID:Lumaceon,项目名称:CraftingParadiseMod,代码行数:21,代码来源:HandlerWorldCraft.java

示例13: onItemPickup

import net.minecraft.world.WorldServer; //导入依赖的package包/类
/**
 * Called when the entity picks up an item.
 */
public void onItemPickup(Entity entityIn, int quantity)
{
    if (!entityIn.isDead && !this.worldObj.isRemote)
    {
        EntityTracker entitytracker = ((WorldServer)this.worldObj).getEntityTracker();

        if (entityIn instanceof EntityItem)
        {
            entitytracker.sendToAllTrackingEntity(entityIn, new SPacketCollectItem(entityIn.getEntityId(), this.getEntityId()));
        }

        if (entityIn instanceof EntityArrow)
        {
            entitytracker.sendToAllTrackingEntity(entityIn, new SPacketCollectItem(entityIn.getEntityId(), this.getEntityId()));
        }

        if (entityIn instanceof EntityXPOrb)
        {
            entitytracker.sendToAllTrackingEntity(entityIn, new SPacketCollectItem(entityIn.getEntityId(), this.getEntityId()));
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:EntityLivingBase.java

示例14: updateTimeAndWeatherForPlayer

import net.minecraft.world.WorldServer; //导入依赖的package包/类
/**
 * Updates the time and weather for the given player to those of the given world
 */
public void updateTimeAndWeatherForPlayer(EntityPlayerMP playerIn, WorldServer worldIn)
{
    WorldBorder worldborder = this.mcServer.worldServers[0].getWorldBorder();
    playerIn.connection.sendPacket(new SPacketWorldBorder(worldborder, SPacketWorldBorder.Action.INITIALIZE));
    playerIn.connection.sendPacket(new SPacketTimeUpdate(worldIn.getTotalWorldTime(), worldIn.getWorldTime(), worldIn.getGameRules().getBoolean("doDaylightCycle")));
    BlockPos blockpos = worldIn.getSpawnPoint();
    playerIn.connection.sendPacket(new SPacketSpawnPosition(blockpos));

    if (worldIn.isRaining())
    {
        playerIn.connection.sendPacket(new SPacketChangeGameState(1, 0.0F));
        playerIn.connection.sendPacket(new SPacketChangeGameState(7, worldIn.getRainStrength(1.0F)));
        playerIn.connection.sendPacket(new SPacketChangeGameState(8, worldIn.getThunderStrength(1.0F)));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:PlayerList.java

示例15: saveAllWorlds

import net.minecraft.world.WorldServer; //导入依赖的package包/类
/**
 * par1 indicates if a log message should be output.
 */
protected void saveAllWorlds(boolean dontLog)
{
    if (!this.worldIsBeingDeleted)
    {
        for (WorldServer worldserver : this.worldServers)
        {
            if (worldserver != null)
            {
                if (!dontLog)
                {
                    logger.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionName());
                }

                try
                {
                    worldserver.saveAllChunks(true, (IProgressUpdate)null);
                }
                catch (MinecraftException minecraftexception)
                {
                    logger.warn(minecraftexception.getMessage());
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:29,代码来源:MinecraftServer.java


注:本文中的net.minecraft.world.WorldServer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。