Java Code Examples for net.minecraft.world.World.getPlayerEntityByUUID()

The following are Jave code examples for showing how to use getPlayerEntityByUUID() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: uniquecrops   File: GrowthSteps.java   Source Code and License Vote up 6 votes
@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;
}
 
Example 2
Project: rezolve   File: RemoteShellActivateMessageHandler.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 3
Project: rezolve   File: RemoteShellReturnMessageHandler.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 4
Project: Bewitchment   File: ItemTaglock.java   Source Code and License Vote up 5 votes
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);
}
 
Example 5
Project: Melodium   File: MessageCompositionUpdate.java   Source Code and License Vote up 5 votes
@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;
     }