當前位置: 首頁>>代碼示例>>Java>>正文


Java World.getPlayerEntityByUUID方法代碼示例

本文整理匯總了Java中net.minecraft.world.World.getPlayerEntityByUUID方法的典型用法代碼示例。如果您正苦於以下問題:Java World.getPlayerEntityByUUID方法的具體用法?Java World.getPlayerEntityByUUID怎麽用?Java World.getPlayerEntityByUUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.world.World的用法示例。


在下文中一共展示了World.getPlayerEntityByUUID方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canAdvance

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	TileEntity tile = world.getTileEntity(pos);
	if (tile != null && tile instanceof TileFeroxia) {
		TileFeroxia te = (TileFeroxia)tile;
		EntityPlayer player = UCUtils.getPlayerFromUUID(te.getOwner().toString());
		if (!world.isRemote && player != null && world.getPlayerEntityByUUID(te.getOwner()) != null) {
			NBTTagCompound tag = player.getEntityData();
			if (!tag.hasKey("hasSacrificed"))
			{
				player.addChatMessage(new TextComponentString(TextFormatting.RED + "The savage plant whispers: \"The time is right to perform a self sacrifice.\""));
				tag.setBoolean("hasSacrificed", false);
				return false;
			}
			if (tag.hasKey("hasSacrificed") && tag.getBoolean("hasSacrificed"))
			{
				tag.removeTag("hasSacrificed");
				world.setBlockState(pos, ((Feroxia)state.getBlock()).withAge(7), 2);
				GrowthSteps.generateSteps(player);
				return false;
			}
		}
	}
	return false;
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:27,代碼來源:GrowthSteps.java

示例2: handleInGame

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void handleInGame(RemoteShellActivateMessage message, World world) {
	TileEntity entity = world.getTileEntity(message.getEntityPos());
	
	if (!(entity instanceof RemoteShellEntity)) {
		System.err.println("No bundle builder entity at "+message.getEntityPos().toString());
		return;
	}
	
	RemoteShellEntity remoteShell = (RemoteShellEntity)entity;
	EntityPlayer player = world.getPlayerEntityByUUID(UUID.fromString(message.playerId));
	
	remoteShell.activate(message.activatedMachine, player);
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:15,代碼來源:RemoteShellActivateMessageHandler.java

示例3: handleInGame

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
public void handleInGame(RemoteShellReturnMessage message, World world) {
	TileEntity entity = world.getTileEntity(message.getEntityPos());
	
	if (entity == null || !(entity instanceof RemoteShellEntity)) {
		System.err.println("No remoteShell entity at "+message.getEntityPos().toString());
		return;
	}
	
	RemoteShellEntity remoteShell = (RemoteShellEntity)entity;
	EntityPlayer player = world.getPlayerEntityByUUID(UUID.fromString(message.playerId));
	
	remoteShell.returnToShell(player);
}
 
開發者ID:astronautlabs,項目名稱:rezolve,代碼行數:15,代碼來源:RemoteShellReturnMessageHandler.java

示例4: getVictim

import net.minecraft.world.World; //導入方法依賴的package包/類
public Optional<EntityLivingBase> getVictim(ItemStack stack, World world) {
	UUID uuid = NBTHelper.getUniqueID(stack, TAGLOCK_ENTITY);
	for (Entity entity : world.loadedEntityList) {
		if (entity instanceof EntityLivingBase && entity.getUniqueID().equals(uuid)) {
			return Optional.of((EntityLivingBase) entity);
		}
	}
	EntityPlayer victim = world.getPlayerEntityByUUID(uuid);
	return Optional.ofNullable(victim);
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:11,代碼來源:ItemTaglock.java

示例5: onMessage

import net.minecraft.world.World; //導入方法依賴的package包/類
@Override
     public IMessage onMessage(final MessageCompositionUpdate message, final MessageContext ctx) {
 		World world = ctx.getServerHandler().playerEntity.world;
 		EntityPlayer p = world.getPlayerEntityByUUID(message.id);
 		if (p != null){
 			ItemStack s = p.getHeldItem(message.mainHand ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND).copy();
 			if (s.getItem() == RegistryManager.composition_paper){
 				s.setTagCompound(message.tag);
 				p.setHeldItem(message.mainHand ? EnumHand.MAIN_HAND : EnumHand.OFF_HAND, s);
 			}
 		}
return null;
     }
 
開發者ID:TeamMelodium,項目名稱:Melodium,代碼行數:14,代碼來源:MessageCompositionUpdate.java


注:本文中的net.minecraft.world.World.getPlayerEntityByUUID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。